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

[EXPERIMENTAL] Test iframe submission #450

Open
wants to merge 1 commit into
base: sadym/testdriver-bidi
Choose a base branch
from

Conversation

sadym-chromium
Copy link
Owner

Extention of web-platform-tests#44649, providing a way to automate iframe sandbox tests. This is a very draft version, and the specific API, especially of the testdriver is a subject to discuss. Nevertheless, this PR is intended to provide a showcase of how the testdriver BiDi can be used in cases where there is no direct access from the test file to the browsing context under the test.


// Wait is required to avoid false-positive passes.
// TODO: replace wait with a more efficient method.
await new Promise(resolve => setTimeout(resolve, 300));
Copy link

Choose a reason for hiding this comment

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

should wait come before locate_nodes?

Copy link
Owner Author

Choose a reason for hiding this comment

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

sure!

promise_test(async () => {
const tree = await test_driver.bidi.browsing_context.get_tree({root: window});
const iframe = tree[0].children[0];
const submit_button_selector_result = await test_driver.bidi.browsing_context.locate_nodes({
Copy link

Choose a reason for hiding this comment

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

I think the API is nice and I like it very much that you can use window interchangeably with browsingContext

Copy link
Owner Author

Choose a reason for hiding this comment

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

And the same approach can be used for the element itself vs it's sharedId

extend testdriver bidi with required methods
@jgraham
Copy link

jgraham commented Apr 22, 2024

This looks pretty nice to me, although it does feel like at some point we're going to want a higher level abstraction.

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.

3 participants