Skip to content

Commit

Permalink
fix: log video path if exists, regardless of compression (#26813)
Browse files Browse the repository at this point in the history
* chore: print the video path whether or not compression is on or fails

* chore: fix video replacement regex

* chore: add bugfix entry
  • Loading branch information
AtofStryker authored Jun 8, 2023
1 parent 8d2027a commit 0be33b9
Show file tree
Hide file tree
Showing 68 changed files with 1,272 additions and 14 deletions.
8 changes: 8 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 12.14.1

_Released 06/20/2023 (PENDING)_

**Bugfixes:**

- Fixed an issue where video output was not being logged to the console when `videoCompression` was turned off. Videos will now log to the terminal regardless of the compression value. Addresses [#25945](https://github.com/cypress-io/cypress/issues/25945).

## 12.14.0

_Released 06/07/2023_
Expand Down
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

5 comments on commit 0be33b9

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0be33b9 Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.14.1/linux-arm64/develop-0be33b952817eff2bf9095db66a6176304f4b606/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0be33b9 Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.14.1/linux-x64/develop-0be33b952817eff2bf9095db66a6176304f4b606/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0be33b9 Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.14.1/darwin-x64/develop-0be33b952817eff2bf9095db66a6176304f4b606/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0be33b9 Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.14.1/win32-x64/develop-0be33b952817eff2bf9095db66a6176304f4b606/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0be33b9 Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.14.1/darwin-arm64/develop-0be33b952817eff2bf9095db66a6176304f4b606/cypress.tgz

Please sign in to comment.