-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Programmatically set reporter-json-folder etc as part of runner object #39
Comments
Hi @rhowk , actually you cannot setup correctly the reporter-json-folder, the reporter-app-name via runner.reporter. process.env['--reporter-json-folder'] = join('reports', 'batch${jobnumber}');
process.env['--reporter-app-name'] = 'foo';
process.env['--reporter-app-version']= 'bar;
// then create and start the runner Do you think it could be a solution for you? Thanks |
That would be fantastic! Love to be your guinea pig on this. |
so I added : to runner .js and when I console log the process.env I see: |
Hi @rhowk, you still need to wait until I push a new release. [6.3.0] - 2021-07-21Added
|
Hi @rhowk , I have pushed the Thanks |
@hdorgeval we will test it out and get right back to you! Thanks so much! |
@hdorgeval Worked like a charm. Thanks so much! |
Hi @mattylips77, thanks for your feedback. It's always appreciated :) |
Via command line the json reporter folder is set by:
--reporter-json-folder='my-custom-folder'
We are trying to run the gherkin-testcafe programmatically and our setup looks like this:
const createTestCafe = require('gherkin-testcafe');
...
let failedCount;
try {
testcafe = await createTestCafe({ host, developerMode: true });
const { server1Info, server2Info } = testcafe.proxy;
logger.log('Ports used: ${server1Info.port}, ${server2Info.port}');
runner = await testcafe.createRunner({ src: './${brand}/' });
failedCount = await runner
.src(['tests/${brand}'])
.concurrency(1)
.browsers(getBrowser(platform, env))
.tags([tags])
.reporter('cucumber-json', join('reports', 'batch${jobnumber}', 'json', 'batch${jobnumber}.json'))
.screenshots({
path: './screenshots/${brand}',
takeOnFails: true,
})
.video('screenshots/video/${brand}', {
singleFile: true,
failedOnly: true,
pathPattern: '${jobnumber}_${brand}_${region}_${platform}.mp4'
})
.run(
{ debugMode, debugOnFail: debugMode }
);
} catch (error) {
logger.log('Test runner error', { error });
process.exit(1)
}
finally {
await testcafe.close();
logger.log('Test runner finished\');
if (failedCount > 0) {
process.exit(1)
}
process.exit(0)
}
jobnumber: is the # of the current run, may include mult versions of the next vars
brand: is one of our brands
region: our brands live in multiple countries
platform: mobile or pc
so we can have www.brand1.com or m.brand1.co.uk
depending on what we want to test.
We need to put the json in a custom folder, hence:
.reporter(
cucumber-json
, join('reports',batch${jobnumber}
, 'json',batch${jobnumber}.json
))but the command line specifies a directory not a file. What we end up with because our
testcafe-reporter-cucumber-json.json has the arg:
"reportFolder": "reports"
Is all the json gets written to the reports directory and then when I have to generate a report, I delete the reports/batch1234/json/batch1234.json file, because its empty, copy all the latest jsons from the report root to the batch1234/json directory and then compile the report.
The bad thing happening is that we are only getting one "good" json on the report root, the batch1234.json is blank. So how do i correctly set the reporter-json-folder, the reporter-app-name, etc via runner.reporter?
The text was updated successfully, but these errors were encountered: