1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-14 19:38:28 +01:00
Pinafore-Web-Client-Frontend/tests/spec/106-follow-requests.js
2018-03-16 10:06:02 -07:00

36 lines
1.3 KiB
JavaScript

import { foobarRole } from '../roles'
import {
accountProfileFollowButton,
getNthStatus,
sleep
} from '../utils'
import {
authorizeFollowRequestAs, getFollowRequestsAs
} from '../serverActions'
fixture`106-follow-requests.js`
.page`http://localhost:4002`
test('can request to follow an account', async t => {
await t.useRole(foobarRole)
.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)')
let requests = await getFollowRequestsAs('LockedAccount')
await authorizeFollowRequestAs('LockedAccount', requests.slice(-1)[0].id)
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')
})