Skip to content

Commit 6be0e78

Browse files
committed
Integrate with sdk
1 parent af5fe14 commit 6be0e78

21 files changed

+6759
-1245
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules/
2+
log/
3+
*.log

README.md

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ This repository demonstrates how to run Appium NodeJS tests on BrowserStack App
1717
To install the dependencies run the following command in the project's base directory :
1818

1919
```
20-
npm install
20+
- Open `Android` or in `ios` folder
21+
22+
- Run `npm install`
2123
```
2224

2325
## Getting Started
@@ -26,69 +28,23 @@ Getting Started with Appium tests in NodeJS on BrowserStack couldn't be easier!
2628

2729
### Run your first test :
2830

29-
**1. Upoad your Android or iOS App**
30-
31-
Upload your Android app (.apk or .aab file) or iOS app (.ipa file) to BrowserStack servers using our REST API. Here is an example cURL request :
32-
33-
```
34-
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
35-
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
36-
-F "file=@/path/to/apk/file"
37-
```
38-
39-
Ensure that @ symbol is prepended to the file path in the above request. Please note the `app_url` value returned in the API response. We will use this to set the application under test while configuring the test later on.
40-
41-
**Note**: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our [sample Android app](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) or [sample iOS app](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa).
42-
43-
**2. Configure and run your first test**
44-
45-
Open `BrowserStackSample.js` file in `Android` or in `ios` folder
46-
47-
- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials. Get your BrowserStack access credentials from [here](https://www.browserstack.com/accounts/settings)
48-
49-
- Replace `bs://<app-id>` wkth the URL obtained from app upload step
50-
51-
- Set the device and OS version
31+
Open `Android` or in `ios` folder
5232

53-
- If you have uploaded your own app update the test case
33+
- If you have uploaded your app then add the app id to the `browserstack.yml` config file, or you can directly specify the path to your app in the `browserstack.yml` file.
5434

55-
- Run `node BrowserStackSample.js`
35+
- Run `npm run sample-test`
5636

5737
- You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard)
5838

5939
---
6040

6141
### **Use Local testing for apps that access resources hosted in development or testing environments :**
6242

63-
**1. Upload your Android or iOS App**
64-
65-
Upload your Android app (.apk or .aab file) or iOS app (.ipa file) that access resources hosted on your internal or test environments to BrowserStack servers using our REST API. Here is an example cURL request :
66-
67-
```
68-
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
69-
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
70-
-F "file=@/path/to/apk/file"
71-
```
72-
73-
Ensure that @ symbol is prepended to the file path in the above request. Please note the `app_url` value returned in the API response. We will use this to set the application under test while configuring the test later on.
74-
75-
**Note**: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our [sample Android Local app](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk) or [sample iOS Local app](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa).
76-
77-
**2. Configure and run your local tes**
78-
79-
Open `BrowserStackSampleLocal.js` file in `Android` or in `ios` folder
80-
81-
- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials. Get your BrowserStack access credentials from [here](https://www.browserstack.com/accounts/settings)
82-
83-
- Replace `bs://<app-id>` wkth the URL obtained from app upload step
84-
85-
- Set the device and OS version
86-
87-
- Ensure that `browserstack.local` capability is set to `true`. Within the test script, there is code snippet that automatically establishes Local Testing connection to BrowserStack servers using Javascript binding for BrowserStack Local.
43+
Open `Android` or in `ios` folder
8844

89-
- If you have uploaded your own app update the test case
45+
- If you have uploaded your app then add the app id to the `browserstack.yml` config file, or you can directly specify the path to your app in the `browserstack.yml` file.
9046

91-
- Run `node BrowserStackSampleLocal.js`
47+
- Run `browserstack-sdk python browserstack_sample.py`
9248

9349
- You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard)
9450

android/BrowserStackSample.js

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

android/BrowserStackSampleLocal.js

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

android/LocalSample.apk

3.84 MB
Binary file not shown.

android/WikipediaSample.apk

19.4 MB
Binary file not shown.

android/browserstack.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# =============================
2+
# Set BrowserStack Credentials
3+
# =============================
4+
# Add your BrowserStack userName and acccessKey here or set BROWSERSTACK_USERNAME and
5+
# BROWSERSTACK_ACCESS_KEY as env variables
6+
userName: BROWSERSTACK_USERNAME
7+
accessKey: BROWSERSTACK_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+
24+
source: node:appium-sample-sdk:v1.0
25+
26+
# Set `app` to define the app that is to be used for testing.
27+
# It can either take the id of any uploaded app or the path of the app directly.
28+
app: ./WikipediaSample.apk
29+
# app: ./LocalSample.apk #For running local tests
30+
31+
# =======================================
32+
# Platforms (Browsers / Devices to test)
33+
# =======================================
34+
# Platforms object contains all the browser / device combinations you want to test on.
35+
# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
36+
37+
platforms:
38+
- deviceName: Samsung Galaxy S22 Ultra
39+
osVersion: 12.0
40+
platformName: android
41+
- deviceName: Samsung Galaxy S21
42+
osVersion: 11.0
43+
platformName: android
44+
- deviceName: Google Pixel 6 Pro
45+
osVersion: 12.0
46+
platformName: android
47+
48+
# =======================
49+
# Parallels per Platform
50+
# =======================
51+
# The number of parallel threads to be used for each platform set.
52+
# BrowserStack's SDK runner will select the best strategy based on the configured value
53+
#
54+
# 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
55+
#
56+
# 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
57+
parallelsPerPlatform: 1
58+
59+
# ==========================================
60+
# BrowserStack Local
61+
# (For localhost, staging/private websites)
62+
# ==========================================
63+
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
64+
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
65+
browserstackLocal: true # <boolean> (Default false)
66+
#browserStackLocalOptions:
67+
#Options to be passed to BrowserStack local in-case of advanced configurations
68+
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
69+
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
70+
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
71+
72+
# ===================
73+
# Debugging features
74+
# ===================
75+
debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran
76+
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
77+
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
78+
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)

0 commit comments

Comments
 (0)