Skip to content

Commit 07776c4

Browse files
committed
Bug 1978027 - [wdspec] Add test for setting a timezone override on the page with iframes. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D259032
1 parent 60673b0 commit 07776c4

File tree

1 file changed

+44
-0
lines changed
  • testing/web-platform/tests/webdriver/tests/bidi/emulation/set_timezone_override

1 file changed

+44
-0
lines changed

testing/web-platform/tests/webdriver/tests/bidi/emulation/set_timezone_override/contexts.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,47 @@ async def test_multiple_contexts(bidi_session, new_tab, get_current_timezone,
4848
# Assert the timezone is restored to the initial one.
4949
assert await get_current_timezone(new_tab) == default_timezone
5050
assert await get_current_timezone(new_context) == default_timezone
51+
52+
53+
@pytest.mark.parametrize("domain", ["", "alt"], ids=["same_origin", "cross_origin"])
54+
async def test_iframe(
55+
bidi_session,
56+
new_tab,
57+
domain,
58+
inline,
59+
get_current_timezone,
60+
some_timezone,
61+
another_timezone
62+
):
63+
# Set timezone override.
64+
await bidi_session.emulation.set_timezone_override(
65+
contexts=[new_tab["context"]],
66+
timezone=some_timezone
67+
)
68+
69+
# Assert timezone emulated in the required context.
70+
assert await get_current_timezone(new_tab) == some_timezone
71+
72+
iframe_url = inline("<div id='in-iframe'>foo</div>", domain=domain)
73+
page_url = inline(f"<iframe src='{iframe_url}'></iframe>")
74+
75+
# Load the page with iframes.
76+
await bidi_session.browsing_context.navigate(
77+
context=new_tab["context"],
78+
url=page_url,
79+
wait="complete",
80+
)
81+
82+
contexts = await bidi_session.browsing_context.get_tree(root=new_tab["context"])
83+
iframe = contexts[0]["children"][0]
84+
85+
# Assert timezone is emulated in the iframe context.
86+
assert await get_current_timezone(iframe) == some_timezone
87+
88+
# Set another timezone override.
89+
await bidi_session.emulation.set_timezone_override(
90+
contexts=[new_tab["context"]], timezone=another_timezone
91+
)
92+
93+
# Assert timezone is emulated in the iframe context.
94+
assert await get_current_timezone(iframe) == another_timezone

0 commit comments

Comments
 (0)