-
Notifications
You must be signed in to change notification settings - Fork 238
chore: Add visual tests for more components (C-E) #4833
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
jperals
wants to merge
14
commits into
main
Choose a base branch
from
dev-v3-jotresse-test-definitions-04
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 all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
87a2f9c
chore: Add visual tests for more components (C-I)
jperals 8f8f89c
Fix types
jperals 38d4717
Fix wait for Ace
jperals 448c24d
Remove some tests
jperals e62ba31
Increase shards
jperals d1f1a74
Missing changes
jperals 9ed7b1d
Fix waiting for Ace
jperals 369da29
Wait for longer
jperals 7a214dc
Do not reuse browser
jperals f0b1892
Debug
jperals 8da4ec2
Revert changes in utils
jperals bed45f1
Exclude code editor
jperals e464851
Refactor
jperals 2d96313
Add doubleClick method
jperals 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
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
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
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
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 |
|---|---|---|
|
|
@@ -9,11 +9,11 @@ const suite: TestSuite = { | |
| { | ||
| description: 'Z-index', | ||
| tests: [ | ||
| ...[600, 1280].flatMap(width => [ | ||
| ...[600, 1280].flatMap<TestDefinition>(width => [ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small refactor as follow-up from #4826 (comment) |
||
| { | ||
| description: `button dropdown (${width}px)`, | ||
| path: 'app-layout/with-absolute-components', | ||
| screenshotType: 'viewport' as const, | ||
| screenshotType: 'viewport', | ||
| configuration: { width }, | ||
| setup: async ({ page }) => { | ||
| await page.click('button=Button dropdown'); | ||
|
|
@@ -24,7 +24,7 @@ const suite: TestSuite = { | |
| { | ||
| description: `select (${width}px)`, | ||
| path: 'app-layout/with-absolute-components', | ||
| screenshotType: 'viewport' as const, | ||
| screenshotType: 'viewport', | ||
| configuration: { width, height: 800 }, | ||
| setup: async ({ page }) => { | ||
| await page.click('[data-testid="select-demo"] button'); | ||
|
|
@@ -34,7 +34,7 @@ const suite: TestSuite = { | |
| { | ||
| description: `split-panel and full-page table (${width}px)`, | ||
| path: 'app-layout/with-full-page-table-and-split-panel', | ||
| screenshotType: 'viewport' as const, | ||
| screenshotType: 'viewport', | ||
| configuration: { width }, | ||
| }, | ||
| ]), | ||
|
|
@@ -63,7 +63,7 @@ const suite: TestSuite = { | |
| { | ||
| description: 'split-panel and full-page with open navigation (600px)', | ||
| path: 'app-layout/with-full-page-table-and-split-panel', | ||
| screenshotType: 'viewport' as const, | ||
| screenshotType: 'viewport', | ||
| configuration: { width: 600 }, | ||
| setup: async ({ page }) => { | ||
| await page.click('button[aria-label="Open navigation"]'); | ||
|
|
@@ -72,7 +72,7 @@ const suite: TestSuite = { | |
| { | ||
| description: 'split-panel and full-page with open tools (600px)', | ||
| path: 'app-layout/with-full-page-table-and-split-panel', | ||
| screenshotType: 'viewport' as const, | ||
| screenshotType: 'viewport', | ||
| configuration: { width: 600 }, | ||
| setup: async ({ page }) => { | ||
| await page.click('button[aria-label="Open tools"]'); | ||
|
|
||
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,16 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestSuite } from '../types'; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'Cards', | ||
| componentName: 'cards', | ||
| tests: [2200, 1920, 1400, 1200, 992, 768].map(width => ({ | ||
| description: `permutations at ${width}`, | ||
| path: 'cards/permutations', | ||
| screenshotType: 'permutations', | ||
| configuration: { width }, | ||
| })), | ||
| }; | ||
|
|
||
| export default suite; |
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,36 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestSuite } from '../types'; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'Checkbox', | ||
| componentName: 'checkbox', | ||
| tests: [ | ||
| { | ||
| description: 'Permutations', | ||
| path: 'checkbox/permutations', | ||
| screenshotType: 'permutations', | ||
| }, | ||
| { | ||
| description: 'Checkbox is focused', | ||
| path: 'checkbox/focus-test', | ||
| screenshotType: 'screenshotArea', | ||
| setup: async ({ page }) => { | ||
| await page.click('#focus-target'); | ||
| await page.focusNextElement(); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'Checkbox has label with a correct width', | ||
| path: 'checkbox/labels-highlight', | ||
| screenshotType: 'screenshotArea', | ||
| }, | ||
| { | ||
| description: 'Style custom page', | ||
| path: 'checkbox/style-custom', | ||
| screenshotType: 'screenshotArea', | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default suite; |
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,71 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestSuite } from '../types'; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'CollectionPreferences', | ||
| componentName: 'collection-preferences', | ||
| tests: [ | ||
| ...[ | ||
| [600, 1100], | ||
| [1280, 700], | ||
| ].map<TestSuite>(([width, height]) => ({ | ||
| description: `width ${width}px, height ${height}px`, | ||
| tests: [ | ||
| { | ||
| description: `complete at ${width}x${height}`, | ||
| path: 'collection-preferences/simple', | ||
| screenshotType: 'viewport', | ||
| configuration: { width, height }, | ||
| setup: async ({ page }) => { | ||
| await page.click('.cp-1 button'); | ||
| }, | ||
| }, | ||
| { | ||
| description: `visible content only at ${width}x${height}`, | ||
| path: 'collection-preferences/simple', | ||
| screenshotType: 'viewport', | ||
| setup: async ({ page }) => { | ||
| await page.click('.cp-4 button'); | ||
| }, | ||
| }, | ||
| ], | ||
| })), | ||
| { | ||
| description: 'custom', | ||
| path: 'collection-preferences/simple', | ||
| screenshotType: 'viewport', | ||
| setup: async ({ page }) => { | ||
| await page.click('.cp-2 button'); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'Content reordering', | ||
| tests: [ | ||
| { | ||
| description: 'drag handle focused', | ||
| path: 'collection-preferences/reorder-content', | ||
| screenshotType: 'viewport', | ||
| configuration: { width: 900, height: 650 }, | ||
| setup: async ({ page }) => { | ||
| await page.click('.cp-1 button'); | ||
| await page.keys(Array(5).fill('Tab')); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'reordering active', | ||
| path: 'collection-preferences/reorder-content', | ||
| screenshotType: 'viewport', | ||
| configuration: { width: 900, height: 650 }, | ||
| setup: async ({ page }) => { | ||
| await page.click('.cp-1 button'); | ||
| await page.keys(Array(5).fill('Tab')); | ||
| await page.keys(['Space']); | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default suite; |
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,31 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestDefinition, TestSuite } from '../types'; | ||
|
|
||
| const TEST_WIDTHS: [string, number][] = [ | ||
| ['default', 400], | ||
| ['xxs', 500], | ||
| ['xs', 800], | ||
| ['m', 1200], | ||
| ]; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'ColumnLayout', | ||
| componentName: 'column-layout', | ||
| tests: TEST_WIDTHS.flatMap<TestDefinition>(([breakpoint, width]) => [ | ||
| { | ||
| description: `column-layout at "${breakpoint}"`, | ||
| path: 'column-layout/simple', | ||
| screenshotType: 'screenshotArea', | ||
| configuration: { width }, | ||
| }, | ||
| { | ||
| description: `permutations at "${breakpoint}"`, | ||
| path: 'column-layout/permutations', | ||
| screenshotType: 'permutations', | ||
| configuration: { width }, | ||
| }, | ||
| ]), | ||
| }; | ||
|
|
||
| export default suite; |
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,43 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestDefinition, TestSuite } from '../types'; | ||
|
|
||
| function stickyTest( | ||
| width: number, | ||
| description: string, | ||
| params?: Record<string, string>, | ||
| withScroll = true | ||
| ): TestDefinition { | ||
| return { | ||
| description, | ||
| path: 'container/sticky-permutations', | ||
| screenshotType: 'viewport', | ||
| configuration: { width }, | ||
| ...(params && { queryParams: params }), | ||
| ...(withScroll && { | ||
| setup: async ({ page }) => { | ||
| await page.windowScrollTo({ top: 200 }); | ||
| }, | ||
| }), | ||
| }; | ||
| } | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'Container sticky permutations', | ||
| componentName: 'container', | ||
| tests: [1400, 600].flatMap<TestDefinition>(width => [ | ||
| stickyTest(width, `simple - at ${width}px`), | ||
| stickyTest(width, `with notifications - at ${width}px`, { hasNotifications: 'true' }), | ||
| stickyTest(width, `with breadcrumbs - at ${width}px`, { hasBreadcrumbs: 'true' }), | ||
| stickyTest(width, `with an alert - at ${width}px`, { hasNotifications: 'true', hasAlert: 'true' }), | ||
| stickyTest( | ||
| width, | ||
| `with an alert - at ${width}px without scroll`, | ||
| { hasNotifications: 'true', hasAlert: 'true' }, | ||
| false | ||
| ), | ||
| stickyTest(width, `with high-contrast header - at ${width}px`, { hasNotifications: 'true', highContrast: 'true' }), | ||
| ]), | ||
| }; | ||
|
|
||
| export default suite; |
Oops, something went wrong.
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.
These two methods can be removed after this is released: cloudscape-design/browser-test-tools#243