Closed JavonDavis closed 5 years ago
Thanks for the PR @JavonDavis
I tried running a gutenberg editor spec when adding a fail statement within a single spec in the file, and it didn't work as the alert remained open
I then tried the same thing on master and it also didn't work 🤔
I was thinking we could try an approach I've used previously where I've run JavaScript to override the beforeunload event in the browser to not show the alert, however it didn't seem to work in Calypso 🤔
What do you think about such an approach? In ruby it looked something like:
browser.execute_script('window.onbeforeunload = null')
I tried running a gutenberg editor spec when adding a fail statement within a single spec in the file, and it didn't work as the alert remained open
I then tried the same thing on master and it also didn't work 🤔
I was thinking we could try an approach I've used previously where I've run JavaScript to override the beforeunload event in the browser to not show the alert, however it didn't seem to work in Calypso 🤔
What do you think about such an approach? In ruby it looked something like:
browser.execute_script('window.onbeforeunload = null')
@alisterscott this gave me a pretty hard time today I tried different approaches, including the one you suggested with no luck... I then realised in this case we're dismissing the alert when to actually leave the page we'd need to accept the alert, for this to work I had to replace dismissAllAlerts
with acceptAllAlerts
and accept the alert if present in the after step of the signup specs. I'm not sure if there'll be any adverse effects to the change from dismiss to alert in mocha-hooks
but I'll check that out in CI.
I then realised in this case we're dismissing the alert when to actually leave the page we'd need to accept the alert,
It drove me crazy yesterday too. And oh wow, I didn't even think of that. Good work figuring that out.
wp-calypso-gutenberg-post-editor-spec.js
seems to be passing in CI but is failing locally for me, @Automattic/flowpatrol anyone else experiencing this? In any case I think it's unrelated to this change and can be handled in a separate PR, thoughts on merging this?
@JavonDavis It fails for me locally as well. I suppose we are good to go with these changes 👍
Small update to
dismissAllAlerts
to use async/await.