Skip to content

Commit 11bdb88

Browse files
authored
Merge pull request #27 from browserstack/merge_sdk_to_master
Merge sdk to master
2 parents 0959437 + b20cf84 commit 11bdb88

21 files changed

+8583
-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: 10 additions & 52 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,25 @@ 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
43+
Open `Android` or in `ios` folder
8644

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.
45+
- Ensure that `browserstackLocal` capability is set to `true` in the `browserstack.yml` file.
8846

89-
- If you have uploaded your own app update the test case
47+
- 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.
9048

91-
- Run `node BrowserStackSampleLocal.js`
49+
- Run `npm run sample-local-test`
9250

9351
- 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)
9452

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: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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 `name` to set the session name
16+
name: BStack android test
17+
# Set `buildName` as the name of the job / testsuite being run
18+
buildName: browserstack build
19+
# `buildIdentifier` is a unique id to differentiate every execution that gets appended to
20+
# buildName. Choose your buildIdentifier format from the available expressions:
21+
# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution
22+
# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30
23+
# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests
24+
buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression}
25+
26+
source: node:appium-sample-sdk:v1.0
27+
28+
# Set `app` to define the app that is to be used for testing.
29+
# It can either take the id of any uploaded app or the path of the app directly.
30+
app: ./WikipediaSample.apk
31+
# app: ./LocalSample.apk #For running local tests
32+
33+
# =======================================
34+
# Platforms (Browsers / Devices to test)
35+
# =======================================
36+
# Platforms object contains all the browser / device combinations you want to test on.
37+
# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
38+
39+
platforms:
40+
- deviceName: Samsung Galaxy S22 Ultra
41+
osVersion: 12.0
42+
platformName: android
43+
- deviceName: OnePlus 9
44+
osVersion: 11.0
45+
platformName: android
46+
- deviceName: Google Pixel 6 Pro
47+
osVersion: 12.0
48+
platformName: android
49+
50+
# ==========================================
51+
# BrowserStack Local
52+
# (For localhost, staging/private websites)
53+
# ==========================================
54+
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
55+
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
56+
browserstackLocal: true # <boolean> (Default false)
57+
#browserStackLocalOptions:
58+
#Options to be passed to BrowserStack local in-case of advanced configurations
59+
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
60+
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
61+
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
62+
63+
# ===================
64+
# Debugging features
65+
# ===================
66+
debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran
67+
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
68+
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
69+
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)

0 commit comments

Comments
 (0)