Skip to content

Commit d5f2d33

Browse files
committed
SDK updated2
1 parent 3a42d6c commit d5f2d33

File tree

10 files changed

+151
-24
lines changed

10 files changed

+151
-24
lines changed

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ In this section, we will run the tests in parallel on a browser on Browserstack.
8787

8888
- How to run the test?
8989

90-
To run the entire test suite in parallel on a BrowserStack browser, update the 'platforms' in the browserstack.yml file &
91-
92-
use the following command:
90+
To run the entire test suite in parallel on a BrowserStack browser, use the following command:
9391

9492
```sh
95-
browserstack-sdk pytest -s src/test/suites/*.py
93+
browserstack-sdk pytest -s src/test/suites/*.py --browserstack.config=./browserstack_single.yml
9694
```
9795

9896
- Output
@@ -105,10 +103,10 @@ In this section, we will run the tests in parallel on multiple browsers on Brows
105103

106104
- How to run the test?
107105

108-
To run the entire test suite in parallel on multiple BrowserStack browsers, update the 'parallelsperplatform' in the browserstack.yml file & use the following command:
106+
To run the entire test suite in parallel on multiple BrowserStack browsers, use the following command:
109107

110108
```sh
111-
browserstack-sdk pytest -s src/test/suites/*.py
109+
browserstack-sdk pytest -s src/test/suites/*.py --browserstack.config=./browserstack_parallel.yml
112110
```
113111
### [Web application hosted on internal environment] Running your tests on BrowserStack using BrowserStackLocal
114112

@@ -132,7 +130,7 @@ In this section, we will run the tests in parallel on multiple browsers on Brows
132130
- To run the default test scenario (e.g. End to End Scenario) on a single BrowserStack browser using BrowserStackLocal, update the 'browserstackLocal' in the browserstack.yml file & use the following command:
133131

134132
```sh
135-
browserstack-sdk pytest -s src/test/suites/*.py
133+
browserstack-sdk pytest -s src/test/suites/*.py --browserstack.config=./browserstack_local.yml
136134
```
137135

138136
- Output

browserstack_local.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# =============================
2+
# Set BrowserStack Credentials
3+
# =============================
4+
# Add your BrowserStack userName and accessKey here or set BROWSERSTACK_USERNAME and
5+
# BROWSERSTACK_ACCESS_KEY as env variables
6+
userName:
7+
accessKey:
8+
9+
# ======================
10+
# BrowserStack Reporting
11+
# ======================
12+
# The following capabilities are used to set up reporting on BrowserStack:
13+
# Set 'projectName' to the name of your project. Example, Marketing Website
14+
projectName: BrowserStack Samples
15+
# Set `buildName` as the name of the job / testsuite being run
16+
buildName: browserstack build
17+
# `buildIdentifier` is a unique id to differentiate every execution that gets appended to
18+
# buildName. Choose your buildIdentifier format from the available expressions:
19+
# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution
20+
# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30
21+
# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests
22+
buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression}
23+
# Set `framework` of your test suite. Example, `testng`, `cucumber`, `cucumber-testng`
24+
# This property is needed to send test context to BrowserStack (test name, status)
25+
framework: pytest
26+
27+
# =======================================
28+
# Platforms (Browsers / Devices to test)
29+
# =======================================
30+
# Platforms object contains all the browser / device combinations you want to test on.
31+
# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
32+
platforms:
33+
- os: OS X
34+
osVersion: Big Sur
35+
browserName: Chrome
36+
browserVersion: latest
37+
38+
# =======================
39+
# Parallels per Platform
40+
# =======================
41+
# The number of parallel threads to be used for each platform set.
42+
# BrowserStack's SDK runner will select the best strategy based on the configured value
43+
#
44+
# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack
45+
#
46+
# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack
47+
parallelsPerPlatform: 1
48+
49+
# ==========================================
50+
# BrowserStack Local
51+
# (For localhost, staging/private websites)
52+
# ==========================================
53+
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
54+
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
55+
browserstackLocal: true # <boolean> (Default false)
56+
# browserStackLocalOptions:
57+
# Options to be passed to BrowserStack local in-case of advanced configurations
58+
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
59+
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
60+
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
61+
62+
# ===================
63+
# Debugging features
64+
# ===================
65+
debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran
66+
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
67+
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
68+
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)

browserstack.yml renamed to browserstack_parallel.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# =============================
44
# Add your BrowserStack userName and accessKey here or set BROWSERSTACK_USERNAME and
55
# BROWSERSTACK_ACCESS_KEY as env variables
6-
userName: abisheksurendrab_vKBnUQ
7-
accessKey: XeYLV5ZHsViiFXVFuBqx
6+
userName:
7+
accessKey:
88

99
# ======================
1010
# BrowserStack Reporting
@@ -48,7 +48,7 @@ platforms:
4848
# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack
4949
#
5050
# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack
51-
parallelsPerPlatform: 1
51+
parallelsPerPlatform: 2
5252

5353
# ==========================================
5454
# BrowserStack Local

