-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: screenshot() times out when the main Cypress tab is not focused (#…
…29038) * activate main cypress tab before taking a screenshot * new tests to cover page activation behavior * updates changelog * whitespace * fix check-ts * reduce extension failure timeout to 500ms to account for origin bridge timeout * only use tab activation workaround in chrome; default to Page.bringToFront in headless mode * update unit tests * swap order of tests in 5016 system test * some debugging to try and hunt down firefox issue * rm debug prev added - looks like sys test passed that time? * rm debug emit from v2 extension
- Loading branch information
1 parent
245fd97
commit e785318
Showing
11 changed files
with
252 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,7 +337,6 @@ const automation = { | |
}) | ||
.then(fn) | ||
}, | ||
|
||
} | ||
|
||
module.exports = automation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
exports['e2e issue 5016 - screenshot times out after clicking target _blank / fails but does not timeout taking screenshot'] = ` | ||
==================================================================================================== | ||
(Run Starting) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (issue-5016.cy.js) │ | ||
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
Running: issue-5016.cy.js (1 of 1) | ||
issue 5016 | ||
✓ should take a normal screenshot | ||
1) should fail but not timeout while taking the screenshot | ||
✓ should not timeout taking screenshot when not failing | ||
2 passing | ||
1 failing | ||
1) issue 5016 | ||
should fail but not timeout while taking the screenshot: | ||
AssertionError: Timed out retrying after 4050ms: expected '<a>' to have attribute 'foo' | ||
[stack trace lines] | ||
(Results) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Tests: 3 │ | ||
│ Passing: 2 │ | ||
│ Failing: 1 │ | ||
│ Pending: 0 │ | ||
│ Skipped: 0 │ | ||
│ Screenshots: 3 │ | ||
│ Video: false │ | ||
│ Duration: X seconds │ | ||
│ Spec Ran: issue-5016.cy.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
(Screenshots) | ||
- /XXX/XXX/XXX/cypress/screenshots/issue-5016.cy.js/issue 5016 -- should take a no (YxX) | ||
rmal screenshot.png | ||
- /XXX/XXX/XXX/cypress/screenshots/issue-5016.cy.js/issue 5016 -- should fail but (YxX) | ||
not timeout while taking the screenshot (failed).png | ||
- /XXX/XXX/XXX/cypress/screenshots/issue-5016.cy.js/issue 5016 -- should not timeo (YxX) | ||
ut taking screenshot when not failing.png | ||
==================================================================================================== | ||
(Run Finished) | ||
Spec Tests Passing Failing Pending Skipped | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ✖ issue-5016.cy.js XX:XX 3 2 1 - - │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
✖ 1 of 1 failed (100%) XX:XX 3 2 1 - - | ||
` |
6 changes: 6 additions & 0 deletions
6
system-tests/projects/config-screenshot-on-failure-enabled/cypress.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
screenshotOnRunFailure: true, | ||
e2e: { | ||
supportFile: false, | ||
}, | ||
} |
18 changes: 18 additions & 0 deletions
18
system-tests/projects/config-screenshot-on-failure-enabled/cypress/e2e/issue-5016.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// https://github.com/cypress-io/cypress/issues/5016 | ||
describe('issue 5016', { | ||
screenshotOnRunFailure: true, | ||
}, function () { | ||
it('should take a normal screenshot', function () { | ||
cy.visit('/cypress/fixtures/issue-5016/index.html').screenshot() | ||
}) | ||
|
||
it('should fail but not timeout while taking the screenshot', function () { | ||
cy.visit('/cypress/fixtures/issue-5016/index.html') | ||
cy.get('a').click().should('have.attr', 'foo') | ||
}) | ||
|
||
it('should not timeout taking screenshot when not failing', function () { | ||
cy.visit('/cypress/fixtures/issue-5016/index.html') | ||
cy.get('a').click().screenshot() | ||
}) | ||
}) |
5 changes: 5 additions & 0 deletions
5
...ests/projects/config-screenshot-on-failure-enabled/cypress/fixtures/issue-5016/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!doctype html> | ||
|
||
<body> | ||
<a target="_blank" href="./new.html">New Tab</a> | ||
</body> |
3 changes: 3 additions & 0 deletions
3
...-tests/projects/config-screenshot-on-failure-enabled/cypress/fixtures/issue-5016/new.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!doctype html> | ||
|
||
<html></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const systemTests = require('../lib/system-tests').default | ||
|
||
describe('e2e issue 5016 - screenshot times out after clicking target _blank', function () { | ||
systemTests.setup() | ||
|
||
systemTests.it('fails but does not timeout taking screenshot', { | ||
project: 'config-screenshot-on-failure-enabled', | ||
sanitizeScreenshotDimensions: true, | ||
snapshot: true, | ||
expectedExitCode: 1, | ||
browser: '!webkit', | ||
}) | ||
}) |
e785318
There was a problem hiding this comment.
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:
e785318
There was a problem hiding this comment.
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:
e785318
There was a problem hiding this comment.
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: