File tree Expand file tree Collapse file tree 5 files changed +24
-126
lines changed Expand file tree Collapse file tree 5 files changed +24
-126
lines changed Original file line number Diff line number Diff line change 1
1
node_modules
2
2
playwright-report
3
3
local.log
4
+ local.log
Original file line number Diff line number Diff line change @@ -5,20 +5,24 @@ const sleep = promisify(setTimeout);
5
5
const redColour = "\x1b[31m" ;
6
6
const whiteColour = "\x1b[0m" ;
7
7
module . exports = async ( ) => {
8
- console . log ( "Starting BrowserStackLocal ..." ) ;
9
- // Starts the Local instance with the required arguments
10
- let localResponseReceived = false ;
11
- bsLocal . start ( BS_LOCAL_ARGS , ( err ) => {
12
- if ( err ) {
13
- console . error (
14
- `${ redColour } Error starting BrowserStackLocal${ whiteColour } `
15
- ) ;
16
- } else {
17
- console . log ( "BrowserStackLocal Started" ) ;
8
+ if ( process . env . BROWSERSTACK_LOCAL === "true" ) {
9
+ console . log ( "Starting BrowserStackLocal ..." ) ;
10
+ // Starts the Local instance with the required arguments
11
+ let localResponseReceived = false ;
12
+ bsLocal . start ( BS_LOCAL_ARGS , ( err ) => {
13
+ if ( err ) {
14
+ console . error (
15
+ `${ redColour } Error starting BrowserStackLocal${ whiteColour } `
16
+ ) ;
17
+ } else {
18
+ console . log ( "BrowserStackLocal Started" ) ;
19
+ }
20
+ localResponseReceived = true ;
21
+ } ) ;
22
+ while ( ! localResponseReceived ) {
23
+ await sleep ( 1000 ) ;
18
24
}
19
- localResponseReceived = true ;
20
- } ) ;
21
- while ( ! localResponseReceived ) {
22
- await sleep ( 1000 ) ;
25
+ } else {
26
+ console . log ( "Skipping BrowserStackLocal..." ) ;
23
27
}
24
28
} ;
Original file line number Diff line number Diff line change 4
4
"description" : " " ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
- "sample-local-test" : " BROWSERSTACK_LOCAL=true npx playwright test tests/local_test.js --config=./playwright-local.config.js " ,
7
+ "sample-local-test" : " BROWSERSTACK_LOCAL=true npx playwright test tests/local_test.js" ,
8
8
"sample-test" : " npx playwright test tests/sample_test.js" ,
9
9
"mobile-test" : " npx playwright test tests/sample_test.js --project='chrome@Samsung Galaxy S22:13@browserstack'"
10
10
},
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ const config = {
16
16
testDir : "./tests" ,
17
17
testMatch : "**/*.js" ,
18
18
19
+ // Use globalSetup & globalTearedown only if browserstack.local = true
20
+ globalSetup : require . resolve ( "./global-setup" ) ,
21
+ globalTeardown : require . resolve ( "./global-teardown" ) ,
22
+
19
23
/* Maximum time one test can run for. */
20
24
timeout : 90 * 1000 ,
21
25
expect : {
You can’t perform that action at this time.
0 commit comments