pinafore/tests/spec/001-basic-spec.js

34 wiersze
1.0 KiB
JavaScript
Czysty Zwykły widok Historia

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