Skip to content

Latest commit

 

History

History
63 lines (36 loc) · 3.53 KB

README_TESTING.md

File metadata and controls

63 lines (36 loc) · 3.53 KB

Testing WebApp - Overview of Process

How to test Wevote WebApp with BrowserStack

If you haven't updated your dependencies in a while, run npm install to install or update WebdriverIO, a framework that lets us test the browser app and Cordova mobile apps with a single script.

Manual installation only

Copy WebApp/tests/browserstack_automation/config/browserstack.config.template.js into WebApp/tests/browserstack_automation/config/browserstack.config.js:

(WebAppEnv) $ cd WebApp
(WebAppEnv) $ cp tests/browserstack_automation/config/browserstack.config.template.js tests/browserstack_automation/config/browserstack.config.js

Automated installation start here

You'll need to add your credentials to browserstack.config.js. Sign into Browserstack and navigate to the BrowserStack Automate dashboard. Press the down arrow next to where it says "Access Key" in the header. You should see your username ("YOUR-USERNAME" below) and access key ("ACCESS-KEY-HERE" below). You will need both of these values to upload the compiled App.

You will also need the URL for the android app .apk file. You can get this by asking someone else or by uploading the file with Browserstack's REST API as described here. Visit this page when you are signed into Browserstack, and they will customize the command that you need to run from your terminal window:

curl -u "YOUR-USERNAME:ACCESS-KEY-HERE" -X POST https://api-cloud.browserstack.com/app-automate/upload -F "file=@/path/to/app/file/Application-debug.apk" -F 'data={"custom_id": "MyApp"}'

You can find the latest WeVote APK (for Android) and IPA (for iOS) in this Google Drive folder. Please download it to your Download folder. For example, to find this path on a Mac:

(WebAppEnv) $ cd ~/Downloads
(WebAppEnv) $ pwd
/Users/dalemcgrew/Downloads

In this example, the Android APK downloaded file is app-debug-5-29-19.apk. The full path to this downloaded file is now:

/Users/dalemcgrew/Downloads/app-debug-5-29-19.apk

So the terminal command to upload the file would look like this:

curl -u "YOUR-USERNAME:ACCESS-KEY-HERE" -X POST https://api-cloud.browserstack.com/app-automate/upload -F "file=@/Users/dalemcgrew/Downloads/app-debug-5-29-19.apk" -F 'data={"custom_id": "MyApp"}'

It will typically take 30-60 seconds to upload (without any feedback), and then return a path like this:

{"app_url":"bs://ANOTHER-GENERATED-STRING-HERE","custom_id":"MyApp","shareable_id":"dalemcgrew1/MyApp"}

Copy the path bs://ANOTHER-GENERATED-STRING-HERE into your browserstack.config.js file, and put it into the BROWSERSTACK_APK_URL value field like this:

BROWSERSTACK_APK_URL: 'bs://ANOTHER-GENERATED-STRING-HERE',

With this BROWSERSTACK_APK_URL variable set now, we just need to specify the capabilities or devices that we plan to run our mobile app on. To do so, run:

(WebAppEnv) $ npm run wdio:setup

Any capabilities will be stored in the capabilities directory.

To run any tests in the specs directory, run:

(WebAppEnv) $ npm run wdio

When the test finishes, you should be able to see the video of browser tests on the BrowserStack Automate dashboard and video of the mobile apps on BrowserStack App Automate.


Go back to Readme Home