pinafore/tests/spec/021-followers-follows.js
Nolan Lawson 63003c3763
fix: fix aria-posinset should be 1-based (#1055)
* fix: fix aria-posinset should be 1-based

fixes #1053

* second attempt to fix tests

* try to fix test

*  fixup

* lint fix

* fix more tests

* simplify test math
2019-02-28 08:56:25 -08:00

29 lines
1 KiB
JavaScript

import {
followersButton,
followsButton, getNthSearchResult,
getNthStatusSelector, getUrl, goBack
} from '../utils'
import { loginAsFoobar } from '../roles'
import { Selector as $ } from 'testcafe'
fixture`021-followers-follows.js`
.page`http://localhost:4002`
test('shows followers and follows', async t => {
await loginAsFoobar(t)
await t
.click($(`${getNthStatusSelector(1)} .status-author-name`))
.expect(getUrl()).match(/\/accounts\/3$/)
.expect(followsButton.getAttribute('aria-label')).eql('Follows 2')
.click(followsButton)
.expect(getUrl()).contains('/accounts/3/follows')
.expect(getNthSearchResult(1).innerText).contains('@foobar')
.expect(getNthSearchResult(2).innerText).contains('@admin')
await goBack()
await t.expect(getUrl()).match(/\/accounts\/3$/)
.expect(followersButton.getAttribute('aria-label')).eql('Followed by 1')
.click(followersButton)
.expect(getUrl()).contains('/accounts/3/followers')
.expect(getNthSearchResult(1).innerText).contains('@admin')
})