-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(HelpMark): add visual test (#2025)
- Loading branch information
1 parent
f8dfee1
commit b190203
Showing
21 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+1.41 KB
...visual.test.tsx-snapshots/HelpMark-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
+1.31 KB
...isual.test.tsx-snapshots/HelpMark-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
+11.7 KB
...pMark.visual.test.tsx-snapshots/HelpMark-smoke-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
+14.1 KB
...l.test.tsx-snapshots/HelpMark-smoke-placement-auto-end-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
+13.6 KB
...isual.test.tsx-snapshots/HelpMark-smoke-placement-auto-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
+14.4 KB
...test.tsx-snapshots/HelpMark-smoke-placement-auto-start-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
+15.4 KB
...test.tsx-snapshots/HelpMark-smoke-placement-bottom-end-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
+14.8 KB
...ual.test.tsx-snapshots/HelpMark-smoke-placement-bottom-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
+16.1 KB
...st.tsx-snapshots/HelpMark-smoke-placement-bottom-start-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
+13.4 KB
...l.test.tsx-snapshots/HelpMark-smoke-placement-left-end-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
+12.8 KB
...isual.test.tsx-snapshots/HelpMark-smoke-placement-left-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
+14.1 KB
...test.tsx-snapshots/HelpMark-smoke-placement-left-start-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
+14.5 KB
....test.tsx-snapshots/HelpMark-smoke-placement-right-end-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
+13.5 KB
...sual.test.tsx-snapshots/HelpMark-smoke-placement-right-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
+14.3 KB
...est.tsx-snapshots/HelpMark-smoke-placement-right-start-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
+14 KB
...al.test.tsx-snapshots/HelpMark-smoke-placement-top-end-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
+13.8 KB
...visual.test.tsx-snapshots/HelpMark-smoke-placement-top-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
+15 KB
....test.tsx-snapshots/HelpMark-smoke-placement-top-start-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.
52 changes: 52 additions & 0 deletions
52
src/components/HelpMark/__tests__/HelpMark.visual.test.tsx
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,52 @@ | ||
import {expect} from '@playwright/experimental-ct-react'; | ||
|
||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {HelpMarkProps} from '../HelpMark'; | ||
import {HelpMark} from '../HelpMark'; | ||
|
||
import {placementCases} from './cases'; | ||
import {HelpMarkStories} from './stories'; | ||
|
||
test.describe('HelpMark', {tag: '@HelpMark'}, () => { | ||
test('render story: <Default>', async ({mount, expectScreenshot}) => { | ||
await mount(<HelpMarkStories.Default />); | ||
|
||
await expectScreenshot(); | ||
}); | ||
|
||
createSmokeScenarios<HelpMarkProps>( | ||
{}, | ||
{ | ||
placement: placementCases, | ||
}, | ||
).forEach(([title, props]) => { | ||
smokeTest(title, async ({mount, page, expectScreenshot}) => { | ||
const root = await mount( | ||
<div> | ||
<h4>{title}</h4> | ||
<div style={{padding: 100}}> | ||
<HelpMark | ||
qa="popover" | ||
buttonProps={{ | ||
// @ts-expect-error Object literal may only specify known properties, and ''data-qa'' does not exist in type 'ButtonHTMLAttributes<HTMLButtonElement>' | ||
'data-qa': 'trigger', | ||
}} | ||
{...props} | ||
> | ||
Test content | ||
</HelpMark> | ||
</div> | ||
</div>, | ||
); | ||
|
||
await root.getByTestId('trigger').hover(); | ||
await expect(page.getByTestId('popover-tooltip')).toBeVisible(); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
}); | ||
}); | ||
}); |
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,20 @@ | ||
import type {Cases} from '../../../stories/tests-factory/models'; | ||
import type {HelpMarkProps} from '../HelpMark'; | ||
|
||
export const placementCases: Cases<HelpMarkProps['placement']> = [ | ||
'auto', | ||
'auto-start', | ||
'auto-end', | ||
'top', | ||
'bottom', | ||
'right', | ||
'left', | ||
'top-start', | ||
'top-end', | ||
'bottom-start', | ||
'bottom-end', | ||
'right-start', | ||
'right-end', | ||
'left-start', | ||
'left-end', | ||
]; |
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,5 @@ | ||
import {composeStories} from '@storybook/react'; | ||
|
||
import * as CSFStories from '../__stories__/HelpMark.stories'; | ||
|
||
export const HelpMarkStories = composeStories(CSFStories); |