-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: added reduced motion media query emulation #6646
feat: added reduced motion media query emulation #6646
Conversation
d58d389
to
07916ce
Compare
07916ce
to
14b74a3
Compare
14b74a3
to
e11c511
Compare
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 think we should figure out whether we want default behavior be system-dependent, or hardcoded. Depending on that, quite a few places will have to change.
@@ -114,3 +114,15 @@ it('should change the actual colors in css', async ({page}) => { | |||
await page.emulateMedia({ colorScheme: 'light' }); | |||
expect(await getBackgroundColor()).toBe('rgb(255, 255, 255)'); | |||
}); | |||
|
|||
it('should emulate reduced motion', async ({page}) => { |
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.
Let's have a test for default behavior, if we decide to not fallback to system default.
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.
how shall we test it?
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.
Just match no-preference
before the first emulateMedia
call.
4d60aec
to
76a5559
Compare
76a5559
to
bc68cb5
Compare
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.
This looks good, let's see whether the tests pass :)
@@ -114,3 +114,15 @@ it('should change the actual colors in css', async ({page}) => { | |||
await page.emulateMedia({ colorScheme: 'light' }); | |||
expect(await getBackgroundColor()).toBe('rgb(255, 255, 255)'); | |||
}); | |||
|
|||
it('should emulate reduced motion', async ({page}) => { |
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.
Just match no-preference
before the first emulateMedia
call.
6662695
to
bcd57b0
Compare
03c8de8
to
bb0e5dc
Compare
Instead of setting a Chrome-only CLI flag. For some reason the CLI flag isn't working for me anymore after updating Playwright to 1.14.1 (might be a bug in Playwright). Investigating that led me to https://playwright.dev/docs/api/class-page#page-emulate-media and microsoft/playwright#6646. This resolves the issue I'm seeing, and also should work in all browsers, instead of just Chrome.
Instead of setting a Chrome-only CLI flag. For some reason the CLI flag isn't working for me anymore after updating Playwright to 1.14.1 (might be a bug in Playwright). Investigating that led me to https://playwright.dev/docs/api/class-page#page-emulate-media and microsoft/playwright#6646. This resolves the issue I'm seeing, and also should work in all browsers, instead of just Chrome.
Instead of setting a Chrome-only CLI flag. For some reason the CLI flag isn't working for me anymore after updating Playwright to 1.14.1 (might be a bug in Playwright). Investigating that led me to https://playwright.dev/docs/api/class-page#page-emulate-media and microsoft/playwright#6646. This resolves the issue I'm seeing, and also should work in all browsers, instead of just Chrome.
Playwright added support for `emulateMedia` in this PR microsoft/playwright#6646
Fixes #3320