File tree Expand file tree Collapse file tree 5 files changed +21
-2
lines changed Expand file tree Collapse file tree 5 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ const log = s => process.stderr.write(`\x1b[1m=> TEST: \x1b[0;33m${s}\x1b[0m`);
3737
3838 // Go to http://localhost:8080/
3939 await page . goto ( `http://${ host } :${ port } /` ) ;
40+ // Wait for vaadin ready
41+ await page . waitForSelector ( '#outlet > * > *:not(style):not(script)' ) ;
4042
4143 await takeScreenshot ( page , 'initial-view' ) ;
4244 // Click input[type="text"]
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ let mode, version;
4646const args = ( ) => {
4747 const ret = {
4848 headless : false ,
49- port : '8000 ' ,
49+ port : '8080 ' ,
5050 host : 'localhost' ,
5151 pass : 'Servantes' ,
5252 ignoreHTTPSErrors : false ,
@@ -80,6 +80,8 @@ const args = () => {
8080 version = ret . version = a . split ( '=' ) [ 1 ] ;
8181 } else if ( / ^ - - p r e f i x = / . test ( a ) ) {
8282 ret . prefix = a . split ( '=' ) [ 1 ] ;
83+ } else if ( / ^ - - n a m e = / . test ( a ) ) {
84+ ret . name = a . split ( '=' ) [ 1 ] ;
8385 }
8486 } ) ;
8587 if ( ! ret . url ) {
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ Use: $0 with the next options:
2323 --skip-clean Do not clean maven cache
2424 --skip-helm Do not re-install control-center with helm and continue running tests, implies (--offline, --keep-cc)
2525 --skip-pw Do not run playwright tests
26+ --screenshots Save screenshots before and after running tests (useful to visit them after theming changes)
2627 --cluster=name Run tests in an existing k8s cluster
2728 --vendor=name Use a specific cluster vendor to run control-center tests options: [dd, kind, do] (default: kind)
2829 --keep-cc Keep control-center running after tests
@@ -83,6 +84,7 @@ checkArgs() {
8384 --skip-dev) NODEV=true;;
8485 --skip-prod) NOPROD=true;;
8586 --skip-pw) SKIPPW=true;;
87+ --screenshots) SCREENSHOTS=true;;
8688 --cluster=* ) CLUSTER=" $arg " ;;
8789 --vendor=* )
8890 VENDOR=" $arg "
Original file line number Diff line number Diff line change 11PIT_SCR_FOLDER=` computeAbsolutePath`
2+ SCRSHT=" $PIT_SCR_FOLDER /its/screenshot.js"
23
34# # LIBRARY for installing and running playwright tests
45
@@ -60,3 +61,4 @@ runPlaywrightTests() {
6061 return $err
6162}
6263
64+
Original file line number Diff line number Diff line change @@ -111,7 +111,18 @@ runValidations() {
111111
112112 # 11
113113 if [ -n " $test " -a -z " $SKIPTESTS " -a -z " $SKIPPW " ]; then
114- runPlaywrightTests " $test " " $file " " $mode " " $name " " $version " " --port=$port " || return 1
114+ # Take screenshot before running tests
115+ [ -n " $SCREENSHOTS " ] && runPlaywrightTests " $SCRSHT " " $file " " $mode " " $name " " $version " " --port=$port " " --prefix=_before"
116+
117+ runPlaywrightTests " $test " " $file " " $mode " " $name " " $version " " --port=$port "
118+ test_result=$?
119+
120+ # Take screenshot after tests succeed
121+ [ -n " $SCREENSHOTS " -a $test_result = 0 ] && runPlaywrightTests " $SCRSHT " " $file " " $mode " " $name " " $version " " --port=$port " " --prefix=_after"
122+
123+
124+ # Return the test result
125+ [ $test_result != 0 ] && return 1
115126 elif [ -n " $TEST " ]; then
116127 cmd " ## No PW tests to run"
117128 fi
You can’t perform that action at this time.
0 commit comments