-
Notifications
You must be signed in to change notification settings - Fork 137
test(TableColumnSetup): add visual tests #2492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tungulin
wants to merge
5
commits into
gravity-ui:main
Choose a base branch
from
tungulin:task/add_tests_for_tableColumnSetup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0254171
test(TableColumnSetup): add visual tests
tungulin 2269456
test(TableColumnSetup): review changes
tungulin 843e413
test(TableColumnSetup): review changes
tungulin 65602e4
test(TableColumnSetup): minor
tungulin fb9ae91
test(TableColumnSetup): minor
tungulin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+17.8 KB
...-with-custom-popupPlacement-with-custom-popupPlacement-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
+20 KB
...apshots/TableColumnSetup-smoke-with-custom-width-popup-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
+18 KB
...eColumnSetup-smoke-with-custom-width-with-custom-width-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
...tup-smoke-with-hide-apply-button-with-hide-apply-popup-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.7 KB
...eColumnSetup-smoke-with-opened-popup-with-opened-popup-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.
124 changes: 124 additions & 0 deletions
124
src/components/TableColumnSetup/__tests__/TableColumnSetup.visual.test.tsx
This file contains hidden or 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,124 @@ | ||
| import {expect} from '@playwright/experimental-ct-react'; | ||
| import {noop} from 'lodash'; | ||
|
|
||
| import {smokeTest, test} from '~playwright/core'; | ||
|
|
||
| import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios'; | ||
| import {TableColumnSetup} from '../TableColumnSetup'; | ||
| import type {TableColumnSetupProps} from '../TableColumnSetup'; | ||
|
|
||
| import {disabledCases, showStatusCases} from './cases'; | ||
|
|
||
| const defaultProps: TableColumnSetupProps = { | ||
| items: [ | ||
| {id: 'name', title: 'Имя', selected: true, required: true}, | ||
| {id: 'email', title: 'Email', selected: true}, | ||
| {id: 'phone', title: 'Телефон', selected: false}, | ||
|
||
| ], | ||
| onUpdate: noop, | ||
| }; | ||
|
|
||
| test.describe('TableColumnSetup', {tag: '@TableColumnSetup'}, () => { | ||
| smokeTest('with custom width popup', async ({mount, expectScreenshot}) => { | ||
| const smokeScenarios = createSmokeScenarios(defaultProps, { | ||
| disabled: disabledCases, | ||
| showStatus: showStatusCases, | ||
| }); | ||
|
|
||
| await mount( | ||
| <div> | ||
| {smokeScenarios.map(([title, props]) => ( | ||
| <div key={title}> | ||
| <h4>{title}</h4> | ||
| <TableColumnSetup {...props} /> | ||
| </div> | ||
| ))} | ||
| </div>, | ||
| ); | ||
|
|
||
| await expectScreenshot({ | ||
| themes: ['light'], | ||
| }); | ||
| }); | ||
|
|
||
| smokeTest('with opened popup', async ({mount, page, expectScreenshot}) => { | ||
| const root = await mount( | ||
| <div | ||
| style={{ | ||
| width: 200, | ||
| height: 200, | ||
| }} | ||
| > | ||
| <TableColumnSetup {...defaultProps} /> | ||
| </div>, | ||
| ); | ||
|
|
||
| await root.locator("button[type='button']").click(); | ||
| await expect(page.locator('[role="listbox"]')).toBeVisible(); | ||
|
|
||
| await expectScreenshot({ | ||
| themes: ['light'], | ||
| nameSuffix: 'with opened popup', | ||
| }); | ||
| }); | ||
|
|
||
| smokeTest('with hide apply button', async ({mount, expectScreenshot}) => { | ||
| const root = await mount( | ||
| <div | ||
| style={{ | ||
| width: 200, | ||
| height: 200, | ||
| }} | ||
| > | ||
| <TableColumnSetup {...defaultProps} hideApplyButton /> | ||
| </div>, | ||
| ); | ||
|
|
||
| await root.locator("button[type='button']").click(); | ||
|
|
||
| await expectScreenshot({ | ||
| themes: ['light'], | ||
| nameSuffix: 'with hide apply popup', | ||
| }); | ||
| }); | ||
|
|
||
| smokeTest('with custom popupPlacement', async ({mount, expectScreenshot}) => { | ||
| const root = await mount( | ||
| <div | ||
| style={{ | ||
| width: 400, | ||
| height: 200, | ||
| }} | ||
| > | ||
| <TableColumnSetup {...defaultProps} popupPlacement="left-end" /> | ||
| </div>, | ||
| ); | ||
|
|
||
| await root.locator("button[type='button']").click(); | ||
|
|
||
| await expectScreenshot({ | ||
| themes: ['light'], | ||
| nameSuffix: 'with custom popupPlacement', | ||
| }); | ||
| }); | ||
|
|
||
| smokeTest('with custom width', async ({mount, expectScreenshot}) => { | ||
| const root = await mount( | ||
| <div | ||
| style={{ | ||
| width: 400, | ||
| height: 200, | ||
| }} | ||
| > | ||
| <TableColumnSetup {...defaultProps} popupWidth={300} /> | ||
| </div>, | ||
| ); | ||
|
|
||
| await root.locator("button[type='button']").click(); | ||
|
|
||
| await expectScreenshot({ | ||
| themes: ['light'], | ||
| nameSuffix: 'with custom width', | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or 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 type {Cases} from '../../../stories/tests-factory/models'; | ||
| import type {TableColumnSetupProps} from '../TableColumnSetup'; | ||
|
|
||
| export const disabledCases: Cases<TableColumnSetupProps['disabled']> = [true]; | ||
| export const showStatusCases: Cases<TableColumnSetupProps['showStatus']> = [true]; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like "lock" item has different offset. Let's fix it in this PR so screenshot would be correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests for different variants popupPlacement