testcafe
testcafe copied to clipboard
video recording enabled in testcafe runner api does not terminate the node process after test execution when fixture is skipped
What is your Test Scenario?
We have a testcafe setup where we use testcafe runner apis and enabled video recording.
What is the Current behavior?
- Whenever we execute test fixtures in which one of the fixture is skipped with
fixture.skipthe node process seems to be still running after executing all tests. - This does not have any impact on test execution whatsoever, all tests get executed as expected and generate a report/videos as specified in runner config.
- The only issue is parent process of testcafe is not being terminated after testcafe is closed which causes our CI system to run till timeout and terminate the job as failure.
- This issue is only observed when we have combination of video recording is enabled with testcafe runner api + anyone (or all) of the fixture is skipped
- We have other projects of testcafe( with similar configs) where command line version of testcafe is used instead of api and everythings seems fine there.
What is the Expected behavior?
after testcafe is closed the calling node process should terminate and show the shell again.
What is your web application and your TestCafe test code?
can be tested with any website
Your complete test code (or attach your test files):
runner.ts:
const createTestCafe = require('testcafe');
let runner, testcafe;
createTestCafe( 'localhost', '', '')
.then(testcafeInstance => {
runner = testcafeInstance.createRunner();
testcafe = testcafeInstance;
})
.then(() => {
return runner
.src('fixture.ts')
.browsers('chrome')
.video('reports')
.run();
}).then(() => {
testcafe.close();
});
In fixture.ts:
import t from 'testcafe';
fixture.skip `MyFixture`
.page `http://devexpress.github.io/testcafe/example`;
test('Test1', async t => {
// Starts at http://devexpress.github.io/testcafe/example
});
Your complete configuration file (if any):
package.json
{
"name": "tcp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "node runnner.ts"
},
"author": "",
"license": "ISC",
"dependencies": {
"@ffmpeg-installer/ffmpeg": "^1.0.20",
"testcafe": "^1.14.0"
}
}
Steps to Reproduce:
- Place above code in appropriate files
- execute runner.ts with command node runner.ts
- Observe that the shell does not return after executing tests, it just stays hung.
- Comment the video recording part in runner.ts and observe that after test execution the command terminates and flashes the new shell as expected.
Your Environment details:
- testcafe version: 1.14.0
- node.js version: 10.13.0
- command-line arguments: node runner.ts
- browser name and version: chrome
- platform and version: mac & linux
Thank you for the example. I have reproduced the behavior you described. We will investigate it.
Please also note that the testcafe.close() method is asynchronous, so you need to ensure that you return a promise (or add await when you use async/await syntax):
.then(() => {
return testcafe.close();
});