Repository navigation
chore(playwright): dark mode support - #28593
Conversation
brandyscarney
left a comment
There was a problem hiding this comment.
Code makes sense, just a question on how we want to support multiple themes if we decide to add more in the future.
| <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" /> | ||
| <link href="${baseUrl}/css/ionic.bundle.css" rel="stylesheet" /> | ||
| <link href="${baseUrl}/scripts/testing/styles.css" rel="stylesheet" /> | ||
| <link href="${baseUrl}/scripts/testing/themes/${theme}.css" rel="stylesheet" /> |
There was a problem hiding this comment.
Should we only be adding this import if theme is defined? Right now we default to light, but this could prevent someone from testing the fallback theme values such as the ones found in https://github.com/ionic-team/ionic-framework/blob/main/core/src/themes/ionic.theme.default.ios.scss. Right now it looks like we wouldn't have that problem, but it would be easy for someone to add --ion-color-step-* variables to the light.css file and suddenly have a bunch of screenshot tests fail.
There was a problem hiding this comment.
theme is currently always defined in this capacity since we assign a default of light when the test config doesn't specify an explicit theme to test against.
I'll rework this a bit so that default is an available option for the fallback state. If the theme is default it will opt-out of importing a theme stylesheet.
There was a problem hiding this comment.
Addressed here: 54289d8 (both feedback comment)
liamdebeasi
left a comment
There was a problem hiding this comment.
One non-blocking comment. Otherwise looks good. Thanks for doing this!
| * - `light`: The light theme values. | ||
| * - `dark`: The dark theme values. | ||
| */ | ||
| export type Theme = 'default' | 'light' | 'dark'; |
There was a problem hiding this comment.
Bikeshedding: I wonder if "none" or "fallback" would make more sense here? I think of light mode as the default theme. Not a blocker for me, so if you think "default" is still the best option I'm fine with that.
There was a problem hiding this comment.
I'm not wedded to the naming here, also agree default isn't clear. I think none could make sense 👍
There was a problem hiding this comment.
Reworked once again after offline feedback with Brandy.
We opted for:
- "light" theme = fallback theme, no stylesheet imported
- "dark" theme = dark.css stylesheet is imported
There is no explicit "light.css" theme of the variables, because those are a duplicate of what the fallback styles should be.
2a6383c to
1c8a3b1
Compare
Issue number: N/A
What is the current behavior?
Testing dark mode is manual per test in Playwright. Ionic developer needs to setup the variables and assign them to a selector that applies in the class.
What is the new behavior?
.setContentAPI will now work with a new config option to test dark mode automatically without additional configuration/test set-up.-darkor-light(as an example for current themes).Does this introduce a breaking change?
Other information