Hi,
in my project, i have 3 tests files. They are in the following folder: ./assets/tests
When i run this command only 2 files are executed: testcafe ./assets/tests --reporter spec,xunit:var/report/testcafe.xml
If i move the file login-js.js (which is executed in the previous step), then the 2 others are run.
Here is the content of this test file:
import { Selector, ClientFunction } from 'testcafe'
import { StandardVueJSAccUser, usernameStd, passwordStd } from './tools/authentification'
import { jsLoginFormPath, jsLoginSuccessPath } from './tools/uris'
import { host, csrfParameter } from '../js/lib/config'
const booksList = Selector('div.books')
const head = Selector('head')
const form = Selector('form.login')
const toast = Selector('div.q-notifications')
const getLocation = ClientFunction(() => document.location.href)
fixture.only `Test vuejs login`
.page `http://${host}${jsLoginFormPath}`
test('Login page: vuejs login', async t => {
await t
.navigateTo(jsLoginSuccessPath)
.expect(getLocation()).notContains('#/books')
.expect(form.find('input[name="username"]').count).eql(1, "Should find 1 input for username")
.expect(form.find('input[name="username"]').count).eql(1, "Should find 1 input for password")
.expect(head.find(`meta[name="${csrfParameter}"`).count).eql(1, "Should find 1 meta for csrf protection")
.typeText('input[name="username"]', 'fakeUser')
.typeText('input[name="password"]', 'fakeUser11111')
.click('button')
.expect(getLocation()).contains(jsLoginFormPath)
.expect(toast.find('div.q-alert.bg-warning').count).eql(1, "Missing warning toast message")
.useRole(StandardVueJSAccUser)
.expect(getLocation()).contains(jsLoginSuccessPath)
.expect(booksList.exists).ok()
})
Here is my repo (master branch) https://github.com/Rebolon/php-sf-flex-webpack-encore-vuejs
run npm run init-project to init the project
then npm run sf-dev to start the server
and finally ./node_modules/.bin/testcafe chrome ./assets/tests --reporter spec,xunit:var/report/testcafe.xml --skip-js-errors
(skip error is mandatory, i opened another issue about it: https://testcafe-discuss.devexpress.com/t/click-throw-out-object-domexception/590/5)
Thanks for help