Skip to content

7ynk3r/react_native_appium

Repository files navigation

React Native E2E Testing with Appium on Sauce Labs

This code was created based on https://medium.com/@7ynk3r/react-native-e2e-testing-with-appium-on-sauce-labs-8920195b8a54

Setup

  1. Install all depedencies: yarn
  2. Create the release versions
    1. iOS: react-native run-ios --configuration Release
    2. Android: react-native run-android --variant=release
  3. Create an account in Sauce Labs
  4. Get your user name and access key at https://saucelabs.com/beta/user-settings
  5. Create secret.json at the root level with
{
  "YOUR_SAUCE_USERNAME": "[USER_NAME]",
  "YOUR_SAUCE_ACCESS_KEY": "[USER_ACCESS_KEY]"
}

Running the tests

Locally

  1. Update test-config/capabilities.js with the absolute app paths for each platform.
  2. Start the appium server: yarn appium
  3. [Android] Start an Android device (make sure is visible using adb).
  4. Run the tests
    1. iOS: TEST_CONFIG=local_ios yarn test
    2. Android: TEST_CONFIG=local_android yarn test

Remotely with Sauce Labs

  1. Upload the apps to Sauce Labs
    curl -u "[USER_NAME]:[USER_ACCESS_KEY]" -X POST -H "Content-Type: application/octet-stream" https://saucelabs.com/rest/v1/storage/[USER_NAME]/[APP_NAME].apk?overwrite=true --data-binary @[ABSOLUTE_APP_BUILD_PATH]
    
  2. Verify that uploaded apps
    curl -u "[USER_NAME]:[USER_ACCESS_KEY]" https://saucelabs.com/rest/v1/storage/[USER_NAME]
    
  3. Update test-config/capabilities.js with the app paths for each platform.
  4. Run the tests
    1. iOS: TEST_CONFIG=remote_ios yarn test
    2. Android: TEST_CONFIG=remote_android yarn test

About

React Native E2E Testing with Appium on Sauce Labs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published