-
Notifications
You must be signed in to change notification settings - Fork 140
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
[REPLAY] Add support for adoptedStyleSheets
#1916
Conversation
867494e
to
8ee122f
Compare
Codecov Report
@@ Coverage Diff @@
## main #1916 +/- ##
==========================================
- Coverage 93.21% 93.19% -0.03%
==========================================
Files 141 141
Lines 5349 5362 +13
Branches 1202 1207 +5
==========================================
+ Hits 4986 4997 +11
- Misses 363 365 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
23ffc63
to
89f9e47
Compare
b7b6208
to
026cf50
Compare
026cf50
to
2ebb758
Compare
adoptedStyleSheets
Prefer an interface with casting
…adopted-stylesheet
function isAdoptedStyleSheetsSupported() { | ||
return ['edge', 'chrome'].includes(getBrowserName()) | ||
} |
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.
💬 suggestion: Could we check the adoptedStyleSheets
property on document instead?
it would allow to automatically run this test on other browsers when available
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.
no because it would be in the runner (node) not in the targetted browser :(
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.
browserExecute
helper could execute this check on the browser side
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.
Indeed, @BenoitZugmeyer you suggest that approach. Maybe you want to share your opinion here
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.
Is it possible to get the result out of the browser to the runner to stop the test?
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.
It's a bit more annoying as it would be asynchronous, but we can try!
Note, instead of if (...) { createTest(...).run() }
it would need to done in the .run()
callback like:
.run(async () => {
if (!await isAdoptedStyleSheetsSupported()) { pending('...') }
...
})
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.
@BenoitZugmeyer How can I test that locally? By default it will run on Chrome up to date and be ok with the test but how can I test that it will be pending?
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.
You can try with a constant condition (ex: if (!await Promise.resolve(false)) { pending() }
About the condition specifically, I managed to run e2e tests in firefox locally, or you can run your tests on browserstack with the yarn test:e2e:bs
with the right tokens as environment variable. Or simply push the change and see how it goes :)
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.
[DELETED]
Co-authored-by: Bastien Caudan <[email protected]>
Motivation
Following what we started on the shadow dom support, let's add support for dynamic stylesheet
Changes
adoptedStylesheets
because it's added in typescript 4.8 and we're using 4.7adoptedStylesheets
when serializing onDocument
&ShadowRoot
Out of scope
adoptedStylesheets
propertyCSSStylesheet
themselves.Testing
Document
Shadow root
I have gone over the contributing documentation.