forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
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
sadym-chromium
wants to merge
1
commit into
sadym/testdriver-bidi
Choose a base branch
from
sadym/frame
base: sadym/testdriver-bidi
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
html/semantics/embedded-content/the-iframe-element/sandbox_006_bidi.htm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE HTML> | ||
<meta charset="utf-8"> | ||
<title>Test console log are present</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
|
||
<iframe src="support/iframe_sandbox_006.htm" sandbox="allow-forms"></iframe> | ||
<script type="text/javascript"> | ||
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({ | ||
context: iframe.context, | ||
locator: {type: "css", value: "#submitButton"} | ||
}); | ||
const submit_button_shared_id = submit_button_selector_result.nodes[0].sharedId; | ||
await test_driver.bidi.input.click({ | ||
context: iframe.context, | ||
origin: { | ||
type: "element", | ||
element: { | ||
sharedId: submit_button_shared_id | ||
} | ||
} | ||
}); | ||
|
||
// Wait is required to avoid false-negative. | ||
// TODO: replace wait with a more efficient method. | ||
await new Promise(resolve => setTimeout(resolve, 300)); | ||
|
||
const success_message_selector_result = await test_driver.bidi.browsing_context.locate_nodes({ | ||
context: iframe.context, | ||
locator: {type: "innerText", value: "PASS!!!"} | ||
}); | ||
|
||
assert_equals(success_message_selector_result.nodes.length, 1); | ||
assert_equals(success_message_selector_result.nodes[0].value.attributes.style, 'color: Green'); | ||
}, "Allow form submission inside sandbox iframe when sandbox='allow-forms'."); | ||
</script> |
40 changes: 40 additions & 0 deletions
40
html/semantics/embedded-content/the-iframe-element/sandbox_007_bidi.htm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE HTML> | ||
<meta charset="utf-8"> | ||
<title>Test console log are present</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
|
||
<iframe src="support/iframe_sandbox_007.htm" sandbox="allow-scripts allow-same-origin allow-top-navigation"></iframe> | ||
<script type="text/javascript"> | ||
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({ | ||
context: iframe.context, | ||
locator: {type: "css", value: "#submitButton"} | ||
}); | ||
const submit_button_shared_id = submit_button_selector_result.nodes[0].sharedId; | ||
await test_driver.bidi.input.click({ | ||
context: iframe.context, | ||
origin: { | ||
type: "element", | ||
element: { | ||
sharedId: submit_button_shared_id | ||
} | ||
} | ||
}); | ||
|
||
// Wait is required to avoid false-positive passes. | ||
// TODO: replace wait with a more efficient method. | ||
await new Promise(resolve => setTimeout(resolve, 300)); | ||
|
||
const success_message_selector_result = await test_driver.bidi.browsing_context.locate_nodes({ | ||
context: iframe.context, | ||
locator: {type: "innerText", value: "PASS!!!"} | ||
}); | ||
|
||
assert_equals(success_message_selector_result.nodes.length, 0); | ||
}, "Block form submission inside iframe with sandbox attribute."); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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