-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[testdriver] Add testdriver extension for prefetch event in speculation module #55274
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
base: master
Are you sure you want to change the base?
[testdriver] Add testdriver extension for prefetch event in speculation module #55274
Conversation
…t and infrastructure tests
…b.com/srwei/wpt into SpeculationRulesPrefetchWebDriverBidi
|
Please add wdspec tests as well. Actually, I'd prefer to have wdspec tests first in a separate PR, but it's up to you. |
infrastructure/testdriver/bidi/speculation/prefetch_status_updated.https.html
Outdated
Show resolved
Hide resolved
infrastructure/testdriver/bidi/speculation/prefetch_status_updated.https.html
Outdated
Show resolved
Hide resolved
Oh I thought webdriver/tests/bidi/external/speculation/prefetch_status_updated/ tests were the wdpsec tests |
infrastructure/testdriver/bidi/speculation/prefetch_status_updated.https.html
Outdated
Show resolved
Hide resolved
webdriver/tests/bidi/external/speculation/prefetch_status_updated/prefetch_status_updated.py
Outdated
Show resolved
Hide resolved
webdriver/tests/bidi/external/speculation/prefetch_status_updated/prefetch_status_updated.py
Outdated
Show resolved
Hide resolved
webdriver/tests/bidi/external/speculation/prefetch_status_updated/prefetch_status_updated.py
Outdated
Show resolved
Hide resolved
webdriver/tests/bidi/external/speculation/prefetch_status_updated/prefetch_status_updated.py
Outdated
Show resolved
Hide resolved
| await add_speculation_rules_and_link(new_tab, speculation_rules_2, prefetch_target_2) | ||
|
|
||
| with pytest.raises(TimeoutException): | ||
| await waiter.get_events(lambda events: len(events) >= 1, timeout=2) |
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.
We usually use timeout of 0.5 when we want to make sure event didn't happen, Please use 0.5 seconds as well.
|
|
||
|
|
||
| @pytest.fixture | ||
| def add_speculation_rules(bidi_session): |
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 cannot see any usages of this fixture. Was it intended to be used in add_speculation_rules_and_link?
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.
Yeah, I think we can probably remove the fixture actually.
| expression=f""" | ||
| const script = document.createElement('script'); | ||
| script.type = 'speculationrules'; | ||
| script.textContent = `{rules}`; |
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.
NIT: any particular reason the "`" instead of "'" was used here and in other method?
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.
The rules are usually multi line, and it seems cleaner to use backticks rather than adding escaping
Spec: https://wicg.github.io/nav-speculation/prefetch.html#automated-testing
chromium-bidi implementation: GoogleChromeLabs/chromium-bidi@66d3585
Adding testdriver extension for the speculation module that is mainly to add the prefetch_status_updated event. No commands.
This event will replace the current timeout mechanism for speculation rules prefetch in the wpt prefetch corpus: https://github.com/web-platform-tests/wpt/tree/master/speculation-rules/prefetch
Follow up CLs will be raised to update the above tests to use the new event handling.
@sadym-chromium would you be able to help with rollover for chromium?