This repo reproduces an issue with TestCafé reporter
MIT License
This issue is not specific to this reporter, but to any TestCafé reporter.
npm install
.export BROWSERSTACK_USERNAME="foo"
export BROWSERSTACK_ACCESS_KEY="bar"
npm test
npm run report
This will generate a nice and searchable HTML report (more details here):
Some screenshots are asked during test execution:
screenshot 1 | screenshot 2 | screenshot 3
At the end of test execution, there are three screenshots inside the screenshots folder, but none of these screenshots has been passed to the reporter; instead the reporter receives only some warnings:
"Was unable to take a screenshot due to an error.\n\nError: Unable to locate the page area in the browser window screenshot at /Users/HDO/VSCodeProjects/reporter-issue/screenshots/2020-07-17_19-04-59/test-1/Chrome_83.0.4103.106_Android_9/1.png, because the page area mark with ID 2292367756 is not found in the screenshot.\n at calculateClipInfo (/Users/HDO/VSCodeProjects/reporter-issue/node_modules/testcafe/src/screenshots/crop.js:114:19)\n at Object.cropScreenshot (/Users/HDO/VSCodeProjects/reporter-issue/node_modules/testcafe/src/screenshots/crop.js:131:18)\n at /Users/HDO/VSCodeProjects/reporter-issue/node_modules/testcafe/src/screenshots/capturer.js:137:40\n at processTicksAndRejections (internal/process/task_queues.js:93:5)",
"Was unable to take a screenshot due to an error.\n\nErrUnable to locate the page area in the browser winscreenshot at /Users/HDO/VSCodeProjects/reporter-isscreenshots/2020-07-17_19-04-59/test-1/Chrome_83.0.4106_Android_9/2.png, because the page area mark with4066688373 is not found in the screenshot.\n calculateClipInfo (/Users/HDO/VSCodeProjects/reporter-isnode_modules/testcafe/src/screenshots/crop.js:114:19)\nat Object.cropScreenshot (/Users/HDO/VSCodeProjereporter-issue/node_modules/testcafe/src/screenshots/cjs:131:18)\n at /Users/HDO/VSCodeProjects/reporter-isnode_modules/testcafe/src/screenshots/captujs:137:40\n at processTicksAndRejections (interprocess/task_queues.js:93:5)",
"Was unable to take a screenshot due to an error.\n\nErrUnable to locate the page area in the browser winscreenshot at /Users/HDO/VSCodeProjects/reporter-isscreenshots/2020-07-17_19-04-59/test-1/Chrome_83.0.4106_Android_9/3.png, because the page area mark with4249869253 is not found in the screenshot.\n calculateClipInfo (/Users/HDO/VSCodeProjects/reporter-isnode_modules/testcafe/src/screenshots/crop.js:114:19)\nat Object.cropScreenshot (/Users/HDO/VSCodeProjereporter-issue/node_modules/testcafe/src/screenshots/cjs:131:18)\n at /Users/HDO/VSCodeProjects/reporter-isnode_modules/testcafe/src/screenshots/captujs:137:40\n at processTicksAndRejections (interprocess/task_queues.js:93:5)"
Here is an excerpt of the testRunInfo object passed to the reporter on reportTestDone
hook:
{
errs: [],
warnings: [
'Was unable to take a screenshot due to an error.\n' +
'\n' +
'Error: Unable to locate the page area in the browser window screenshot at /Users/HDO/VSCodeProjects/testcafe-starter/screenshots/2020-07-17_18-34-09/test-2/Chrome_83.0.4103.106_Android_9/1.png, because the page area mark with ID 1341325899 is not found in the screenshot.\n' +
' at calculateClipInfo (/Users/HDO/VSCodeProjects/testcafe-starter/node_modules/testcafe/src/screenshots/crop.js:114:19)\n' +
' at Object.cropScreenshot (/Users/HDO/VSCodeProjects/testcafe-starter/node_modules/testcafe/src/screenshots/crop.js:131:18)\n' +
' at /Users/HDO/VSCodeProjects/testcafe-starter/node_modules/testcafe/src/screenshots/capturer.js:137:40\n' +
' at processTicksAndRejections (internal/process/task_queues.js:93:5)',
'Was unable to take a screenshot due to an error.\n' +
'\n' +
'Error: Unable to locate the page area in the browser window screenshot at /Users/HDO/VSCodeProjects/testcafe-starter/screenshots/2020-07-17_18-34-09/test-2/Chrome_83.0.4103.106_Android_9/2.png, because the page area mark with ID 3129705498 is not found in the screenshot.\n' +
' at calculateClipInfo (/Users/HDO/VSCodeProjects/testcafe-starter/node_modules/testcafe/src/screenshots/crop.js:114:19)\n' +
' at Object.cropScreenshot (/Users/HDO/VSCodeProjects/testcafe-starter/node_modules/testcafe/src/screenshots/crop.js:131:18)\n' +
' at /Users/HDO/VSCodeProjects/testcafe-starter/node_modules/testcafe/src/screenshots/capturer.js:137:40\n' +
' at runMicrotasks (<anonymous>)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:93:5)'
],
durationMs: 18870,
unstable: undefined,
screenshotPath: null,
screenshots: [],
videos: [],
quarantine: null,
skipped: false,
browsers: [
{
testRunId: 'gSunaoSAb',
name: 'Chrome',
version: '83.0.4103.106',
platform: 'mobile',
os: [Object],
engine: [Object],
prettyUserAgent: 'Chrome 83.0.4103.106 / Android 9',
userAgent: 'Mozilla/5.0 (Linux; Android 9; Redmi Note 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36',
alias: 'browserstack:Xiaomi Redmi Note 8',
headless: false
}
],
testId: 'WDhEFsT'
}
Screenshots should be passed to the reporter even when there are problems while post-processsing them.