-
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/DropdownMenu
- Loading branch information
Showing
71 changed files
with
1,088 additions
and
2 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
+413 KB
....test.tsx-snapshots/DefinitionList-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
+396 KB
...test.tsx-snapshots/DefinitionList-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
+399 KB
...visual.test.tsx-snapshots/DefinitionList-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
+402 KB
...sx-snapshots/DefinitionList-smoke-direction-horizontal-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
+407 KB
....tsx-snapshots/DefinitionList-smoke-direction-vertical-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
+526 KB
...ts/DefinitionList-smoke-responsive-contentMaxWidth-100-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
+402 KB
....tsx-snapshots/DefinitionList-smoke-responsive-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
+427 KB
...shots/DefinitionList-smoke-responsive-nameMaxWidth-100-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.
69 changes: 69 additions & 0 deletions
69
src/components/DefinitionList/__tests__/DefinitionList.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,69 @@ | ||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {DefinitionListProps} from '../types'; | ||
|
||
import {DefinitionListStories} from './stories'; | ||
|
||
test.describe('DefinitionList', {tag: '@DefinitionList'}, () => { | ||
test('render story <Default>', async ({mount, expectScreenshot}) => { | ||
await mount(<DefinitionListStories.Default />); | ||
|
||
await expectScreenshot(); | ||
}); | ||
|
||
createSmokeScenarios<Omit<DefinitionListProps, 'children'>>( | ||
{}, | ||
{ | ||
direction: ['vertical', 'horizontal'], | ||
}, | ||
).forEach(([title, props]) => { | ||
smokeTest(title, async ({mount, expectScreenshot}) => { | ||
await mount( | ||
<div> | ||
<h4>{title}</h4> | ||
<DefinitionListStories.Default {...props} /> | ||
</div>, | ||
); | ||
|
||
await expectScreenshot({ | ||
themes: ['light'], | ||
}); | ||
}); | ||
}); | ||
|
||
createSmokeScenarios<Omit<DefinitionListProps, 'children'>>( | ||
{ | ||
responsive: true, | ||
}, | ||
{ | ||
nameMaxWidth: [100], | ||
contentMaxWidth: [100], | ||
}, | ||
{ | ||
scenarioName: 'responsive', | ||
}, | ||
).forEach(([title, props]) => { | ||
smokeTest(title, async ({mount, page, expectScreenshot}) => { | ||
const size = page.viewportSize(); | ||
if (size) { | ||
await page.setViewportSize({ | ||
width: 1000, | ||
height: size.height, | ||
}); | ||
} | ||
|
||
await mount( | ||
<div> | ||
<h4>{title}</h4> | ||
<DefinitionListStories.Default {...props} /> | ||
</div>, | ||
{width: 'auto'}, | ||
); | ||
|
||
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,5 @@ | ||
import {composeStories} from '@storybook/react'; | ||
|
||
import * as CSFStories from '../__stories__/DefinitionList.stories'; | ||
|
||
export const DefinitionListStories = composeStories(CSFStories); |
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
Oops, something went wrong.
Binary file added
BIN
+14.5 KB
....test.tsx-snapshots/HelpMark-smoke-placement-right-end-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.5 KB
...sual.test.tsx-snapshots/HelpMark-smoke-placement-right-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.3 KB
...est.tsx-snapshots/HelpMark-smoke-placement-right-start-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+14 KB
...al.test.tsx-snapshots/HelpMark-smoke-placement-top-end-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.8 KB
...visual.test.tsx-snapshots/HelpMark-smoke-placement-top-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15 KB
....test.tsx-snapshots/HelpMark-smoke-placement-top-start-light-chromium-linux.png
Oops, something went wrong.
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'], | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.