Skip to content

Commit

Permalink
E2E CI configuration (#217)
Browse files Browse the repository at this point in the history
* chore: clean up, save screenshots, update podfile.lock

* chore: CI ios debug

* chore: CI ios debug

* chore: .env.ci

* chore: clean up

* chore: config

* fix: test

* fix: test

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* chore: config

* chore: platformVersion

* chore: re-run tests

* chore: re-run tests

* chore: test improvements

* chore: test improvements

* chore: update yarn.lock

* chore: increase timeout

* chore: clean up

* chore: update docs, refactor CI config

* chore: clean up

* chore: clean up

* chore: android resolution

* chore: clean up

* chore: re-run tests

* fix: test

* chore: ios version

* chore: remove screen shots

* chore: clean up

* chore: linux for andoird tests

* chore: linux for andoird tests

* chore: use android runner action

* chore: clean up

* chore: clean up

* chore: clean up

* chore: improvements

* chore: improvements

* chore: improvements

* chore: improvements

* chore: rerun tests

* chore: improvements

* chore: improvements

* chore: improvements

* chore: improvements

* chore: improvements

* chore: improvements

* chore: test config

* chore: tests retries

* chore: ss

* chore: fix test

* chore: kill uiautomator process

* chore: run appium-doctor

* fix: config

* chore: clean up

* chore: re-run tests

* chore: afterpay clearpay

* chore: workflows clean up

Co-authored-by: Arkadiusz Kubaczkowski <arek.kubaczkowski@callstak.com>
  • Loading branch information
arekkubaczkowski and Arkadiusz Kubaczkowski committed May 14, 2021
1 parent 52e2f01 commit 5bde320
Show file tree
Hide file tree
Showing 17 changed files with 416 additions and 376 deletions.
98 changes: 0 additions & 98 deletions .circleci/config.yml

This file was deleted.

65 changes: 37 additions & 28 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: RN Stripe

on: push
on:
push:
branches: [master]
pull_request:
branches: ['**']

jobs:
test-android:
Expand All @@ -9,107 +13,112 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.5
with:
node-version: 14.4.0

- name: Install React Native CLI
run: |
npm install react-native-cli
run: npm install react-native-cli

- name: Install Dependencies
run: |
yarn bootstrap
- name: Run Android Emulator
run: |
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-29;google_apis;x86_64'
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n test_device -k 'system-images;android-29;google_apis;x86_64' --force
echo $ANDROID_HOME/emulator/emulator -list-avds
echo "Starting emulator"
nohup $ANDROID_HOME/emulator/emulator -avd test_device -no-snapshot > /dev/null 2>&1 &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
$ANDROID_HOME/platform-tools/adb devices
echo "Emulator started"
- name: Build Android App
run: |
yarn run-example-android
sleep 15
- name: Run Tests
run: |
node ./run-appium-tests.js android
- name: Run Android Emulator and app
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: |
yarn run-example-android
sleep 15
node ./run-appium-tests.js android
- name: Upload Screenshoots
uses: actions/upload-artifact@v1
with:
name: e2e-results
path: .tmp
if: ${{ failure() }}
if: ${{ always() }}

- uses: actions/download-artifact@v2
with:
name: e2e-results
path: .tmp
if: ${{ failure() }}
if: ${{ always() }}

test-ios:
name: e2e-ios-test
runs-on: macOS-latest
env:
API_URL: https://rigorous-heartbreaking-cephalopod.glitch.me
steps:
- name: checkout
uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v1
- uses: actions/cache@v2
with:
path: example/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.5
with:
node-version: 14.4.0

- name: Install React Native CLI
run: |
npm install react-native-cli
- name: Install Repo and Dependencies
- name: Install Dependencies
run: |
yarn bootstrap
- name: Build iOS App
run: |
yarn run-example-ios
BUILT_APP=`find ~/Library/Developer/Xcode/DerivedData -name StripeSdkExample.app | grep Build/Products/Release-iphonesimulator/StripeSdkExample.app`
mkdir -p example/ios/DerivedData/StripeSdkExample/Build/Products/Release-iphonesimulator
cp -R $BUILT_APP example/ios/DerivedData/StripeSdkExample/Build/Products/Release-iphonesimulator
sleep 30
- name: Run Tests
run: |
node ./run-appium-tests.js ios
- name: Upload Screenshoots
uses: actions/upload-artifact@v1
with:
name: e2e-results
path: .tmp
if: ${{ failure() }}
if: ${{ always() }}

- uses: actions/download-artifact@v2
with:
name: e2e-results
path: .tmp
if: ${{ failure() }}
if: ${{ always() }}
84 changes: 0 additions & 84 deletions .github/workflows/tests-and-build.yml

This file was deleted.

3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ Our pre-commit hooks verify that the linter and tests pass when committing.
### Tests

We use [Appium](https://github.com/appium/appium) for e2e testing.
Since we don't have configured CI yet we must remember to run tests locally for both platforms before merge pr's.
To to that you have to install and configure appium following its [documentation](https://github.com/appium/appium/blob/master/docs/en/about-appium/getting-started.md).
In order to run tests locally you have to install and configure appium following its [documentation](https://github.com/appium/appium/blob/master/docs/en/about-appium/getting-started.md).

Next, you have to specify emulator/simulator details in the config files.
To set it up on android, let's open `wdio.android.js/wdio.ios.js` files and edit `capabilities` section accordingly (platformVersion, deviceName, app).
Expand Down
Loading

0 comments on commit 5bde320

Please sign in to comment.