Skip to content

Commit ca84180

Browse files
committed
- Updated ReadMe
- Updated Docker Compose - Updated BaseTest
1 parent 35c6dc5 commit ca84180

3 files changed

Lines changed: 50 additions & 41 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,18 @@ Note: The ChromeDriver version must match the Chrome browser version on your mac
278278
set BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
279279
```
280280
281-
Alternatively, you can also hardcode username and access_key objects in the [caps.json](resources/conf/caps/caps.json) file.
281+
Alternatively, you can also hardcode username and access_key objects in the [bs.json](resources/config/bs.json) file.
282282
283283
Note:
284-
- We have configured a list of test capabilities in the [caps.json](resources/conf/caps/caps.json) file. You can certainly update them based on your device / browser test requirements.
284+
- We have configured a list of test capabilities in the [bs.json](resources/config/bs.json) file. You can certainly update them based on your device / browser test requirements.
285285
- The exact test capability values can be easily identified using the [Browserstack Capability Generator](https://browserstack.com/automate/capabilities)
286286
287287
288288
## Running Your Tests
289289
290290
### Run a specific test on BrowserStack
291291
292-
In this section, we will run a single test on Chrome browser on Browserstack. To change test capabilities for this configuration, please refer to the `single` object in `caps.json` file.
292+
In this section, we will run a single test on Chrome browser on Browserstack. To change test capabilities for this configuration, please refer to the `single` object in `bs.json` file.
293293
294294
- How to run the test?
295295
@@ -328,7 +328,7 @@ In this section, we will run a single test on Chrome browser on Browserstack. To
328328
329329
### Run the entire test suite in parallel on a single BrowserStack browser
330330
331-
In this section, we will run the tests in parallel on a single browser on Browserstack. Refer to `single` object in `caps.json` file to change test capabilities for this configuration.
331+
In this section, we will run the tests in parallel on a single browser on Browserstack. Refer to `single` object in `bs.json` file to change test capabilities for this configuration.
332332
333333
- How to run the test?
334334
@@ -353,7 +353,7 @@ In this section, we will run the tests in parallel on a single browser on Browse
353353
354354
### Run the entire test suite in parallel on multiple BrowserStack browsers
355355
356-
In this section, we will run the tests in parallel on multiple browsers on Browserstack. Refer to the `parallel` object in `caps.json` file to change test capabilities for this configuration.
356+
In this section, we will run the tests in parallel on multiple browsers on Browserstack. Refer to the `parallel` object in `bs.json` file to change test capabilities for this configuration.
357357
358358
- How to run the test?
359359
@@ -378,7 +378,7 @@ In this section, we will run the tests in parallel on multiple browsers on Brows
378378
git clone https://github.com/browserstack/browserstack-demo-app
379379
```
380380
- Please follow the README.md on the BrowserStack demo application repository to install and start the dev server on localhost.
381-
- In this section, we will run a single test case to test the BrowserStack Demo app hosted on your local machine i.e. localhost. Refer to the `single_local` object in `caps.json` file to change test capabilities for this configuration.
381+
- In this section, we will run a single test case to test the BrowserStack Demo app hosted on your local machine i.e. localhost. Refer to the `single_local` object in `bs.json` file to change test capabilities for this configuration.
382382
- Note: You may need to provide additional BrowserStackLocal arguments to successfully connect your localhost environment with BrowserStack infrastructure. (e.g if you are behind firewalls, proxy or VPN).
383383
- Further details for successfully creating a BrowserStackLocal connection can be found here:
384384
@@ -425,7 +425,7 @@ In this section, we will run the tests in parallel on multiple browsers on Brows
425425
426426
### [Web application hosted on internal environment] Run the entire test suite in parallel on a single BrowserStack browser using BrowserStackLocal
427427
428-
In this section, we will run the test cases to test the internally hosted website in parallel on a single browser on Browserstack. Refer to the `single_local` object in `caps.json` file to change test capabilities for this configuration.
428+
In this section, we will run the test cases to test the internally hosted website in parallel on a single browser on Browserstack. Refer to the `single_local` object in `bs.json` file to change test capabilities for this configuration.
429429
430430
- How to run the test?
431431
@@ -448,7 +448,7 @@ In this section, we will run the test cases to test the internally hosted websit
448448
449449
### [Web application hosted on internal environment] Run the entire test suite in parallel on multiple BrowserStack browser using BrowserStackLocal
450450
451-
In this section, we will run the test cases to test the internally hosted website in parallel on multiple browsers on Browserstack. Refer to the `parallel_local` object in `caps.json` file to change test capabilities for this configuration.
451+
In this section, we will run the test cases to test the internally hosted website in parallel on multiple browsers on Browserstack. Refer to the `parallel_local` object in `bs.json` file to change test capabilities for this configuration.
452452
453453
- How to run the test?
454454

