Skip to content

Commit

Permalink
chore: print the video path whether or not compression is on or fails
Browse files Browse the repository at this point in the history
chore: squash this

chore: squash this
  • Loading branch information
AtofStryker committed May 23, 2023
1 parent eef8cd2 commit 8622c01
Show file tree
Hide file tree
Showing 67 changed files with 1,264 additions and 14 deletions.
14 changes: 12 additions & 2 deletions packages/server/lib/modes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,14 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens
project.server.reset()
}

let videoCompressionFailed = false

if (videoExists && !skippedSpec && !videoCaptureFailed) {
const span = telemetry.startSpan({ name: 'video:compression' })
const chaptersConfig = videoCapture.generateFfmpegChaptersConfig(results.tests)

printResults.printVideoHeader()

try {
debug('compressing recording')

Expand All @@ -700,13 +704,19 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens
},
})
} catch (err) {
videoCaptureFailed = true
videoCompressionFailed = true
warnVideoCompressionFailed(err)
}
span?.end()
}

if (videoCaptureFailed) {
// only fail to print the video if capturing the video fails.
// otherwise, print the video path to the console if it exists regardless of whether compression fails or not
if (!videoCaptureFailed && videoExists) {
printResults.printVideoPath(videoName)
}

if (videoCaptureFailed || videoCompressionFailed) {
results.video = null
}

Expand Down
30 changes: 18 additions & 12 deletions packages/server/lib/util/print-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,6 @@ function displayScreenshots (screenshots: Screenshot[] = []) {
export function displayVideoCompressionProgress (opts: { videoName: string, videoCompression: number | false }) {
console.log('')

terminal.header('Video', {
color: ['cyan'],
})

console.log('')

const table = terminal.table({
colWidths: [3, 21, 76],
colAligns: ['left', 'left', 'left'],
Expand Down Expand Up @@ -534,12 +528,6 @@ export function displayVideoCompressionProgress (opts: { videoName: string, vide
])

console.log(table.toString())

console.log('')

console.log(` - Video output: ${formatPath(opts.videoName, undefined, 'cyan')}`)

console.log('')
}

if (Date.now() - progress > throttle) {
Expand All @@ -553,3 +541,21 @@ export function displayVideoCompressionProgress (opts: { videoName: string, vide
},
}
}

export const printVideoHeader = () => {
console.log('')

terminal.header('Video', {
color: ['cyan'],
})
}

export const printVideoPath = (videoName?: string) => {
if (videoName !== undefined) {
console.log('')

console.log(` - Video output: ${formatPath(videoName, undefined, 'cyan')}`)

console.log('')
}
}
5 changes: 5 additions & 0 deletions system-tests/__snapshots__/async_timeouts_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ exports['e2e async timeouts / failing1'] = `
cypress command (failed).png
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/async_timeouts.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down
10 changes: 10 additions & 0 deletions system-tests/__snapshots__/base_url_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ exports['e2e baseUrl / https / passes'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/base_url.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down Expand Up @@ -94,6 +99,11 @@ exports['e2e baseUrl / http / passes'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/base_url.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down
30 changes: 30 additions & 0 deletions system-tests/__snapshots__/browser_crash_handling_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ https://on.cypress.io/renderer-process-crashed
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/chrome_tab_crash.cy.js.mp4
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: simple.cy.js (2 of 2)
Expand All @@ -71,6 +76,11 @@ https://on.cypress.io/renderer-process-crashed
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/simple.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down Expand Up @@ -135,6 +145,11 @@ https://on.cypress.io/renderer-process-crashed
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/chrome_tab_crash.cy.js.mp4
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: simple.cy.js (2 of 2)
Expand All @@ -160,6 +175,11 @@ https://on.cypress.io/renderer-process-crashed
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/simple.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down Expand Up @@ -223,6 +243,11 @@ This can happen for many different reasons:
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/chrome_process_crash.cy.js.mp4
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: simple.cy.js (2 of 2)
Expand All @@ -248,6 +273,11 @@ This can happen for many different reasons:
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/simple.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down
5 changes: 5 additions & 0 deletions system-tests/__snapshots__/busted_support_file_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ Fix the error in your code and re-run your tests.
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/app.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down
5 changes: 5 additions & 0 deletions system-tests/__snapshots__/cache_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ exports['e2e cache passes 1'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/cache.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down
20 changes: 20 additions & 0 deletions system-tests/__snapshots__/caught_uncaught_hook_errors_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ Because this error occurred during a \`before all\` hook we are skipping the rem
before all hook (failed).png
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/hook_caught_error_failing.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down Expand Up @@ -173,6 +178,11 @@ Because this error occurred during a \`before each\` hook we are skipping the re
before each hook (failed).png
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/hook_uncaught_error_failing.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down Expand Up @@ -249,6 +259,11 @@ Because this error occurred during a \`before each\` hook we are skipping all of
efore each hook (failed).png
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/hook_uncaught_root_error_failing.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down Expand Up @@ -335,6 +350,11 @@ Because this error occurred during a \`before each\` hook we are skipping the re
before each hook (failed).png
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/hook_uncaught_error_events_failing.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down
15 changes: 15 additions & 0 deletions system-tests/__snapshots__/commands_outside_of_test_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ exports['e2e commands outside of test / passes on passing assertions'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/assertions_passing_outside_of_test.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down Expand Up @@ -110,6 +115,11 @@ We dynamically generated a new test to display this failure.
aught error was detected outside of a test (failed).png
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/assertions_failing_outside_of_test.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down Expand Up @@ -193,6 +203,11 @@ https://on.cypress.io/cannot-execute-commands-outside-test
r was detected outside of a test (failed).png
(Video)
- Video output: /XXX/XXX/XXX/cypress/videos/commands_outside_of_test.cy.js.mp4
====================================================================================================
(Run Finished)
Expand Down
Loading

0 comments on commit 8622c01

Please sign in to comment.