2018-02-19 17:04:37 -08:00
|
|
|
import { Selector as $ } from 'testcafe'
|
2018-03-06 23:57:06 -08:00
|
|
|
import { getUrl, logInToInstanceLink, settingsButton } from '../utils'
|
2018-02-19 17:04:37 -08:00
|
|
|
|
2018-03-06 21:32:51 -08:00
|
|
|
fixture`001-basic-spec.js`
|
2018-02-19 18:25:59 -08:00
|
|
|
.page`http://localhost:4002`
|
2018-02-19 17:04:37 -08:00
|
|
|
|
|
|
|
test('has the correct <h1>', async t => {
|
|
|
|
await t
|
2018-11-17 18:06:49 -08:00
|
|
|
.expect($('.main-content h1').innerText).eql('Pinafore')
|
2018-02-19 17:04:37 -08:00
|
|
|
})
|
|
|
|
|
|
|
|
test('navigates to about', async t => {
|
|
|
|
await t
|
|
|
|
.click(settingsButton)
|
|
|
|
.expect(getUrl()).contains('/settings')
|
|
|
|
.click('a[href="/settings/about"]')
|
|
|
|
.expect(getUrl()).contains('/about')
|
2018-11-17 18:06:49 -08:00
|
|
|
.expect($('.main-content h1').innerText).eql('About Pinafore')
|
2018-02-19 17:04:37 -08:00
|
|
|
})
|
|
|
|
|
|
|
|
test('navigates to /settings/instances/add', async t => {
|
2018-03-06 23:57:06 -08:00
|
|
|
await t.click(logInToInstanceLink)
|
2018-02-19 17:04:37 -08:00
|
|
|
.expect(getUrl()).contains('/settings/instances/add')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('navigates to settings/instances', async t => {
|
|
|
|
await t.click(settingsButton)
|
|
|
|
.expect(getUrl()).contains('/settings')
|
|
|
|
.click($('a').withText('Instances'))
|
|
|
|
.expect(getUrl()).contains('/settings/instances')
|
2018-11-17 18:06:49 -08:00
|
|
|
.expect($('.main-content').innerText)
|
2018-04-18 20:43:13 -07:00
|
|
|
.contains("You're not logged in to any instances")
|
2018-02-19 18:25:59 -08:00
|
|
|
})
|