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

fix: several issues of stepByStep report #4331

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/plugin/stepByStepReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ module.exports = function (config) {
});

event.dispatcher.on(event.test.failed, (test, err) => {
// BeforeSuite/AfterSuite don't have any access to the browser, hence it could not take screenshot.
if (test.ctx._runnable.title.includes('hook: BeforeSuite')) return;
persist(test, err);
});

event.dispatcher.on(event.all.result, () => {
if (!Object.keys(slides).length) return;
if (Object.keys(recordedTests).length === 0 || !Object.keys(slides).length) return;

let links = '';

Expand Down Expand Up @@ -148,7 +150,7 @@ module.exports = function (config) {
stepNum++;
slides[fileName] = step;
try {
await helper.saveScreenshot(path.relative(reportDir, path.join(dir, fileName)), config.fullPageScreenshots);
await helper.saveScreenshot(path.join(dir, fileName), config.fullPageScreenshots);
} catch (err) {
output.plugin(`Can't save step screenshot: ${err}`);
error = err;
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ module.exports.screenshotOutputFolder = function (fileName) {
const fileSep = path.sep;

if (!fileName.includes(fileSep) || fileName.includes('record_')) {
return path.join(global.output_dir, fileName);
return path.resolve(global.output_dir, fileName);
}
return path.resolve(global.codecept_dir, fileName);
};
Expand Down
Loading