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

chore(appium): dont take screenshot on windows multiremote #502

Closed
wants to merge 5 commits into from
Closed
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
29 changes: 3 additions & 26 deletions config/wdio.windows.multiremote.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,8 @@ export const config: WebdriverIO.Config = {
},

afterTest: async function (test, describe, { error }) {
let imageFile, base64VideoUserA, assetsFolder;
if(driver) {
// Take screenshot from driver if test fails and save it for Allure Reporter
imageFile = await driver.takeScreenshot();

let base64VideoUserA, assetsFolder;
if(driver) {
// Stop video recording for both instances and save video into base64 format
base64VideoUserA = await driver[USER_A_INSTANCE].executeScript("windows: stopRecordingScreen", [
{
Expand All @@ -186,7 +183,7 @@ export const config: WebdriverIO.Config = {
await fsp.mkdir(assetsFolder, {recursive: true});
}

// Only if error has been detected, add the video and image File to attached report
// Only if error has been detected, add the video to attached report
if (error && base64VideoUserA) {
// Assign video title for video on failed test
const videoTitleUserA = test.title + " - User A - Failed.mp4"
Expand All @@ -207,26 +204,6 @@ export const config: WebdriverIO.Config = {
);
}
}

if (error && imageFile) {
// Assign image title for screnshot on failed test
const imageTitle = test.title + " - Failed.png";
try {
// Write Image File if test fails and add it to failed screenshots folder
await fsp.writeFile(
assetsFolder + "/" + imageTitle,
imageFile,
"base64"
);
// Add to Screenshot to Allure Reporter
const data = await readFileSync(`${assetsFolder}/${imageTitle}`);
allureReporter.addAttachment(imageTitle, data, 'image/png');
} catch (error) {
console.error(
`Got an error trying to save images from Failed Tests: ${error.message}`
);
}
}
}
}
}
Loading
Loading