2018-04-15 07:18:48 +02:00
|
|
|
import {
|
|
|
|
accountProfileFollowButton,
|
|
|
|
accountProfileMoreOptionsButton, closeDialogButton,
|
2021-02-16 01:45:46 +01:00
|
|
|
getNthDialogOptionsOption,
|
|
|
|
sleep
|
2018-04-15 07:18:48 +02:00
|
|
|
} from '../utils'
|
2018-05-26 22:51:41 +02:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2019-11-09 23:25:26 +01:00
|
|
|
import { unfollowAs } from '../serverActions'
|
2018-04-15 07:18:48 +02:00
|
|
|
|
|
|
|
fixture`115-follow-unfollow.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('Can follow and unfollow an account from the profile page', async t => {
|
2019-11-09 23:25:26 +01:00
|
|
|
await unfollowAs('foobar', 'baz') // reset
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-04-15 07:18:48 +02:00
|
|
|
.navigateTo('/accounts/5')
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
2019-11-09 23:25:26 +01:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
2021-02-16 01:45:46 +01:00
|
|
|
await sleep(500)
|
|
|
|
await t
|
2018-04-15 07:18:48 +02:00
|
|
|
.click(accountProfileMoreOptionsButton)
|
2021-02-16 01:45:46 +01:00
|
|
|
await sleep(500)
|
|
|
|
await t
|
2018-04-15 07:18:48 +02:00
|
|
|
.expect(getNthDialogOptionsOption(1).innerText).contains('Mention @baz')
|
|
|
|
.expect(getNthDialogOptionsOption(2).innerText).contains('Follow @baz')
|
2021-02-16 01:45:46 +01:00
|
|
|
await sleep(500)
|
|
|
|
await t
|
2018-04-15 07:18:48 +02:00
|
|
|
.click(getNthDialogOptionsOption(2))
|
2019-11-18 03:23:32 +01:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow')
|
2019-11-09 23:25:26 +01:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Unfollow')
|
2021-02-16 01:45:46 +01:00
|
|
|
await sleep(500)
|
|
|
|
await t
|
2018-04-15 07:18:48 +02:00
|
|
|
.click(accountProfileMoreOptionsButton)
|
|
|
|
.expect(getNthDialogOptionsOption(2).innerText).contains('Unfollow @baz')
|
2021-02-16 01:45:46 +01:00
|
|
|
await sleep(500)
|
|
|
|
await t
|
2018-04-15 07:18:48 +02:00
|
|
|
.click(getNthDialogOptionsOption(2))
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
2019-11-09 23:25:26 +01:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
2021-02-16 01:45:46 +01:00
|
|
|
await sleep(500)
|
|
|
|
await t
|
2018-04-15 07:18:48 +02:00
|
|
|
.click(accountProfileMoreOptionsButton)
|
|
|
|
.expect(getNthDialogOptionsOption(2).innerText).contains('Follow @baz')
|
2021-02-16 01:45:46 +01:00
|
|
|
await sleep(500)
|
|
|
|
await t
|
2018-04-15 07:18:48 +02:00
|
|
|
.click(closeDialogButton)
|
|
|
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
2019-11-09 23:25:26 +01:00
|
|
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
2018-04-15 07:18:48 +02:00
|
|
|
})
|