File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,3 +3,4 @@ local.log
33vendor /
44bin /
55.DS_Store
6+ browserstack.err
Original file line number Diff line number Diff line change 55 "php-webdriver/webdriver" : " 1.14.0"
66 },
77 "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"
1110 },
1211 "autoload" : {
1312 "classmap" : [" lib/" ]
Load diff This file was deleted.
Load diff This file was deleted.
Original file line number Diff line number Diff line change 99 "os" : " OS X" ,
1010 "osVersion" : " Monterey" ,
1111 "buildName" : " browserstack-build-1" ,
12- "sessionName" : " BStack phpunit parallel chrome"
12+ "sessionName" : " BStack phpunit chrome" ,
13+ "local" : true
1314 }
1415 }, {
1516 "browserName" : " edge" ,
1819 "os" : " Windows" ,
1920 "osVersion" : " 11" ,
2021 "buildName" : " browserstack-build-1" ,
21- "sessionName" : " BStack phpunit parallel edge"
22+ "sessionName" : " BStack phpunit edge" ,
23+ "local" : true
2224 }
2325 }, {
2426 "browserName" : " chrome" ,
2527 "bstack:options" : {
2628 "osVersion" : " 12.0" ,
2729 "deviceName" : " Samsung Galaxy S22 Ultra" ,
2830 "buildName" : " browserstack-build-1" ,
29- "sessionName" : " BStack phpunit parallel android"
31+ "sessionName" : " BStack phpunit android" ,
32+ "local" : true
3033 }
3134 }]
3235}
Original file line number Diff line number Diff line change @@ -15,26 +15,11 @@ public static function setUpBeforeClass(): void {
1515 $ url = "https:// {$ GLOBALS ['BROWSERSTACK_USERNAME ' ]}: {$ GLOBALS ['BROWSERSTACK_ACCESS_KEY ' ]}@hub.browserstack.com/wd/hub " ;
1616 $ caps = $ CONFIG ['capabilities ' ][$ task_id ];
1717
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-
2918 self ::$ driver = RemoteWebDriver::create ($ url , $ caps );
3019 }
3120
3221 public static function tearDownAfterClass (): void {
3322 self ::$ driver ->quit ();
34- if (self ::$ bs_local ) {
35- print ("Stopping local binary.. \n" );
36- self ::$ bs_local ->stop ();
37- }
3823 }
3924}
4025?>
Original file line number Diff line number Diff line change 11<?php
22$ config_file = getenv ('CONFIG_FILE ' );
33if (!$ config_file ) {
4- $ config_file = 'config/single .conf.json ' ;
4+ $ config_file = 'config/test .conf.json ' ;
55}
66$ GLOBALS ['CONFIG ' ] = json_decode (file_get_contents ($ config_file ), true );
77
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 22require_once ('vendor/autoload.php ' );
33
44class 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+
911}
1012?>
You can’t perform that action at this time.
0 commit comments