-
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 add-smoke-tests/PlaceholderContainer-2
- Loading branch information
Showing
19 changed files
with
368 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+8.67 KB
...nel.visual.test.tsx-snapshots/ActionsPanel-smoke-group-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
+21.4 KB
...ual.test.tsx-snapshots/ActionsPanel-smoke-group-opened-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
+33.7 KB
...ionsPanel.visual.test.tsx-snapshots/ActionsPanel-smoke-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
+37.1 KB
...visual.test.tsx-snapshots/ActionsPanel-smoke-with-note-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.4 KB
...ual.test.tsx-snapshots/ActionsPanel-smoke-with-submenu-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
+17.5 KB
...apshots/ActionsPanel-smoke-with-submenu-opened-submenu-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.
256 changes: 256 additions & 0 deletions
256
src/components/ActionsPanel/__tests__/ActionsPanel.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,256 @@ | ||
import {expect} from '@playwright/experimental-ct-react'; | ||
|
||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import {ActionsPanel} from '../ActionsPanel'; | ||
import type {ActionsPanelProps} from '../types'; | ||
|
||
import {TestActionsPanelWithNote} from './helpersPlaywright'; | ||
|
||
test.describe('ActionsPanel', {tag: '@ActionsPanel'}, () => { | ||
const noop = () => { | ||
// nothing | ||
}; | ||
|
||
const actionsWithNoteAndGroups: ActionsPanelProps['actions'] = [ | ||
{ | ||
id: 'action_1', | ||
button: { | ||
props: { | ||
children: 'Action 1', | ||
onClick: noop, | ||
view: 'normal-contrast', | ||
}, | ||
}, | ||
dropdown: { | ||
item: { | ||
action: noop, | ||
text: 'Action 1', | ||
}, | ||
group: '1', | ||
}, | ||
}, | ||
{ | ||
id: 'action_2', | ||
button: { | ||
props: { | ||
children: 'Action 2', | ||
onClick: noop, | ||
}, | ||
}, | ||
dropdown: { | ||
item: { | ||
action: noop, | ||
text: 'Action 2', | ||
}, | ||
group: '1', | ||
}, | ||
}, | ||
{ | ||
id: 'action_3', | ||
button: { | ||
props: { | ||
children: 'Action 3', | ||
onClick: noop, | ||
}, | ||
}, | ||
dropdown: { | ||
item: { | ||
action: noop, | ||
text: 'Action 3', | ||
}, | ||
group: '2', | ||
}, | ||
}, | ||
{ | ||
id: 'action_4', | ||
button: { | ||
props: { | ||
children: 'Action 4', | ||
onClick: noop, | ||
}, | ||
}, | ||
dropdown: { | ||
item: { | ||
action: noop, | ||
text: 'Action 4', | ||
}, | ||
group: '2', | ||
}, | ||
}, | ||
]; | ||
|
||
const collapsedActionsWithNoteAndGroups = actionsWithNoteAndGroups.map((item) => { | ||
return { | ||
...item, | ||
collapsed: true, | ||
}; | ||
}); | ||
|
||
const defaultProps: ActionsPanelProps = { | ||
actions: actionsWithNoteAndGroups, | ||
}; | ||
|
||
smokeTest('', async ({mount, expectScreenshot}) => { | ||
const smokeScenarios = createSmokeScenarios<ActionsPanelProps>(defaultProps, { | ||
maxRowActions: [2], | ||
onClose: [['closable', noop]], | ||
}); | ||
|
||
await mount( | ||
<div> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div | ||
style={{ | ||
width: 600, | ||
}} | ||
> | ||
<div> | ||
<ActionsPanel {...props} /> | ||
</div> | ||
</div> | ||
</div> | ||
))} | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
}); | ||
|
||
smokeTest('with note', async ({mount, expectScreenshot}) => { | ||
const smokeScenarios = createSmokeScenarios<ActionsPanelProps>(defaultProps, { | ||
maxRowActions: [2], | ||
onClose: [['closable', noop]], | ||
}); | ||
|
||
await mount( | ||
<div> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div | ||
style={{ | ||
width: 600, | ||
}} | ||
> | ||
<div> | ||
<TestActionsPanelWithNote {...props} /> | ||
</div> | ||
</div> | ||
</div> | ||
))} | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
}); | ||
|
||
smokeTest('group', async ({mount, page, expectScreenshot}) => { | ||
const root = await mount( | ||
<div | ||
style={{ | ||
width: 600, | ||
minHeight: 500, | ||
}} | ||
> | ||
<TestActionsPanelWithNote actions={collapsedActionsWithNoteAndGroups} /> | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
|
||
await root.getByRole('button').click(); | ||
await expect(page.locator('[role="menu"]')).toBeVisible({ | ||
timeout: 3000, | ||
}); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
nameSuffix: 'opened', | ||
}); | ||
}); | ||
|
||
smokeTest('with submenu', async ({mount, page, expectScreenshot}) => { | ||
const actionsSubmenu: ActionsPanelProps['actions'] = [ | ||
{ | ||
id: 'button-with-sub-menu', | ||
button: { | ||
props: { | ||
children: 'Sub-menu', | ||
view: 'outlined-contrast', | ||
onClick: noop, | ||
qa: 'sub-menu-trigger', | ||
}, | ||
}, | ||
dropdown: { | ||
item: { | ||
text: 'Sub-menu', | ||
items: [ | ||
{ | ||
action: noop, | ||
text: 'Edit', | ||
}, | ||
{ | ||
action: noop, | ||
text: 'Delete', | ||
theme: 'danger', | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
{ | ||
id: 'nested-menu', | ||
collapsed: true, | ||
button: { | ||
props: { | ||
children: 'Nested', | ||
onClick: noop, | ||
qa: 'nested-menu-trigger', | ||
}, | ||
}, | ||
dropdown: { | ||
item: { | ||
action: noop, | ||
text: 'Action 3', | ||
}, | ||
group: '2', | ||
}, | ||
}, | ||
]; | ||
|
||
const root = await mount( | ||
<div | ||
style={{ | ||
width: 600, | ||
minHeight: 500, | ||
}} | ||
> | ||
<TestActionsPanelWithNote actions={actionsSubmenu} /> | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
|
||
await root.getByTestId('sub-menu-trigger').click(); | ||
await expect(page.locator('[role="menu"]')).toBeVisible({ | ||
timeout: 3000, | ||
}); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
nameSuffix: 'opened submenu', | ||
}); | ||
}); | ||
}); |
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,6 @@ | ||
import {ActionsPanel} from '../ActionsPanel'; | ||
import type {ActionsPanelProps} from '../types'; | ||
|
||
export const TestActionsPanelWithNote = (props: ActionsPanelProps) => { | ||
return <ActionsPanel renderNote={() => 'note'} {...props} />; | ||
}; |
Binary file added
BIN
+9.57 KB
...apshots__/Loader.visual.test.tsx-snapshots/Loader-smoke-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.27 KB
...pshots__/Loader.visual.test.tsx-snapshots/Loader-smoke-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.
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,32 @@ | ||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {LoaderProps} from '../Loader'; | ||
import {Loader} from '../Loader'; | ||
|
||
import {sizeCases} from './cases'; | ||
|
||
test.describe('Loader', {tag: '@Loader'}, () => { | ||
const defaultProps: LoaderProps = {}; | ||
|
||
smokeTest('', async ({mount, expectScreenshot}) => { | ||
const smokeScenarios = createSmokeScenarios(defaultProps, { | ||
size: sizeCases, | ||
}); | ||
|
||
await mount( | ||
<div> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div> | ||
<Loader {...props} /> | ||
</div> | ||
</div> | ||
))} | ||
</div>, | ||
); | ||
|
||
await 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,4 @@ | ||
import type {Cases} from '../../../stories/tests-factory/models'; | ||
import type {LoaderProps} from '../Loader'; | ||
|
||
export const sizeCases: Cases<LoaderProps['size']> = ['s', 'm', 'l']; |
Binary file added
BIN
+4.74 KB
...ots__/Skeleton.visual.test.tsx-snapshots/Skeleton-smoke-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
+4.31 KB
...ts__/Skeleton.visual.test.tsx-snapshots/Skeleton-smoke-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.
34 changes: 34 additions & 0 deletions
34
src/components/Skeleton/__tests__/Skeleton.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,34 @@ | ||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {SkeletonProps} from '../Skeleton'; | ||
import {Skeleton} from '../Skeleton'; | ||
|
||
test.describe('Skeleton', {tag: '@Skeleton'}, () => { | ||
smokeTest('', async ({mount, expectScreenshot}) => { | ||
const defaultProps: SkeletonProps = { | ||
className: '', | ||
style: { | ||
width: '30px', | ||
height: '30px', | ||
}, | ||
}; | ||
|
||
const smokeScenarios = createSmokeScenarios(defaultProps, {}); | ||
|
||
await mount( | ||
<div style={{width: 400}}> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div> | ||
<Skeleton {...props} /> | ||
</div> | ||
</div> | ||
))} | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({}); | ||
}); | ||
}); |
Binary file added
BIN
+21.4 KB
...__snapshots__/Spin.visual.test.tsx-snapshots/Spin-smoke-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
+20.1 KB
..._snapshots__/Spin.visual.test.tsx-snapshots/Spin-smoke-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.
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,32 @@ | ||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {SpinProps} from '../Spin'; | ||
import {Spin} from '../Spin'; | ||
|
||
import {sizeCases} from './cases'; | ||
|
||
test.describe('Spin', {tag: '@Spin'}, () => { | ||
smokeTest('', async ({mount, expectScreenshot}) => { | ||
const defaultProps: SpinProps = {}; | ||
|
||
const smokeScenarios = createSmokeScenarios(defaultProps, { | ||
size: sizeCases, | ||
}); | ||
|
||
await mount( | ||
<div> | ||
{smokeScenarios.map(([title, props]) => ( | ||
<div key={title}> | ||
<h4>{title}</h4> | ||
<div> | ||
<Spin {...props} /> | ||
</div> | ||
</div> | ||
))} | ||
</div>, | ||
); | ||
|
||
await 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,4 @@ | ||
import type {Cases} from '../../../stories/tests-factory/models'; | ||
import type {SpinProps} from '../Spin'; | ||
|
||
export const sizeCases: Cases<SpinProps['size']> = ['xs', 's', 'm', 'l', 'xl']; |