forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extend testdriver bidi with required methods
- Loading branch information
1 parent
8b261c9
commit 084605a
Showing
7 changed files
with
299 additions
and
6 deletions.
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 | ||
} | ||
} | ||
}); | ||
|
||
const success_message_selector_result = await test_driver.bidi.browsing_context.locate_nodes({ | ||
context: iframe.context, | ||
locator: {type: "innerText", value: "PASS!!!"} | ||
}); | ||
|
||
// Wait is required to avoid false-positive passes. | ||
// TODO: replace wait with a more efficient method. | ||
await new Promise(resolve => setTimeout(resolve, 300)); | ||
|
||
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