-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
window:confirm event ignored by command line (but not UI) #1432
Comments
Update: if I run with |
I also seem to be having this issue, but for a different event. The below works fine with chrome, but not with Electron in headed or headless mode: //tslint:disable
Cypress.on("window:before:load", win => {
console.log("called window before load")
const script = win.document.createElement("script")
const scripts = win.document.getElementsByTagName("script")[0] as HTMLScriptElement
script.type = "text/javascript"
script.src = `http://localhost:3030/testfile.min.js`
if (scripts && scripts.parentNode) {
scripts.parentNode.insertBefore(script, scripts)
}
}) |
duplicate of #2118 |
i want to see the alert message but i am getting this message in cypress log"There are unsaved changes to this booking. Are you sure you want to do this?" and it auto accept alert |
Is this a Feature or Bug? Bug
Current behavior:
When a page fires a confirm command, the UI runner correctly handles this (as noted in https://docs.cypress.io/api/events/catalog-of-events.html#App-Events) but when running
cypress run
from the command line it just times out waiting for the load event.Desired behavior:
As noted in https://docs.cypress.io/api/events/catalog-of-events.html#App-Events, when a window:confirm event is fired, the default action should be auto accept. This should work the same when run from the UI and from the command line. At minimum the
cy.on('window:confirm')
command should be used.How to reproduce:
cypress open
and it will passcypress run --spec path/to/test.spec.js
and it will failTest code:
Cypress file
test.html
Additional Info (images, stack traces, etc)
EDIT - See example: cypress-io/cypress-test-tiny#27
The text was updated successfully, but these errors were encountered: