File tree Expand file tree Collapse file tree 11 files changed +60
-80
lines changed Expand file tree Collapse file tree 11 files changed +60
-80
lines changed Original file line number Diff line number Diff line change @@ -3,3 +3,4 @@ local.log
3
3
vendor /
4
4
bin /
5
5
.DS_Store
6
+ browserstack.err
Original file line number Diff line number Diff line change 5
5
"php-webdriver/webdriver" : " 1.14.0"
6
6
},
7
7
"scripts" : {
8
- "single" : " CONFIG_FILE=config/single.conf.json vendor/bin/phpunit tests/SingleTest.php" ,
9
- "local" : " CONFIG_FILE=config/local.conf.json vendor/bin/phpunit tests/LocalTest.php" ,
10
- "parallel" : " CONFIG_FILE=config/parallel.conf.json /usr/bin/env php lib/parallel.php"
8
+ "local" : " CONFIG_FILE=config/test.conf.json TEST_FILE=tests/LocalTest.php /usr/bin/env php lib/runner.php" ,
9
+ "test" : " CONFIG_FILE=config/test.conf.json TEST_FILE=tests/Test.php /usr/bin/env php lib/runner.php"
11
10
},
12
11
"autoload" : {
13
12
"classmap" : [" lib/" ]
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 9
9
"os" : " OS X" ,
10
10
"osVersion" : " Monterey" ,
11
11
"buildName" : " browserstack-build-1" ,
12
- "sessionName" : " BStack phpunit parallel chrome"
12
+ "sessionName" : " BStack phpunit chrome" ,
13
+ "local" : true
13
14
}
14
15
}, {
15
16
"browserName" : " edge" ,
18
19
"os" : " Windows" ,
19
20
"osVersion" : " 11" ,
20
21
"buildName" : " browserstack-build-1" ,
21
- "sessionName" : " BStack phpunit parallel edge"
22
+ "sessionName" : " BStack phpunit edge" ,
23
+ "local" : true
22
24
}
23
25
}, {
24
26
"browserName" : " chrome" ,
25
27
"bstack:options" : {
26
28
"osVersion" : " 12.0" ,
27
29
"deviceName" : " Samsung Galaxy S22 Ultra" ,
28
30
"buildName" : " browserstack-build-1" ,
29
- "sessionName" : " BStack phpunit parallel android"
31
+ "sessionName" : " BStack phpunit android" ,
32
+ "local" : true
30
33
}
31
34
}]
32
35
}
Original file line number Diff line number Diff line change @@ -15,26 +15,11 @@ public static function setUpBeforeClass(): void {
15
15
$ url = "https:// {$ GLOBALS ['BROWSERSTACK_USERNAME ' ]}: {$ GLOBALS ['BROWSERSTACK_ACCESS_KEY ' ]}@hub.browserstack.com/wd/hub " ;
16
16
$ caps = $ CONFIG ['capabilities ' ][$ task_id ];
17
17
18
- if (array_key_exists ("local " , $ caps ["bstack:options " ]) && $ caps ["bstack:options " ])
19
- {
20
- $ bs_local_args = array ("key " => $ GLOBALS ['BROWSERSTACK_ACCESS_KEY ' ]);
21
- self ::$ bs_local = new BrowserStack \Local ();
22
- print ("Starting Local Binary... \n" );
23
- self ::$ bs_local ->start ($ bs_local_args );
24
- if (self ::$ bs_local ->isRunning ()) {
25
- print ("Local binary successfuly started! \n" );
26
- }
27
- }
28
-
29
18
self ::$ driver = RemoteWebDriver::create ($ url , $ caps );
30
19
}
31
20
32
21
public static function tearDownAfterClass (): void {
33
22
self ::$ driver ->quit ();
34
- if (self ::$ bs_local ) {
35
- print ("Stopping local binary.. \n" );
36
- self ::$ bs_local ->stop ();
37
- }
38
23
}
39
24
}
40
25
?>
Original file line number Diff line number Diff line change 1
1
<?php
2
2
$ config_file = getenv ('CONFIG_FILE ' );
3
3
if (!$ config_file ) {
4
- $ config_file = 'config/single .conf.json ' ;
4
+ $ config_file = 'config/test .conf.json ' ;
5
5
}
6
6
$ GLOBALS ['CONFIG ' ] = json_decode (file_get_contents ($ config_file ), true );
7
7
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ require_once ('vendor/autoload.php ' );
4
+ require_once ('lib/globals.php ' );
5
+
6
+ $ CONFIG = $ GLOBALS ['CONFIG ' ];
7
+ $ procs = array ();
8
+
9
+ $ test_file = getenv ('TEST_FILE ' );
10
+ if (!$ test_file ) {
11
+ $ test_file = 'tests/Test.php ' ;
12
+ }
13
+
14
+ try {
15
+ $ bs_local_args = array ("key " => $ GLOBALS ['BROWSERSTACK_ACCESS_KEY ' ]);
16
+ $ bs_local = new BrowserStack \Local ();
17
+ print ("\nStarting Local Binary... \n" );
18
+ $ bs_local ->start ($ bs_local_args );
19
+ if ($ bs_local ->isRunning ()) {
20
+ print ("Local binary successfuly started! \n\n" );
21
+ }
22
+ foreach ($ CONFIG ['capabilities ' ] as $ key => $ value ) {
23
+ $ cmd = "TASK_ID= $ key vendor/bin/phpunit $ test_file 2>&1 \n" ;
24
+ print_r ($ cmd );
25
+
26
+ $ procs [$ key ] = popen ($ cmd , "r " );
27
+ }
28
+ foreach ($ procs as $ key => $ value ) {
29
+ while (!feof ($ value )) {
30
+ print fgets ($ value , 4096 );
31
+ }
32
+ pclose ($ value );
33
+ }
34
+ } catch (Exception $ e ) {
35
+ echo $ e ->getMessage ();
36
+ } finally {
37
+ if ($ bs_local ) {
38
+ print ("\nStopping local binary.. \n" );
39
+ $ bs_local ->stop ();
40
+ }
41
+ }
42
+
43
+ ?>
Original file line number Diff line number Diff line change 2
2
require_once ('vendor/autoload.php ' );
3
3
4
4
class LocalTest extends BrowserStackTest {
5
- public function testLocal () {
6
- self ::$ driver ->get ("http://bs-local.com:45454 " );
7
- $ this ->assertStringContainsString ('BrowserStack Local ' , self ::$ driver ->getTitle ());
8
- }
5
+
6
+ public function testLocal () {
7
+ self ::$ driver ->get ("http://bs-local.com:45454 " );
8
+ $ this ->assertStringContainsString ('BrowserStack Local ' , self ::$ driver ->getTitle ());
9
+ }
10
+
9
11
}
10
12
?>
Original file line number Diff line number Diff line change @@ -16,5 +16,6 @@ public function testBrowserstackDemo() {
16
16
// assert item in cart is same as one that was added
17
17
$ this ->assertEquals ($ item_to_add , $ item_in_cart );
18
18
}
19
+
19
20
}
20
21
?>
You can’t perform that action at this time.
0 commit comments