FitTrackee/mpwo_client/e2e/activities.test.js

44 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-05-08 21:35:37 +02:00
import { Selector } from 'testcafe'
import { TEST_URL } from './utils'
const randomstring = require('randomstring')
const username = randomstring.generate(8)
const email = `${username}@test.com`
const password = 'lentghOk'
// eslint-disable-next-line no-undef
fixture('/activities').page(`${TEST_URL}/activities`)
2018-05-08 22:15:32 +02:00
test('standard user should be able to add a workout (w/o gpx)', async t => {
2018-05-08 21:35:37 +02:00
await t
.navigateTo(`${TEST_URL}/register`)
.typeText('input[name="username"]', username)
.typeText('input[name="email"]', email)
.typeText('input[name="password"]', password)
.typeText('input[name="passwordConf"]', password)
.click(Selector('input[type="submit"]'))
await t
.navigateTo(`${TEST_URL}/activities/add`)
.expect(Selector('H1').withText('Dashboard').exists).notOk()
2018-05-20 20:30:30 +02:00
.expect(Selector('H2').withText('Add a workout').exists).ok()
2018-05-08 21:35:37 +02:00
.click(Selector('input[name="withoutGpx"]'))
.click(Selector('select').filter('[name="sport_id"]'))
.click(Selector('option').filter('[value="1"]'))
.typeText('input[name="activity_date"]', '2018-12-20')
.typeText('input[name="activity_time"]', '14:05')
.typeText('input[name="duration"]', '01:00:00')
.typeText('input[name="distance"]', '10')
.click(Selector('input[type="submit"]'))
2018-05-08 22:15:32 +02:00
// pb w/ chromium to check
// await t
// .expect(Selector('H1').withText('Dashboard').exists).notOk()
// .expect(Selector('H1').withText('Activity').exists).ok()
2018-05-08 21:44:14 +02:00
2018-05-08 21:35:37 +02:00
})