-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into get-body-class-names
- Loading branch information
Showing
69 changed files
with
203 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {expect} from '@playwright/experimental-ct-react'; | ||
|
||
import type {ExpectScreenshotFixture, PlaywrightFixture} from './types'; | ||
|
||
export const expectScreenshotFixture: PlaywrightFixture<ExpectScreenshotFixture> = async ( | ||
{page}, | ||
use, | ||
testInfo, | ||
) => { | ||
const expectScreenshot: ExpectScreenshotFixture = async ({ | ||
component, | ||
screenshotName, | ||
...pageScreenshotOptions | ||
} = {}) => { | ||
const captureScreenshot = async (theme: string) => { | ||
const root = page.locator('#root'); | ||
|
||
await root.evaluate((el, newTheme) => { | ||
el.setAttribute('class', `g-root g-root_theme_${newTheme}`); | ||
}, theme); | ||
|
||
return (component || page.locator('.playwright-wrapper-test')).screenshot({ | ||
animations: 'disabled', | ||
...pageScreenshotOptions, | ||
}); | ||
}; | ||
|
||
const nameScreenshot = testInfo.titlePath.slice(1).join(' '); | ||
|
||
expect(await captureScreenshot('dark')).toMatchSnapshot({ | ||
name: `${screenshotName || nameScreenshot} dark.png`, | ||
}); | ||
|
||
expect(await captureScreenshot('light')).toMatchSnapshot({ | ||
name: `${screenshotName || nameScreenshot} light.png`, | ||
}); | ||
}; | ||
|
||
await use(expectScreenshot); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {test as base} from '@playwright/experimental-ct-react'; | ||
|
||
import {expectScreenshotFixture} from './expectScreenshotFixture'; | ||
import {mountFixture} from './mountFixture'; | ||
import type {Fixtures} from './types'; | ||
|
||
export const test = base.extend<Fixtures>({ | ||
mount: mountFixture, | ||
expectScreenshot: expectScreenshotFixture, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
import type {JsonObject} from '@playwright/experimental-ct-core/types/component'; | ||
import type {MountOptions} from '@playwright/experimental-ct-react'; | ||
|
||
import type {MountFixture, PlaywrightFixture} from './types'; | ||
|
||
export const mountFixture: PlaywrightFixture<MountFixture> = async ({mount: baseMount}, use) => { | ||
const mount = async ( | ||
component: JSX.Element, | ||
options?: MountOptions<JsonObject> | undefined, | ||
) => { | ||
return await baseMount( | ||
<div | ||
style={{padding: 20, width: 'fit-content', height: 'fit-content'}} | ||
className="playwright-wrapper-test" | ||
> | ||
{component} | ||
</div>, | ||
options, | ||
); | ||
}; | ||
|
||
await use(mount); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type {ComponentFixtures} from '@playwright/experimental-ct-react'; | ||
import type { | ||
Locator, | ||
PageScreenshotOptions, | ||
PlaywrightTestArgs, | ||
PlaywrightTestOptions, | ||
PlaywrightWorkerArgs, | ||
PlaywrightWorkerOptions, | ||
TestFixture, | ||
} from '@playwright/test'; | ||
|
||
type PlaywrightTestFixtures = PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures; | ||
type PlaywrightWorkerFixtures = PlaywrightWorkerArgs & PlaywrightWorkerOptions; | ||
type PlaywrightFixtures = PlaywrightTestFixtures & PlaywrightWorkerFixtures; | ||
export type PlaywrightFixture<T> = TestFixture<T, PlaywrightFixtures>; | ||
|
||
export type Fixtures = { | ||
mount: MountFixture; | ||
expectScreenshot: ExpectScreenshotFixture; | ||
}; | ||
|
||
export type MountFixture = ComponentFixtures['mount']; | ||
|
||
export interface ExpectScreenshotFixture { | ||
(props?: CaptureScreenshotParams): Promise<void>; | ||
} | ||
|
||
interface CaptureScreenshotParams extends PageScreenshotOptions { | ||
screenshotName?: string; | ||
component?: Locator; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-1.06 KB
...tton.visual.test.tsx-snapshots/Button-render-story-Default-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-986 Bytes
...Button.visual.test.tsx-snapshots/Button-render-story-Default-1-webkit-linux.png
Binary file not shown.
Binary file added
BIN
+2.74 KB
...n.visual.test.tsx-snapshots/Button-render-story-Default-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.26 KB
...ton.visual.test.tsx-snapshots/Button-render-story-Default-dark-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.57 KB
....visual.test.tsx-snapshots/Button-render-story-Default-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.11 KB
...on.visual.test.tsx-snapshots/Button-render-story-Default-light-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1 KB
...ton.visual.test.tsx-snapshots/Button-render-story-Disabled-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-914 Bytes
...utton.visual.test.tsx-snapshots/Button-render-story-Disabled-1-webkit-linux.png
Binary file not shown.
Binary file added
BIN
+2.37 KB
....visual.test.tsx-snapshots/Button-render-story-Disabled-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.01 KB
...on.visual.test.tsx-snapshots/Button-render-story-Disabled-dark-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.29 KB
...visual.test.tsx-snapshots/Button-render-story-Disabled-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.94 KB
...n.visual.test.tsx-snapshots/Button-render-story-Disabled-light-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-4.73 KB
.../Button.visual.test.tsx-snapshots/Button-render-story-Icon-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-4.08 KB
...__/Button.visual.test.tsx-snapshots/Button-render-story-Icon-1-webkit-linux.png
Binary file not shown.
Binary file added
BIN
+11.8 KB
...tton.visual.test.tsx-snapshots/Button-render-story-Icon-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.63 KB
...Button.visual.test.tsx-snapshots/Button-render-story-Icon-dark-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.2 KB
...ton.visual.test.tsx-snapshots/Button-render-story-Icon-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.23 KB
...utton.visual.test.tsx-snapshots/Button-render-story-Icon-light-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.73 KB
.../Button.visual.test.tsx-snapshots/Button-render-story-Link-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-1.48 KB
...__/Button.visual.test.tsx-snapshots/Button-render-story-Link-1-webkit-linux.png
Binary file not shown.
Binary file added
BIN
+4.13 KB
...tton.visual.test.tsx-snapshots/Button-render-story-Link-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.28 KB
...Button.visual.test.tsx-snapshots/Button-render-story-Link-dark-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.92 KB
...ton.visual.test.tsx-snapshots/Button-render-story-Link-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.07 KB
...utton.visual.test.tsx-snapshots/Button-render-story-Link-light-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.33 KB
...tton.visual.test.tsx-snapshots/Button-render-story-Loading-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-1.21 KB
...Button.visual.test.tsx-snapshots/Button-render-story-Loading-1-webkit-linux.png
Diff not rendered.
Binary file added
BIN
+3.31 KB
...n.visual.test.tsx-snapshots/Button-render-story-Loading-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.87 KB
...ton.visual.test.tsx-snapshots/Button-render-story-Loading-dark-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+3.2 KB
....visual.test.tsx-snapshots/Button-render-story-Loading-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.78 KB
...on.visual.test.tsx-snapshots/Button-render-story-Loading-light-webkit-linux.png
Oops, something went wrong.
Binary file removed
BIN
-2.65 KB
..._/Button.visual.test.tsx-snapshots/Button-render-story-Pin-1-chromium-linux.png
Diff not rendered.
Binary file removed
BIN
-2.26 KB
...s__/Button.visual.test.tsx-snapshots/Button-render-story-Pin-1-webkit-linux.png
Diff not rendered.
Binary file added
BIN
+6.52 KB
...utton.visual.test.tsx-snapshots/Button-render-story-Pin-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.6 KB
.../Button.visual.test.tsx-snapshots/Button-render-story-Pin-dark-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.09 KB
...tton.visual.test.tsx-snapshots/Button-render-story-Pin-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.21 KB
...Button.visual.test.tsx-snapshots/Button-render-story-Pin-light-webkit-linux.png
Oops, something went wrong.
Binary file removed
BIN
-1.13 KB
...ton.visual.test.tsx-snapshots/Button-render-story-Selected-1-chromium-linux.png
Diff not rendered.
Binary file removed
BIN
-1.06 KB
...utton.visual.test.tsx-snapshots/Button-render-story-Selected-1-webkit-linux.png
Diff not rendered.
Binary file added
BIN
+2.77 KB
....visual.test.tsx-snapshots/Button-render-story-Selected-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.32 KB
...on.visual.test.tsx-snapshots/Button-render-story-Selected-dark-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.66 KB
...visual.test.tsx-snapshots/Button-render-story-Selected-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.25 KB
...n.visual.test.tsx-snapshots/Button-render-story-Selected-light-webkit-linux.png
Oops, something went wrong.
Binary file removed
BIN
-4.53 KB
.../Button.visual.test.tsx-snapshots/Button-render-story-Size-1-chromium-linux.png
Diff not rendered.
Binary file removed
BIN
-3.45 KB
...__/Button.visual.test.tsx-snapshots/Button-render-story-Size-1-webkit-linux.png
Diff not rendered.
Binary file added
BIN
+12.9 KB
...tton.visual.test.tsx-snapshots/Button-render-story-Size-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.49 KB
...Button.visual.test.tsx-snapshots/Button-render-story-Size-dark-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+12.4 KB
...ton.visual.test.tsx-snapshots/Button-render-story-Size-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.9 KB
...utton.visual.test.tsx-snapshots/Button-render-story-Size-light-webkit-linux.png
Oops, something went wrong.
Binary file removed
BIN
-152 KB
.../Button.visual.test.tsx-snapshots/Button-render-story-View-1-chromium-linux.png
Diff not rendered.
Binary file removed
BIN
-126 KB
...__/Button.visual.test.tsx-snapshots/Button-render-story-View-1-webkit-linux.png
Diff not rendered.
Binary file added
BIN
+395 KB
...tton.visual.test.tsx-snapshots/Button-render-story-View-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+309 KB
...Button.visual.test.tsx-snapshots/Button-render-story-View-dark-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+378 KB
...ton.visual.test.tsx-snapshots/Button-render-story-View-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+299 KB
...utton.visual.test.tsx-snapshots/Button-render-story-View-light-webkit-linux.png
Oops, something went wrong.
Binary file removed
BIN
-3.5 KB
...Button.visual.test.tsx-snapshots/Button-render-story-Width-1-chromium-linux.png
Diff not rendered.
Binary file removed
BIN
-2.22 KB
..._/Button.visual.test.tsx-snapshots/Button-render-story-Width-1-webkit-linux.png
Diff not rendered.
Binary file added
BIN
+9.19 KB
...ton.visual.test.tsx-snapshots/Button-render-story-Width-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.2 KB
...utton.visual.test.tsx-snapshots/Button-render-story-Width-dark-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.85 KB
...on.visual.test.tsx-snapshots/Button-render-story-Width-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+5.83 KB
...tton.visual.test.tsx-snapshots/Button-render-story-Width-light-webkit-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+22.4 KB
(110%)
...visual.test.tsx-snapshots/Label-render-story-ShowcaseStory-1-chromium-linux.png
Oops, something went wrong.