Reputation: 111
I can't figure out why (or if it's not allowed) testcafe won't run my runner class file. Current setup
{
...
"test:integration": "testcafe ./bin/integration.js",
...
"devDependencies": {
...
"testcafe": "^1.5.0",
"testcafe-react-selectors": "^3.2.0",
...
}
const createTestCafe = require('testcafe')
let runner = null
let testcafe = null
createTestCafe('localhost', 1337, 1338)
.then(tc => {
testcafe = tc
runner = testcafe.createRunner()
return testcafe.createBrowserConnection()
})
.then(remoteConnection => {
// Outputs remoteConnection.url so that it can be visited from the remote browser.
console.log('remote url:', remoteConnection.url)
remoteConnection.once('ready', () => {
runner
.src('../integration-tests/*test.js*')
.browsers(['chrome'])
.run({
selectorTimeout: 50000,
assertionTimeout: 7000,
pageLoadTimeout: 8000
})
.then(failed => {
console.log('failed tests:', failed)
testcafe.close()
})
.catch(error => {
console.log(error)
})
})
})
Error received:
ERROR Unable to find the browser. "./bin/integration.js" is not a browser alias or path to an executable file.
What am I doing wrong?
Thanks in advance
Upvotes: 2
Views: 424
Reputation: 6318
As far as I understand, you want to use the testcafe API to run your tests. In this case, you do not need to start tests using the testcafe
command.
The testcafe
command usually expects at least two arguments: browsers
and sources
. When you use the testcafe ./bin/integration.js
command, the CLI arguments parser processes the argument as a browser alias, so you see the error.
I suppose that you need to run your script with the following command: node ./bin/integration.js
Upvotes: 2