Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
0c0e84ce
Unverified
Commit
0c0e84ce
authored
1 year ago
by
Nemanja Glumac
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Use Cypress event listener for `beforeunload` globally (#38264)
https://github.com/cypress-io/cypress/issues/2118
parent
1011ecdb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
e2e/support/cypress.js
+21
-0
21 additions, 0 deletions
e2e/support/cypress.js
e2e/test/scenarios/visualizations-tabular/pivot_tables.cy.spec.js
+0
-21
0 additions, 21 deletions
.../scenarios/visualizations-tabular/pivot_tables.cy.spec.js
with
21 additions
and
21 deletions
e2e/support/cypress.js
+
21
−
0
View file @
0c0e84ce
...
...
@@ -54,3 +54,24 @@ Cypress.on("test:after:run", (test, runnable) => {
);
}
});
/**
* Our app registers beforeunload event listener e.g. when editing a native SQL question.
* Cypress does not automatically close the browser prompt and does not allow manually
* interacting with it (unlike with window.confirm). The test will hang forever with
* the prompt displayed and will eventually time out. We need to work around this by
* monkey-patching window.addEventListener to ignore beforeunload event handlers.
*
* @see https://github.com/cypress-io/cypress/issues/2118
*/
Cypress
.
on
(
"
window:load
"
,
window
=>
{
const
addEventListener
=
window
.
addEventListener
;
window
.
addEventListener
=
function
(
event
)
{
if
(
event
===
"
beforeunload
"
)
{
return
;
}
return
addEventListener
.
apply
(
this
,
arguments
);
};
});
This diff is collapsed.
Click to expand it.
e2e/test/scenarios/visualizations-tabular/pivot_tables.cy.spec.js
+
0
−
21
View file @
0c0e84ce
...
...
@@ -36,27 +36,6 @@ const TEST_CASES = [
{
case
:
"
dashboard
"
,
subject
:
DASHBOARD_NAME
,
confirmSave
:
false
},
];
/**
* Our app registers beforeunload event listener e.g. when editing a native SQL question.
* Cypress does not automatically close the browser prompt and does not allow manually
* interacting with it (unlike with window.confirm). The test will hang forever with
* the prompt displayed and will eventually time out. We need to work around this by
* monkey-patching window.addEventListener to ignore beforeunload event handlers.
*
* @see https://github.com/cypress-io/cypress/issues/2118
*/
Cypress
.
on
(
"
window:load
"
,
window
=>
{
const
addEventListener
=
window
.
addEventListener
;
window
.
addEventListener
=
function
(
event
)
{
if
(
event
===
"
beforeunload
"
)
{
return
;
}
return
addEventListener
.
apply
(
this
,
arguments
);
};
});
describe
(
"
scenarios > visualizations > pivot tables
"
,
{
tags
:
"
@slow
"
},
()
=>
{
beforeEach
(()
=>
{
restore
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment