-
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/Popup
- Loading branch information
Showing
61 changed files
with
386 additions
and
1 deletion.
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
Binary file added
BIN
+20.4 KB
....visual.test.tsx-snapshots/ActionTooltip-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
+23 KB
...t.tsx-snapshots/ActionTooltip-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
+22.4 KB
....test.tsx-snapshots/ActionTooltip-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
+23.4 KB
...tsx-snapshots/ActionTooltip-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
+23.8 KB
...tsx-snapshots/ActionTooltip-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
+22.9 KB
...est.tsx-snapshots/ActionTooltip-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
+24.4 KB
...x-snapshots/ActionTooltip-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
+22.5 KB
...t.tsx-snapshots/ActionTooltip-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
+21.6 KB
....test.tsx-snapshots/ActionTooltip-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
+23.1 KB
...tsx-snapshots/ActionTooltip-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
+23.5 KB
....tsx-snapshots/ActionTooltip-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
+22.4 KB
...test.tsx-snapshots/ActionTooltip-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
+23.3 KB
...sx-snapshots/ActionTooltip-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
+22.6 KB
...st.tsx-snapshots/ActionTooltip-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
+22.1 KB
...l.test.tsx-snapshots/ActionTooltip-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
+23.5 KB
....tsx-snapshots/ActionTooltip-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.
66 changes: 66 additions & 0 deletions
66
src/components/ActionTooltip/__tests__/ActionTooltip.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,66 @@ | ||
import {expect} from '@playwright/experimental-ct-react'; | ||
|
||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {ActionTooltipProps} from '../ActionTooltip'; | ||
import {ActionTooltip} from '../ActionTooltip'; | ||
|
||
import {placementCases} from './cases'; | ||
|
||
test.describe('ActionTooltip', {tag: '@ActionTooltip'}, () => { | ||
const defaultProps: ActionTooltipProps = { | ||
title: 'Title', | ||
hotkey: 'mod+a', | ||
description: 'Description', | ||
children: <div>trigger</div>, | ||
}; | ||
|
||
const smokeScenarios = createSmokeScenarios<ActionTooltipProps>(defaultProps, { | ||
placement: placementCases, | ||
}); | ||
|
||
smokeScenarios.forEach(([title, props]) => { | ||
smokeTest(title, async ({mount, page, expectScreenshot}) => { | ||
const root = await mount( | ||
<div> | ||
<h4>{title}</h4> | ||
<div | ||
style={{ | ||
width: '400px', | ||
height: '400px', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<div> | ||
<ActionTooltip {...props}> | ||
<div | ||
data-qa="trigger" | ||
style={{ | ||
width: '200px', | ||
height: '200px', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
border: '1px tomato dotted', | ||
}} | ||
> | ||
trigger block | ||
</div> | ||
</ActionTooltip> | ||
</div> | ||
</div> | ||
</div>, | ||
); | ||
|
||
await root.getByTestId('trigger').hover(); | ||
await expect(page.locator("[role='tooltip']")).toBeVisible({timeout: 1000}); | ||
|
||
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 {ActionTooltipProps} from '../ActionTooltip'; | ||
|
||
export const placementCases: Cases<ActionTooltipProps['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', | ||
]; |
Binary file added
BIN
+61.8 KB
...isual.test.tsx-snapshots/Dialog-smoke-bodyContent-long-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
+24.8 KB
...ual.test.tsx-snapshots/Dialog-smoke-bodyHasBorder-true-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
+24.7 KB
.../Dialog.visual.test.tsx-snapshots/Dialog-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
+25.5 KB
...ual.test.tsx-snapshots/Dialog-smoke-footerLoading-true-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
+24.7 KB
...al.test.tsx-snapshots/Dialog-smoke-footerPreset-danger-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
+24.7 KB
...l.test.tsx-snapshots/Dialog-smoke-footerPreset-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
+24.7 KB
...l.test.tsx-snapshots/Dialog-smoke-footerPreset-success-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
+31.1 KB
...l.test.tsx-snapshots/Dialog-smoke-footerShowError-true-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
+28.2 KB
...Dialog-smoke-footerTextButtonApply-Custom-button-apply-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
+27.8 KB
...alog-smoke-footerTextButtonCancel-Custom-button-cancel-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+82.4 KB
...ual.test.tsx-snapshots/Dialog-smoke-headerCaption-long-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+27.5 KB
...test.tsx-snapshots/Dialog-smoke-headerInsertAfter-true-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+28 KB
...est.tsx-snapshots/Dialog-smoke-headerInsertBefore-true-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+24.7 KB
..._/Dialog.visual.test.tsx-snapshots/Dialog-smoke-size-l-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+24.7 KB
..._/Dialog.visual.test.tsx-snapshots/Dialog-smoke-size-m-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+24.7 KB
..._/Dialog.visual.test.tsx-snapshots/Dialog-smoke-size-s-light-chromium-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import {Dialog} from '../Dialog'; | ||
import type {DialogProps} from '../Dialog'; | ||
import type {DialogBodyProps} from '../DialogBody/DialogBody'; | ||
import type {DialogFooterProps} from '../DialogFooter/DialogFooter'; | ||
import type {DialogHeaderProps} from '../DialogHeader/DialogHeader'; | ||
|
||
import { | ||
bodyContentCases, | ||
bodyHasBorderCases, | ||
footerLoadingCases, | ||
footerPresetCases, | ||
footerShowErrorCases, | ||
footerTextButtonApplyCases, | ||
footerTextButtonCancelCases, | ||
headerCaptionCases, | ||
headerInsertAfterCases, | ||
headerInsertBeforeCases, | ||
sizeCases, | ||
} from './cases'; | ||
|
||
interface AllDialogProps { | ||
size?: DialogProps['size']; | ||
|
||
headerCaption?: DialogHeaderProps['caption']; | ||
headerInsertBefore?: DialogHeaderProps['insertBefore']; | ||
headerInsertAfter?: DialogHeaderProps['insertAfter']; | ||
|
||
bodyHasBorder?: DialogBodyProps['hasBorders']; | ||
bodyContent?: DialogBodyProps['children']; | ||
|
||
footerShowError?: DialogFooterProps['showError']; | ||
footerPreset?: DialogFooterProps['preset']; | ||
footerLoading?: DialogFooterProps['loading']; | ||
footerTextButtonCancel?: DialogFooterProps['textButtonCancel']; | ||
footerTextButtonApply?: DialogFooterProps['textButtonApply']; | ||
} | ||
|
||
test.describe('Dialog', {tag: '@Dialog'}, () => { | ||
createSmokeScenarios( | ||
{ | ||
size: 's', | ||
|
||
headerCaption: 'Dialog.Header', | ||
|
||
bodyContent: 'Dialog.Body', | ||
|
||
footerTextButtonApply: 'apply', | ||
footerTextButtonCancel: 'cancel', | ||
} as AllDialogProps, | ||
{ | ||
size: sizeCases, | ||
|
||
headerCaption: headerCaptionCases, | ||
headerInsertBefore: headerInsertBeforeCases, | ||
headerInsertAfter: headerInsertAfterCases, | ||
|
||
bodyHasBorder: bodyHasBorderCases, | ||
bodyContent: bodyContentCases, | ||
|
||
footerShowError: footerShowErrorCases, | ||
footerPreset: footerPresetCases, | ||
footerLoading: footerLoadingCases, | ||
footerTextButtonCancel: footerTextButtonCancelCases, | ||
footerTextButtonApply: footerTextButtonApplyCases, | ||
}, | ||
).forEach(([title, props]) => { | ||
smokeTest(title, async ({page, mount, expectScreenshot}) => { | ||
await page.setViewportSize({width: 1000, height: 600}); | ||
|
||
const { | ||
size, | ||
headerCaption, | ||
headerInsertBefore, | ||
headerInsertAfter, | ||
bodyHasBorder, | ||
bodyContent, | ||
footerLoading, | ||
footerPreset, | ||
footerShowError, | ||
footerTextButtonCancel, | ||
footerTextButtonApply, | ||
} = props; | ||
|
||
await mount( | ||
<Dialog size={size} onClose={() => {}} open onEnterKeyDown={() => {}}> | ||
{(headerCaption || headerInsertBefore || headerInsertAfter) && ( | ||
<Dialog.Header | ||
caption={headerCaption} | ||
insertAfter={headerInsertAfter} | ||
insertBefore={headerInsertBefore} | ||
/> | ||
)} | ||
<Dialog.Body hasBorders={bodyHasBorder}>{bodyContent}</Dialog.Body> | ||
<Dialog.Footer | ||
loading={footerLoading} | ||
preset={footerPreset} | ||
showError={footerShowError} | ||
textButtonApply={footerTextButtonApply} | ||
textButtonCancel={footerTextButtonCancel} | ||
errorText="Error text" | ||
/> | ||
</Dialog>, | ||
); | ||
|
||
await expectScreenshot({ | ||
component: page, | ||
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,54 @@ | ||
import type {Cases, CasesWithName} from '../../../stories/tests-factory/models'; | ||
import type {DialogProps} from '../Dialog'; | ||
import type {DialogBodyProps} from '../DialogBody/DialogBody'; | ||
import type {DialogFooterProps} from '../DialogFooter/DialogFooter'; | ||
import type {DialogHeaderProps} from '../DialogHeader/DialogHeader'; | ||
|
||
export const sizeCases: Cases<DialogProps['size']> = ['s', 'm', 'l']; | ||
|
||
/* eslint-disable react/jsx-key */ | ||
|
||
export const headerCaptionCases: CasesWithName<DialogHeaderProps['caption']> = [ | ||
[ | ||
'long', | ||
<div> | ||
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum | ||
has been the industrys standard dummy text ever since the 1500s, when an unknown printer | ||
took a galley of type and scrambled it to make a type specimen book.{' '} | ||
</div>, | ||
], | ||
]; | ||
export const headerInsertBeforeCases: CasesWithName<DialogHeaderProps['insertBefore']> = [ | ||
['true', <div>insertBefore</div>], | ||
]; | ||
export const headerInsertAfterCases: CasesWithName<DialogHeaderProps['insertAfter']> = [ | ||
['true', <div>insertAfter</div>], | ||
]; | ||
|
||
export const bodyHasBorderCases: Cases<DialogBodyProps['hasBorders']> = [true]; | ||
export const bodyContentCases: CasesWithName<DialogBodyProps['children']> = [ | ||
[ | ||
'long', | ||
<div> | ||
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum | ||
has been the industrys standard dummy text ever since the 1500s, when an unknown printer | ||
took a galley of type and scrambled it to make a type specimen book.{' '} | ||
</div>, | ||
], | ||
]; | ||
|
||
export const footerShowErrorCases: Cases<DialogFooterProps['showError']> = [true]; | ||
export const footerPresetCases: Cases<DialogFooterProps['preset']> = [ | ||
'default', | ||
'success', | ||
'danger', | ||
]; | ||
export const footerLoadingCases: Cases<DialogFooterProps['loading']> = [true]; | ||
export const footerTextButtonCancelCases: Cases<DialogFooterProps['textButtonCancel']> = [ | ||
'Custom button cancel', | ||
]; | ||
export const footerTextButtonApplyCases: Cases<DialogFooterProps['textButtonApply']> = [ | ||
'Custom button apply', | ||
]; | ||
|
||
/* eslint-enabled react/jsx-key */ |
Binary file added
BIN
+12.9 KB
...snapshots__/Modal.visual.test.tsx-snapshots/Modal-smoke-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.1 KB
...napshots__/Modal.visual.test.tsx-snapshots/Modal-smoke-light-chromium-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {expect} from '@playwright/experimental-ct-react'; | ||
|
||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {Modal} from '../Modal'; | ||
|
||
import {ModalQa} from './constants'; | ||
|
||
test.describe('Modal', {tag: '@Modal'}, () => { | ||
smokeTest('', async ({mount, page, expectScreenshot}) => { | ||
await page.setViewportSize({width: 500, height: 500}); | ||
|
||
await mount( | ||
<div> | ||
<div>page content</div> | ||
<Modal open qa={ModalQa.content}> | ||
<div style={{padding: 10}}>Modal content</div> | ||
</Modal> | ||
</div>, | ||
); | ||
|
||
await expect(page.getByTestId(ModalQa.content)).toBeVisible(); | ||
|
||
await expectScreenshot({ | ||
component: page, | ||
}); | ||
}); | ||
}); |
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 @@ | ||
export const ModalQa = { | ||
content: 'content', | ||
trigger: 'trigger', | ||
}; |
Binary file added
BIN
+12.9 KB
...ooltip.visual.test.tsx-snapshots/Tooltip-smoke-default-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.5 KB
...al.test.tsx-snapshots/Tooltip-smoke-placement-auto-end-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.8 KB
...visual.test.tsx-snapshots/Tooltip-smoke-placement-auto-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.8 KB
....test.tsx-snapshots/Tooltip-smoke-placement-auto-start-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.8 KB
....test.tsx-snapshots/Tooltip-smoke-placement-bottom-end-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.3 KB
...sual.test.tsx-snapshots/Tooltip-smoke-placement-bottom-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+16.7 KB
...est.tsx-snapshots/Tooltip-smoke-placement-bottom-start-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.3 KB
...al.test.tsx-snapshots/Tooltip-smoke-placement-left-end-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.6 KB
...visual.test.tsx-snapshots/Tooltip-smoke-placement-left-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15 KB
....test.tsx-snapshots/Tooltip-smoke-placement-left-start-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.8 KB
...l.test.tsx-snapshots/Tooltip-smoke-placement-right-end-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.7 KB
...isual.test.tsx-snapshots/Tooltip-smoke-placement-right-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.7 KB
...test.tsx-snapshots/Tooltip-smoke-placement-right-start-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.4 KB
...ual.test.tsx-snapshots/Tooltip-smoke-placement-top-end-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.4 KB
....visual.test.tsx-snapshots/Tooltip-smoke-placement-top-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.7 KB
...l.test.tsx-snapshots/Tooltip-smoke-placement-top-start-light-chromium-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import {expect} from '@playwright/experimental-ct-react'; | ||
|
||
import {smokeTest, test} from '~playwright/core'; | ||
|
||
import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
import type {TooltipProps} from '../Tooltip'; | ||
|
||
import {placementCases} from './cases'; | ||
import {TooltipQA} from './constants'; | ||
import {TestTooltip} from './helpers'; | ||
|
||
test.describe('Tooltip', {tag: '@Tooltip'}, () => { | ||
createSmokeScenarios<TooltipProps>( | ||
{ | ||
children: <div>text</div>, | ||
}, | ||
{ | ||
placement: placementCases, | ||
}, | ||
).forEach(([title, props]) => { | ||
smokeTest(title, async ({mount, page, expectScreenshot}) => { | ||
const root = await mount( | ||
<div> | ||
<h4>{title}</h4> | ||
<div | ||
style={{ | ||
padding: '25px 100px', | ||
}} | ||
> | ||
<TestTooltip {...props} /> | ||
</div> | ||
</div>, | ||
); | ||
|
||
await root.getByTestId(TooltipQA.trigger).hover(); | ||
|
||
await expect(page.getByTestId(TooltipQA.tooltipContent)).toBeVisible({ | ||
timeout: 3000, | ||
}); | ||
|
||
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 {TooltipProps} from '../Tooltip'; | ||
|
||
export const placementCases: Cases<TooltipProps['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,4 @@ | ||
export const TooltipQA = { | ||
trigger: 'trigger', | ||
tooltipContent: 'tooltip-content', | ||
}; |
Oops, something went wrong.