Skip to content
Merged
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
13 changes: 6 additions & 7 deletions lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -2396,9 +2396,9 @@ class Playwright extends Helper {
}

if (this.options.recordVideo && this.page && this.page.video()) {
test.artifacts.video = await saveVideoForPage(this.page, `${test.title}.failed`)
test.artifacts.video = saveVideoForPage(this.page, `${test.title}.failed`)
for (const sessionName in this.sessionPages) {
test.artifacts[`video_${sessionName}`] = await saveVideoForPage(
test.artifacts[`video_${sessionName}`] = saveVideoForPage(
this.sessionPages[sessionName],
`${test.title}_${sessionName}.failed`,
)
Expand All @@ -2424,9 +2424,9 @@ class Playwright extends Helper {
async _passed(test) {
if (this.options.recordVideo && this.page && this.page.video()) {
if (this.options.keepVideoForPassedTests) {
test.artifacts.video = await saveVideoForPage(this.page, `${test.title}.passed`)
test.artifacts.video = saveVideoForPage(this.page, `${test.title}.passed`)
for (const sessionName of Object.keys(this.sessionPages)) {
test.artifacts[`video_${sessionName}`] = await saveVideoForPage(
test.artifacts[`video_${sessionName}`] = saveVideoForPage(
this.sessionPages[sessionName],
`${test.title}_${sessionName}.passed`,
)
Expand Down Expand Up @@ -3917,7 +3917,7 @@ async function refreshContextSession() {
}
}

async function saveVideoForPage(page, name) {
function saveVideoForPage(page, name) {
if (!page.video()) return null
const fileName = `${`${global.output_dir}${pathSeparator}videos${pathSeparator}${uuidv4()}_${clearString(name)}`.slice(0, 245)}.webm`
page
Expand All @@ -3928,11 +3928,10 @@ async function saveVideoForPage(page, name) {
page
.video()
.delete()
.catch((e) => {})
.catch(() => {})
})
return fileName
}

async function saveTraceForContext(context, name) {
if (!context) return
if (!context.tracing) return
Expand Down
Loading