browserstack_single.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# =============================
2+
# Set BrowserStack Credentials
3+
# =============================
4+
# Add your BrowserStack userName and accessKey here or set BROWSERSTACK_USERNAME and
5+
# BROWSERSTACK_ACCESS_KEY as env variables
6+
userName:
7+
accessKey:
8+
9+
# ======================
10+
# BrowserStack Reporting
11+
# ======================
12+
# The following capabilities are used to set up reporting on BrowserStack:
13+
# Set 'projectName' to the name of your project. Example, Marketing Website
14+
projectName: BrowserStack Samples
15+
# Set `buildName` as the name of the job / testsuite being run
16+
buildName: browserstack build
17+
# `buildIdentifier` is a unique id to differentiate every execution that gets appended to
18+
# buildName. Choose your buildIdentifier format from the available expressions:
19+
# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution
20+
# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30
21+
# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests
22+
buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression}
23+
# Set `framework` of your test suite. Example, `testng`, `cucumber`, `cucumber-testng`
24+
# This property is needed to send test context to BrowserStack (test name, status)
25+
framework: pytest
26+
27+
# =======================================
28+
# Platforms (Browsers / Devices to test)
29+
# =======================================
30+
# Platforms object contains all the browser / device combinations you want to test on.
31+
# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
32+
platforms:
33+
- os: OS X
34+
osVersion: Big Sur
35+
browserName: Chrome
36+
browserVersion: latest
37+
38+
# =======================
39+
# Parallels per Platform
40+
# =======================
41+
# The number of parallel threads to be used for each platform set.
42+
# BrowserStack's SDK runner will select the best strategy based on the configured value
43+
#
44+
# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack
45+
#
46+
# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack
47+
parallelsPerPlatform: 1
48+
49+
# ==========================================
50+
# BrowserStack Local
51+
# (For localhost, staging/private websites)
52+
# ==========================================
53+
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
54+
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
55+
browserstackLocal: false # <boolean> (Default false)
56+
# browserStackLocalOptions:
57+
# Options to be passed to BrowserStack local in-case of advanced configurations
58+
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
59+
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
60+
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
61+
62+
# ===================
63+
# Debugging features
64+
# ===================
65+
debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran
66+
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
67+
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
68+
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)

src/test/suites/addToCart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66

77
@pytest.mark.nondestructive
8-
def test_example(driver, base_url):
8+
def test_example(driver, base_url="https://bstackdemo.com/"):
99
driver.get(base_url)
1010

1111
# locating product on webpage and getting name of the product

src/test/suites/e2e.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,4 @@ def test_e2e(driver, base_url="https://bstackdemo.com/"):
3838
orders = OrdersPage(driver)
3939
status = orders.verify_orders_placed()
4040
time.sleep(5)
41-
#if os.environ['REMOTE'] == "true":
42-
# driver.execute_script('browserstack_executor: {"action": "setSessionName", "arguments": {"name":"e2e_test"}}')
43-
# if status:
44-
# driver.execute_script('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": "Test Passed Successfully"}}')
45-
# else:
46-
# driver.execute_script('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "Order Not Placed Successfully"}}')
47-
48-
41+

src/test/suites/login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_login(driver, base_url):
2121

2222

2323
@pytest.mark.nondestructive
24-
def test_login_locked_user(driver, base_url):
24+
def test_login_locked_user(driver, base_url="https://bstackdemo.com/"):
2525
login = LoginPage(driver)
2626
login.open_base_url(base_url)
2727
login.sign_in("locked_user","testingisfun99")

src/test/suites/offers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
@pytest.mark.nondestructive
13-
def test_offers(driver, base_url):
13+
def test_offers(driver, base_url="https://bstackdemo.com/"):
1414
driver.get(base_url)
1515
driver.execute_script('navigator.geolocation.getCurrentPosition = function(success){ var position = { "coords":{"latitude":"1","longitude":"103"}}; success(position);}')
1616
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, 'signin')))

src/test/suites/product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_apple_filter(driver, base_url):
2222

2323

2424
@pytest.mark.nondestructive
25-
def test_price_filter(driver, base_url):
25+
def test_price_filter(driver, base_url="https://bstackdemo.com/"):
2626
login = LoginPage(driver)
2727
login.open_base_url(base_url)
2828
login.sign_in("fav_user","testingisfun99")

src/test/suites/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import os
1313

1414
@pytest.mark.nondestructive
15-
def test_existing_orders(driver, base_url):
15+
def test_existing_orders(driver, base_url="https://bstackdemo.com/"):
1616
login = LoginPage(driver)
1717
login.open_base_url(base_url)
1818
login.sign_in("existing_orders_user","testingisfun99")
@@ -23,7 +23,7 @@ def test_existing_orders(driver, base_url):
2323

2424

2525
@pytest.mark.nondestructive
26-
def test_no_image(driver, base_url):
26+
def test_no_image(driver, base_url="https://bstackdemo.com/"):
2727
login = LoginPage(driver)
2828
login.open_base_url(base_url)
2929
login.sign_in("image_not_loading_user","testingisfun99")

0 commit comments

Comments
 (0)