Skip to content
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

Automatically dismiss dialog boxes #663

Merged
merged 10 commits into from
Nov 30, 2022
Merged

Automatically dismiss dialog boxes #663

merged 10 commits into from
Nov 30, 2022

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Nov 29, 2022

Partly closes: #655

We have had a feature request recently as well as seen dialog boxes being used elsewhere. There currently isn't a work around to removing dialog boxes in the path of a test. This change will automatically dismiss the dialog boxes (and accept it for beforeunload type dialogs).

This handler will listen out for when dialog boxes are opened. When
a CDP event is received for a dialog box opening, we will
automatically dismiss it. This is the first step in dealing with
dialog boxes.
The test dismisses an alert dialogue box.
This test will dismiss a confirm dialog box.
This test will dismiss a prompt type dialog box.
Instead of always checking that the text field is Hello World, when
a dialog box opens, it will change the textField to reflect which
type of dialog appeared.
A dialog box of type beforeunload seems to only be dismissable if
we accept. This is the same solution as what playwright are doing.
@ankur22 ankur22 added the feature A new feature label Nov 29, 2022
@ankur22 ankur22 added this to the v0.7.0 milestone Nov 29, 2022
@ankur22 ankur22 requested a review from inancgumus November 29, 2022 13:57
@ankur22 ankur22 self-assigned this Nov 29, 2022
Copy link
Member

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

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

Nice work 👏

tests/frame_test.go Outdated Show resolved Hide resolved
tests/frame_test.go Outdated Show resolved Hide resolved
common/frame_session.go Show resolved Hide resolved
@ankur22
Copy link
Collaborator Author

ankur22 commented Nov 30, 2022

Nice work 👏

Thanks @inancgumus 🙂 I've actioned on all comments.

ankur22 and others added 3 commits November 30, 2022 09:57
This test will ensure that the beforeunload dialog box is accepted
when we try to reload the page. Unlike other alert boxes which appear
when the page loads, beforeunload boxes appear when the page unloads.
Co-authored-by: İnanç Gümüş <[email protected]>
@ankur22 ankur22 force-pushed the feat/655-dismiss-dialog branch from f598949 to df85e63 Compare November 30, 2022 09:57
We don't need the struct yet to define each of the tests in the table
test. Instead use a slice of string.

Resolves: #663 (comment)
Co-authored-by: Inanc Gumus <[email protected]>
@ankur22 ankur22 merged commit 0ca4685 into main Nov 30, 2022
@ankur22 ankur22 deleted the feat/655-dismiss-dialog branch November 30, 2022 10:33
@inancgumus inancgumus changed the title dismiss dialog box automatically Automatically dismiss dialog boxes Dec 5, 2022
@inancgumus inancgumus removed this from the v0.7.0 milestone Dec 5, 2022
@inancgumus inancgumus removed the feature A new feature label Dec 5, 2022
inancgumus added a commit that referenced this pull request Jan 13, 2023
inancgumus added a commit that referenced this pull request Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for interacting with dialog boxes
2 participants