File tree Expand file tree Collapse file tree 4 files changed +28
-3
lines changed
Expand file tree Collapse file tree 4 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ interface AppUrlParams {
1313 direction : "ltr" | "rtl" ;
1414 motionDisabled : boolean ;
1515 i18n : boolean ;
16+ screenshotMode : boolean ;
1617}
1718
1819export interface AppContextType < T = unknown > {
@@ -29,6 +30,7 @@ const appContextDefaults: AppContextType = {
2930 direction : "ltr" ,
3031 motionDisabled : false ,
3132 i18n : true ,
33+ screenshotMode : false ,
3234 } ,
3335 setUrlParams : ( ) => { } ,
3436} ;
Original file line number Diff line number Diff line change 1+ /*
2+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ SPDX-License-Identifier: Apache-2.0
4+ */
5+
6+ /*
7+ Spinner animations do not follow our general motion configuration, we need to disable them explicitly to get stable
8+ screenshot testing results
9+ */
10+ .no-animation {
11+ * ,
12+ * : before ,
13+ * : after {
14+ animation : none !important ;
15+ transition : none !important ;
16+ }
17+ }
Original file line number Diff line number Diff line change 11// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22// SPDX-License-Identifier: Apache-2.0
33
4- import { ReactNode } from "react" ;
4+ import { ReactNode , useContext } from "react" ;
5+ import clsx from "clsx" ;
6+
7+ import AppContext from "./app-context" ;
8+
9+ import styles from "./screenshot-area.module.css" ;
510
611export function ScreenshotArea ( { children } : { children : ReactNode } ) {
7- return < div className = "screenshot-area" > { children } </ div > ;
12+ const { urlParams } = useContext ( AppContext ) ;
13+ return < div className = { clsx ( "screenshot-area" , urlParams . screenshotMode && styles [ "no-animation" ] ) } > { children } </ div > ;
814}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export function setupTest<P extends BasePageObject & { init?(): Promise<void> }>
1313 test : ( page : P ) => Promise < void > ,
1414) {
1515 return useBrowser ( windowSize , async ( browser ) => {
16- await browser . url ( url ) ;
16+ await browser . url ( ` ${ url } ?screenshotMode=true` ) ;
1717 const page = new PageClass ( browser ) ;
1818 await page . waitForVisible ( "main" ) ;
1919
You can’t perform that action at this time.
0 commit comments