1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-14 19:38:28 +01:00
Pinafore-Web-Client-Frontend/tests/spec/103-compose.js
2018-03-09 22:31:26 -08:00

39 lines
1.4 KiB
JavaScript

import { foobarRole } from '../roles'
import {
composeInput, getNthReplyButton, getNthStatus, getUrl, homeNavButton, notificationsNavButton,
postStatusButton
} from '../utils'
fixture`103-compose.js`
.page`http://localhost:4002`
test('statuses show up in home timeline', async t => {
await t.useRole(foobarRole)
.typeText(composeInput, 'hello world', {paste: true})
.click(postStatusButton)
.expect(getNthStatus(0).innerText).contains('hello world')
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.click(homeNavButton)
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthStatus(0).innerText).contains('hello world')
.navigateTo('/')
.expect(getNthStatus(0).innerText).contains('hello world')
})
test('statuses in threads show up in right order', async t => {
await t.useRole(foobarRole)
.navigateTo('/accounts/5')
.click(getNthStatus(2))
.expect(getUrl()).contains('/statuses')
.click(getNthReplyButton(3))
.expect(getUrl()).contains('/reply')
.typeText(composeInput, 'my reply!', {paste: true})
.click(postStatusButton)
.expect(getUrl()).match(/statuses\/[^/]+$/)
.expect(getNthStatus(5).innerText).contains('@baz my reply!')
.navigateTo('/accounts/5')
.click(getNthStatus(2))
.expect(getNthStatus(5).innerText).contains('@baz my reply!')
})