Skip to content
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
16 changes: 8 additions & 8 deletions lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -2287,14 +2287,6 @@ class Playwright extends Helper {
const fullPageOption = fullPage || this.options.fullPageScreenshots
let outputFile = screenshotOutputFolder(fileName)

this.debugSection('Screenshot', relativeDir(outputFile))

await this.page.screenshot({
path: outputFile,
fullPage: fullPageOption,
type: 'png',
})

if (this.activeSessionName) {
for (const sessionName in this.sessionPages) {
const activeSessionPage = this.sessionPages[sessionName]
Expand All @@ -2311,6 +2303,14 @@ class Playwright extends Helper {
}
}
}

this.debugSection('Screenshot', relativeDir(outputFile))

await this.page.screenshot({
path: outputFile,
fullPage: fullPageOption,
type: 'png',
})
}

/**
Expand Down
16 changes: 8 additions & 8 deletions lib/helper/Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1954,14 +1954,6 @@ class Puppeteer extends Helper {
const fullPageOption = fullPage || this.options.fullPageScreenshots
let outputFile = screenshotOutputFolder(fileName)

this.debug(`Screenshot is saving to ${outputFile}`)

await this.page.screenshot({
path: outputFile,
fullPage: fullPageOption,
type: 'png',
})

if (this.activeSessionName) {
for (const sessionName in this.sessionPages) {
const activeSessionPage = this.sessionPages[sessionName]
Expand All @@ -1978,6 +1970,14 @@ class Puppeteer extends Helper {
}
}
}

this.debug(`Screenshot is saving to ${outputFile}`)

await this.page.screenshot({
path: outputFile,
fullPage: fullPageOption,
type: 'png',
})
}

async _failed(test) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
"figures": "3.2.0",
"fn-args": "4.0.0",
"fs-extra": "11.2.0",
"glob": "^11.0.0",
"fuse.js": "^7.0.0",
"glob": "^11.0.0",
"html-minifier-terser": "7.2.0",
"inquirer": "6.5.2",
"invisi-data": "^1.0.0",
Expand Down
5 changes: 2 additions & 3 deletions test/acceptance/session_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Scenario('should save screenshot for sessions @Puppeteer @Playwright', async fun
await I.amOnPage('/form/bug1467')
await I.saveScreenshot('original.png')
await I.amOnPage('/')
await I.saveScreenshot('main_session.png')
session('john', async () => {
await I.amOnPage('/form/bug1467')
event.dispatcher.emit(event.test.failed, this)
Expand All @@ -94,8 +93,8 @@ Scenario('should save screenshot for sessions @Puppeteer @Playwright', async fun
await I.expectEqual(original, failed)

// Assert that screenshots of sessions are created
const [main_original, session_failed] = await I.getSHA256Digests([`${output_dir}/main_session.png`, `${output_dir}/john_${fileName}.failed.png`])
await I.expectNotEqual(main_original, session_failed)
const [main_original] = await I.getSHA256Digests([`${output_dir}/${fileName}.failed.png`])
await I.expectNotEqual(main_original, failed)
})

Scenario('should throw exception and close correctly @Puppeteer @Playwright', ({ I }) => {
Expand Down
Loading