2018-05-26 20:51:41 +00:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-03-15 05:14:06 +00:00
|
|
|
import {
|
|
|
|
accountProfileFollowButton,
|
|
|
|
getNthStatus,
|
|
|
|
sleep
|
|
|
|
} from '../utils'
|
|
|
|
import {
|
2019-11-09 22:25:26 +00:00
|
|
|
authorizeFollowRequestAs, getFollowRequestsAs, unfollowAs
|
2018-03-15 05:14:06 +00:00
|
|
|
} from '../serverActions'
|
|
|
|
|
|
|
|
fixture`106-follow-requests.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('can request to follow an account', async t => {
|
2019-11-09 22:25:26 +00:00
|
|
|
await unfollowAs('foobar', 'LockedAccount') // reset
|
2018-05-26 20:51:41 +00:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-03-15 05:14:06 +00:00
|
|
|
.navigateTo('/accounts/6')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
2019-11-09 22:25:26 +00:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-pressed')).eql('false')
|
2018-03-15 05:14:06 +00:00
|
|
|
.click(accountProfileFollowButton)
|
2019-11-09 22:25:26 +00:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow (follow requested)')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Unfollow (follow requested)')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-pressed')).eql('true')
|
2018-03-15 05:14:06 +00:00
|
|
|
.click(accountProfileFollowButton)
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
2019-11-09 22:25:26 +00:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-pressed')).eql('false')
|
2018-03-15 05:14:06 +00:00
|
|
|
.click(accountProfileFollowButton)
|
2019-11-09 22:25:26 +00:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow (follow requested)')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Unfollow (follow requested)')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-pressed')).eql('true')
|
2018-03-15 05:14:06 +00:00
|
|
|
|
2019-08-03 20:49:37 +00:00
|
|
|
const requests = await getFollowRequestsAs('LockedAccount')
|
2018-03-16 17:06:02 +00:00
|
|
|
await authorizeFollowRequestAs('LockedAccount', requests.slice(-1)[0].id)
|
2018-03-15 05:14:06 +00:00
|
|
|
|
|
|
|
await sleep(2000)
|
|
|
|
|
|
|
|
await t.navigateTo('/accounts/6')
|
2019-11-09 22:25:26 +00:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Unfollow')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-pressed')).eql('true')
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatus(1).innerText).contains('This account is locked')
|
2018-03-15 05:14:06 +00:00
|
|
|
.click(accountProfileFollowButton)
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
2019-11-09 22:25:26 +00:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-pressed')).eql('false')
|
2018-03-15 05:14:06 +00:00
|
|
|
})
|