File tree Expand file tree Collapse file tree 3 files changed +11
-17
lines changed
Expand file tree Collapse file tree 3 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,7 @@ export const expectScreenshotFixture: PlaywrightFixture<ExpectScreenshotFixture>
1212 screenshotName,
1313 ...pageScreenshotOptions
1414 } = { } ) => {
15- const captureScreenshot = async ( theme : string ) => {
16- const root = page . locator ( '#root' ) ;
17-
18- await root . evaluate ( ( el , theme ) => {
19- el . classList . value = `g-root g-root_theme_${ theme } ` ;
20- } , theme ) ;
21-
15+ const captureScreenshot = async ( ) => {
2216 return ( component || page . locator ( '.playwright-wrapper-test' ) ) . screenshot ( {
2317 animations : 'disabled' ,
2418 ...pageScreenshotOptions ,
@@ -27,12 +21,14 @@ export const expectScreenshotFixture: PlaywrightFixture<ExpectScreenshotFixture>
2721
2822 const nameScreenshot = testInfo . titlePath . slice ( 1 ) . join ( ' ' ) ;
2923
30- expect ( await captureScreenshot ( 'dark' ) ) . toMatchSnapshot ( {
31- name : `${ screenshotName || nameScreenshot } dark .png` ,
24+ expect ( await captureScreenshot ( ) ) . toMatchSnapshot ( {
25+ name : `${ screenshotName || nameScreenshot } light .png` ,
3226 } ) ;
3327
34- expect ( await captureScreenshot ( 'light' ) ) . toMatchSnapshot ( {
35- name : `${ screenshotName || nameScreenshot } light.png` ,
28+ await page . emulateMedia ( { colorScheme : 'dark' } ) ;
29+
30+ expect ( await captureScreenshot ( ) ) . toMatchSnapshot ( {
31+ name : `${ screenshotName || nameScreenshot } dark.png` ,
3632 } ) ;
3733 } ;
3834
Original file line number Diff line number Diff line change 1- <!DOCTYPE html>
1+ <!doctype html>
22< html lang ="ru ">
33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
66 < title > Test component page</ title >
77 </ head >
8- < body >
9- < div id ="root " class ="g-root g-root_theme_light "> </ div >
10- < script type ="module " src ="./index.tsx "> </ script >
11- </ body >
8+ < body id ="root " class ="g-root "> </ body >
9+ < script type ="module " src ="./index.tsx "> </ script >
1210</ html >
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import './index.scss';
77
88beforeMount ( async ( { App} ) => {
99 return (
10- < ThemeProvider theme = "light" >
10+ < ThemeProvider >
1111 < MobileProvider >
1212 < App />
1313 </ MobileProvider >
You can’t perform that action at this time.
0 commit comments