-
Notifications
You must be signed in to change notification settings - Fork 234
test: Add visual regression tests for app layout #4714
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
Draft
jperals
wants to merge
4
commits into
main
Choose a base branch
from
dev-v3-jotresse-visual-tests-app-layout
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.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestSuite } from '../types'; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'Content paddings', | ||
| componentName: 'app-layout', | ||
| tests: [ | ||
| ...(['true', 'false'] as const).flatMap(toolsEnabled => | ||
| (['true', 'false'] as const).flatMap(splitPanelEnabled => | ||
| (['bottom', 'side'] as const).map(splitPanelPosition => ({ | ||
| description: `toolsEnabled=${toolsEnabled} splitPanelEnabled=${splitPanelEnabled} splitPanelPosition=${splitPanelPosition}`, | ||
| path: 'app-layout/with-split-panel', | ||
| screenshotType: 'viewport' as const, | ||
| queryParams: { toolsEnabled, splitPanelEnabled, splitPanelPosition }, | ||
| })) | ||
| ) | ||
| ), | ||
| ...[1500, 600].map(width => ({ | ||
| description: `with split panel and disabled content paddings - width=${width}`, | ||
| path: 'app-layout/disable-paddings-with-split-panel', | ||
| screenshotType: 'viewport' as const, | ||
| configuration: { width }, | ||
| queryParams: { splitPanelOpen: 'true', splitPanelPosition: 'side' }, | ||
| })), | ||
| ], | ||
| }; | ||
|
|
||
| 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,69 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestSuite } from '../types'; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'Drawers', | ||
| componentName: 'app-layout', | ||
| tests: [ | ||
| { | ||
| description: 'popover can be displayed outside split panel', | ||
| path: 'app-layout/with-full-page-table-and-split-panel', | ||
| screenshotType: 'viewport', | ||
| queryParams: { splitPanelPosition: 'side' }, | ||
| setup: async ({ page, wrapper }) => { | ||
| await page.click(wrapper.findPopover('[data-testid="split-panel"]').toSelector()); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'popover can be displayed outside help panel', | ||
| path: 'app-layout/with-full-page-table-and-split-panel', | ||
| screenshotType: 'viewport', | ||
| setup: async ({ page, wrapper }) => { | ||
| await page.click(wrapper.findAppLayout().findToolsToggle().toSelector()); | ||
| await page.click(wrapper.findPopover('[data-testid="help-panel"]').toSelector()); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'with split panel', | ||
| path: 'app-layout/with-drawers', | ||
| screenshotType: 'viewport', | ||
| setup: async ({ page, wrapper }) => { | ||
| await page.click(wrapper.findAppLayout().findDrawerTriggerById('pro-help').toSelector()); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'with tooltip on hover', | ||
| path: 'app-layout/with-drawers', | ||
| screenshotType: 'viewport', | ||
| setup: async ({ page, wrapper }) => { | ||
| await page.hoverElement(wrapper.findAppLayout().findDrawerTriggerById('pro-help').toSelector()); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'with custom scrollable drawer content', | ||
| path: 'app-layout/with-drawers-scrollable', | ||
| screenshotType: 'viewport', | ||
| queryParams: { sideNavFill: 'false' }, | ||
| setup: async ({ page, wrapper }) => { | ||
| await page.click(wrapper.findAppLayout().findDrawerTriggerById('chat').toSelector()); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'with full height drawer content', | ||
| path: 'app-layout/with-drawers-scrollable', | ||
| screenshotType: 'viewport', | ||
| queryParams: { sideNavFill: 'true' }, | ||
| setup: async ({ page }) => { | ||
| await page.click('[data-testid="open-global-drawer-button"]'); | ||
| }, | ||
| }, | ||
| { | ||
| description: 'with only global drawers', | ||
| path: 'app-layout/runtime-drawers-with-only-global', | ||
| screenshotType: 'viewport', | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| 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,38 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestSuite } from '../types'; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'Flashbar', | ||
| componentName: 'app-layout', | ||
| tests: [true, false].flatMap(disableContentPaddings => | ||
| [true, false].flatMap(stickyNotifications => | ||
| [true, false].flatMap(stickyTableHeader => | ||
| [true, false].map(stackNotifications => ({ | ||
| description: `disableContentPaddings: ${disableContentPaddings}, stickyNotifications: ${stickyNotifications}, stickyTableHeader: ${stickyTableHeader}, stackNotifications: ${stackNotifications}`, | ||
| path: 'app-layout/with-stacked-notifications-and-table', | ||
| screenshotType: 'screenshotArea' as const, | ||
| configuration: { width: 1280, height: 900 }, | ||
| setup: async ({ page }) => { | ||
| if (!disableContentPaddings) { | ||
| await page.click('[data-id="toggle-content-paddings"]'); | ||
| } | ||
| if (stickyNotifications) { | ||
| await page.click('[data-id="toggle-sticky-notifications"]'); | ||
| } | ||
| if (!stickyTableHeader) { | ||
| await page.click('[data-id="toggle-sticky-table-header"]'); | ||
| } | ||
| if (!stackNotifications) { | ||
| await page.click('[data-id="toggle-stack-items"]'); | ||
| } | ||
| await page.click('[data-id="add-notification"]'); | ||
| await page.click('[data-id="add-notification"]'); | ||
| }, | ||
| })) | ||
| ) | ||
| ) | ||
| ), | ||
| }; | ||
|
|
||
| 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,92 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestDefinition, TestSuite } from '../types'; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'Headers', | ||
| componentName: 'app-layout', | ||
| tests: [ | ||
| // ── Headers ─────────────────────────────────────────────────────────── | ||
| { | ||
| description: 'Headers', | ||
| tests: [600, 1280].flatMap(width => [ | ||
| { | ||
| description: `alignment with full-page table (${width}px)`, | ||
| path: 'app-layout/with-table', | ||
| screenshotType: 'viewport' as const, | ||
| configuration: { width }, | ||
| }, | ||
| { | ||
| description: `alignment with full-page table in sticky state (${width}px)`, | ||
| path: 'app-layout/with-table', | ||
| screenshotType: 'viewport' as const, | ||
| configuration: { width }, | ||
| setup: async ({ page }) => { | ||
| await page.windowScrollTo({ top: 200 }); | ||
| }, | ||
| }, | ||
| { | ||
| description: `alignment with full-page table in sticky state with sticky notifications (${width}px)`, | ||
| path: 'app-layout/with-table', | ||
| screenshotType: 'viewport' as const, | ||
| configuration: { width }, | ||
| queryParams: { stickyNotifications: 'true' }, | ||
| setup: async ({ page }) => { | ||
| await page.windowScrollTo({ top: 200 }); | ||
| }, | ||
| }, | ||
| { | ||
| description: `high contrast header variant in landing page (${width}px)`, | ||
| path: 'app-layout/landing-page', | ||
| screenshotType: 'viewport' as const, | ||
| configuration: { width }, | ||
| }, | ||
| { | ||
| description: `high contrast header variant in landing page with notification dismissed (${width}px)`, | ||
| path: 'app-layout/landing-page', | ||
| screenshotType: 'viewport' as const, | ||
| configuration: { width }, | ||
| setup: async ({ page, wrapper }) => { | ||
| await page.click(wrapper.findFlashbar().findItems().get(1).findDismissButton().toSelector()); | ||
| }, | ||
| }, | ||
| ]), | ||
| }, | ||
| // ── High contrast header variant ────────────────────────────────────── | ||
| { | ||
| description: 'High contrast header variant', | ||
| tests: [ | ||
| ...[1400, 600].flatMap(width => [ | ||
| { | ||
| description: `with breadcrumbs and notifications at ${width}px`, | ||
| path: 'app-layout/high-contrast-header-variant', | ||
| screenshotType: 'screenshotArea' as const, | ||
| configuration: { width }, | ||
| queryParams: { hasBreadcrumbs: 'true', hasNotifications: 'true', hasContainer: 'true' }, | ||
| } as TestDefinition, | ||
| { | ||
| description: `without overlap at ${width}px`, | ||
| path: 'app-layout/high-contrast-header-variant', | ||
| screenshotType: 'screenshotArea' as const, | ||
| configuration: { width }, | ||
| queryParams: { disableOverlap: 'true' }, | ||
| } as TestDefinition, | ||
| { | ||
| description: `with content layout at ${width}px`, | ||
| path: 'app-layout/high-contrast-header-variant', | ||
| screenshotType: 'screenshotArea' as const, | ||
| configuration: { width }, | ||
| queryParams: { | ||
| hasBreadcrumbs: 'true', | ||
| hasNotifications: 'true', | ||
| hasContainer: 'true', | ||
| hasContentLayout: 'true', | ||
| }, | ||
| } as TestDefinition, | ||
| ]), | ||
| ], | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| 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,24 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { TestSuite } from '../types'; | ||
|
|
||
| const suite: TestSuite = { | ||
| description: 'Multiple instances', | ||
| componentName: 'app-layout', | ||
| tests: [600, 1280].flatMap(width => [ | ||
| { | ||
| description: `simple (${width}px)`, | ||
| path: 'app-layout/multi-layout-simple', | ||
| screenshotType: 'viewport' as const, | ||
| configuration: { width }, | ||
| }, | ||
| { | ||
| description: `iframe (${width}px)`, | ||
| path: 'app-layout/multi-layout-iframe', | ||
| screenshotType: 'viewport' as const, | ||
| configuration: { width }, | ||
| }, | ||
| ]), | ||
| }; | ||
|
|
||
| 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.
Note: this test description in the internal package is called "with tooltip on hover in visual refresh", but the test is run for all systems and themes without distinction, including Classic , so I am dropping the "in visual refresh" part (which is not the special case anymore anyway)