2018-05-26 21:51:41 +01:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-03-15 05:14:06 +00:00
|
|
|
import {
|
|
|
|
accountProfileFollowButton,
|
|
|
|
getNthStatus,
|
|
|
|
sleep
|
|
|
|
} from '../utils'
|
|
|
|
import {
|
2018-03-16 17:06:02 +00:00
|
|
|
authorizeFollowRequestAs, getFollowRequestsAs
|
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 => {
|
2018-05-26 21:51:41 +01:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-03-15 05:14:06 +00:00
|
|
|
.navigateTo('/accounts/6')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
|
|
|
.click(accountProfileFollowButton)
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow (follow requested)')
|
|
|
|
.click(accountProfileFollowButton)
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
|
|
|
.click(accountProfileFollowButton)
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow (follow requested)')
|
|
|
|
|
2018-03-16 17:06:02 +00:00
|
|
|
let requests = await getFollowRequestsAs('LockedAccount')
|
|
|
|
await authorizeFollowRequestAs('LockedAccount', requests.slice(-1)[0].id)
|
2018-03-15 05:14:06 +00:00
|
|
|
|
|
|
|
await sleep(2000)
|
|
|
|
|
|
|
|
await t.navigateTo('/accounts/6')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow')
|
|
|
|
.expect(getNthStatus(0).innerText).contains('This account is locked')
|
|
|
|
.click(accountProfileFollowButton)
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
|
|
|
})
|