Skip to content
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

screenshots are not adopted for async mode #45

Open
Gordiievskyi opened this issue Aug 28, 2020 · 0 comments
Open

screenshots are not adopted for async mode #45

Gordiievskyi opened this issue Aug 28, 2020 · 0 comments

Comments

@Gordiievskyi
Copy link

Hi guys,

thanks for you job and I have an issue with gathering screenshots in async mode. Them are made usually in next test. I already rised it as a question in your enhancement thread.

I use wdio 6 + mocha + async mode. So at the moment I has to write my own screenshots util and put it in after test.

afterTest: async function (test, context, { error, result, duration, passed, retries }) {
const file_name = ${error}_${Date.now()}.png;
await browser.saveScreenshot(${__dirname}/../reports/${file_name});
TimelineReporter.addContext({
title: ${name},
value: <a href="${file_name}">Page Screen</a>
});
}
I think fix is something like:

node_modules/wdio-timeline-reporter/lib/timeline-service.ts
async beforeCommand(commandName) {
const { screenshotStrategy } = this.reporterOptions;
if (screenshotStrategy === BEFORE_CLICK && 'click' === commandName) {
await browser.takeScreenshot();
}
}
async afterTest(test) {
const { screenshotStrategy } = this.reporterOptions;
if (screenshotStrategy === BEFORE_CLICK) {
await browser.takeScreenshot();
}
if (screenshotStrategy === ON_ERROR && !test.passed) {
await browser.takeScreenshot();
}
}
This way it takes it should take it at the right moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant