Skip to content

Commit d042b66

Browse files
authored
Merge pull request #6 from browserstack/merge_sdk_to_main
Merge sdk to main
2 parents 594c18d + a3a11a6 commit d042b66

File tree

12 files changed

+115
-347
lines changed

12 files changed

+115
-347
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__pycache__
2+
.pytest_cache/
3+
local.log
4+
env

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @browserstack/afd-dev
1+
* @browserstack/automate-public-repos

README.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,14 @@ Playwright with PyTest Test runner Integration with BrowserStack.
1010

1111
* Clone the repo
1212
* Install dependencies `pip install -r requirements.txt`
13-
* To run your automated tests using BrowserStack, you must provide a valid username and access key. This can be done by setting the BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables.
13+
* To run your automated tests using BrowserStack, you must provide a valid username and access key. This can be done adding your userName and accesKey in the `browserstack.yml` file.
14+
* You can also set the credentials in BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables.
1415

1516
## Run sample tests
16-
* To run parallel tests, run `paver run sample-test remote`
17+
* To run tests, run `browserstack-sdk pytest -s tests/sample-test.py`
18+
* To run local tests, run `browserstack-sdk pytest -s tests/sample-local-test.py`.
1719

18-
## Run tests on locally hosted websites
19-
* To run a local test, (if you have not set the BROWSERSTACK_ACCESS_KEY environment variable) first go to resources/local.json then edit key on line 3
20-
* Run `paver run sample-local-test remote`
21-
22-
23-
## Run sample tests locally
24-
* To run tests locally you may have to install the browser dependencies.
25-
* For example, if you want to run the test on Firefox browser, you have to run the below command
26-
27-
```
28-
playwright install firefox
29-
30-
```
31-
32-
* After installing the browsers, run `paver run sample-test on-prem`
33-
34-
35-
Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)
20+
## Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)
3621

3722
## Notes
38-
* You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate)
23+
* You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate)

browserstack.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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: YOUR_USERNAME
7+
accessKey: YOUR_ACCESS_KEY
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+
useW3C: false
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: Windows
34+
osVersion: 11
35+
browserName: chrome
36+
browserVersion: latest
37+
- os: OS X
38+
osVersion: Ventura
39+
browserName: playwright-webkit
40+
browserVersion: latest
41+
- os: Windows
42+
osVersion: 11
43+
browserName: playwright-firefox
44+
browserVersion: latest
45+
# =======================
46+
# Parallels per Platform
47+
# =======================
48+
# The number of parallel threads to be used for each platform set.
49+
# BrowserStack's SDK runner will select the best strategy based on the configured value
50+
#
51+
# 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
52+
#
53+
# 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
54+
parallelsPerPlatform: 1
55+
56+
# ==========================================
57+
# BrowserStack Local
58+
# (For localhost, staging/private websites)
59+
# ==========================================
60+
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
61+
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
62+
browserstackLocal: true # <boolean> (Default false)
63+
# browserStackLocalOptions:
64+
# Options to be passed to BrowserStack local in-case of advanced configurations
65+
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
66+
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
67+
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
68+
69+
source: pytest-playwright-browserstack:sample-sdk:v1.0
70+
71+
# ===================
72+
# Debugging features
73+
# ===================
74+
debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran
75+
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
76+
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
77+
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)

conftest.py

Lines changed: 0 additions & 85 deletions
This file was deleted.

pavement.py

Lines changed: 0 additions & 113 deletions
This file was deleted.

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
browserstack-local
22
jsonmerge
33
multiprocess
4-
paver
54
playwright
65
pytest-playwright
76
psutil
8-
pytest
7+
pytest==7.4.4
98
pytest-variables
109
pytest-xdist
1110
pytest-base-url
12-
python-dotenv
11+
python-dotenv
12+
browserstack-sdk

resources/local.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)