pinafore/tests/spec/004-pinned-statuses.js
Nolan Lawson efdb0bc534
Remove testcafe roles and run in parallel x4 (#334)
* more attempts to fix test flakiness

* remove testcafe roles entirely

* really remove testcafe roles

* run testcafe in parallel x2

* run testcafe in parallel x4

* fix online/offline forcing in tests

* fix pin test
2018-05-26 13:51:41 -07:00

39 lines
1.5 KiB
JavaScript

import { Selector as $ } from 'testcafe'
import { communityNavButton, getNthPinnedStatus, getUrl } from '../utils'
import { loginAsFoobar } from '../roles'
fixture`004-pinned-statuses.js`
.page`http://localhost:4002`
test("shows a user's pinned statuses", async t => {
await loginAsFoobar(t)
await t
.click(communityNavButton)
.expect(getUrl()).contains('/community')
.click($('a[href="/pinned"]'))
.expect(getUrl()).contains('/pinned')
.expect($('.status-article').getAttribute('aria-posinset')).eql('0')
.expect($('.status-article').getAttribute('aria-setsize')).eql('1')
.expect($('.status-article .status-content').innerText).contains('this is unlisted')
})
test("shows pinned statuses on a user's account page", async t => {
await loginAsFoobar(t)
await t
.navigateTo('/accounts/2')
.expect(getNthPinnedStatus(0).getAttribute('aria-posinset')).eql('0')
.expect(getNthPinnedStatus(0).getAttribute('aria-setsize')).eql('1')
.expect(getNthPinnedStatus(0).innerText).contains('this is unlisted')
})
test("shows pinned statuses on a user's account page 2", async t => {
await loginAsFoobar(t)
await t
.navigateTo('/accounts/3')
.expect(getNthPinnedStatus(0).getAttribute('aria-posinset')).eql('0')
.expect(getNthPinnedStatus(0).getAttribute('aria-setsize')).eql('2')
.expect(getNthPinnedStatus(0).innerText).contains('pinned toot 1')
.expect(getNthPinnedStatus(1).getAttribute('aria-setsize')).eql('2')
.expect(getNthPinnedStatus(1).innerText).contains('pinned toot 2')
})