docker-compose.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
11
version: "3"
22
services:
3-
4-
hub:
5-
image: selenium/hub:latest
6-
ports:
7-
- "4444:4444"
8-
9-
environment:
10-
GRID_MAX_SESSION: 16
11-
GRID_BROWSER_TIMEOUT: 3000
12-
GRID_TIMEOUT: 3000
13-
143
chrome:
15-
image: selenium/node-chrome
16-
container_name: web-automation_chrome
17-
environment:
18-
HUB_PORT_4444_TCP_ADDR: hub
19-
HUB_PORT_4444_TCP_PORT: 4444
20-
NODE_MAX_SESSION: 4
21-
NODE_MAX_INSTANCES: 4
4+
image: selenium/node-chrome:4.0.0
225
volumes:
236
- /dev/shm:/dev/shm
24-
ports:
25-
- "9001:5900"
7+
depends_on:
8+
- selenium-hub
9+
environment:
10+
- SE_EVENT_BUS_HOST=selenium-hub
11+
- SE_EVENT_BUS_PUBLISH_PORT=4442
12+
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
13+
- SCREEN_WIDTH=2880
14+
- SCREEN_HEIGHT=1800
2615
links:
27-
- hub
16+
- selenium-hub:hub
17+
scale: 4
2818

2919
firefox:
30-
image: selenium/node-firefox
31-
container_name: web-automation_firefox
32-
environment:
33-
HUB_PORT_4444_TCP_ADDR: hub
34-
HUB_PORT_4444_TCP_PORT: 4444
35-
NODE_MAX_SESSION: 2
36-
NODE_MAX_INSTANCES: 2
20+
image: selenium/node-firefox:4.0.0
3721
volumes:
3822
- /dev/shm:/dev/shm
39-
ports:
40-
- "9002:5900"
23+
depends_on:
24+
- selenium-hub
25+
environment:
26+
- SE_EVENT_BUS_HOST=selenium-hub
27+
- SE_EVENT_BUS_PUBLISH_PORT=4442
28+
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
29+
- SCREEN_WIDTH=2880
30+
- SCREEN_HEIGHT=1800
4131
links:
42-
- hub
32+
- selenium-hub:hub
33+
scale: 4
34+
35+
selenium-hub:
36+
image: selenium/hub:4.0.0
37+
container_name: selenium-hub
38+
environment:
39+
- GRID_MAX_SESSION=50
40+
ports:
41+
- "4442:4442"
42+
- "4443:4443"
43+
- "4444:4444"

src/test/java/browserstack/stepdefs/BaseTest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,20 @@ private void setupLocal(DesiredCapabilities caps, JSONObject testConfigs, String
151151
if(!local.isRunning())
152152
{
153153

154-
UUID uuid = UUID.randomUUID();
154+
/* UUID uuid = UUID.randomUUID();
155155
caps.setCapability("browserstack.localIdentifier", uuid.toString());
156156
options = new HashMap<String, String>();
157157
options.put("key", accessKey);
158158
options.put("localIdentifier", uuid.toString());
159-
local.start(options);
159+
local.start(options);*/
160+
161+
// You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY".
162+
HashMap<String, String> bsLocalArgs = new HashMap<String, String>();
163+
bsLocalArgs.put("key", accessKey);
164+
165+
// Starts the Local instance with the required arguments
166+
local.start(bsLocalArgs);
167+
160168
}
161169

162170
}

0 commit comments

Comments
 (0)