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