-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(PSG-5355): setup ios test app * feat(PSG-5357): setup detox tooling * test(PSG-5457): added Passage App tests * test(PSG-5457): simplify app tests * refactor: improved usability and readability of test setup * test(PSG-5347): added mailosaur infrastructure * test(PSG-5347): added otp tests * test(PSG-5348): added magic link tests * test(PSG-5352): added hosted test * test(PSG-5353): Added Social test * test(PSG-5351): Added current user tests * test(PSG-5350): added token store tests * refactor: improve test code performance and reusability * build(PSG-5513): added detox test workflow * test: disable eslint for test files * chore: cleanup app view * test: attempt to fix podfile issue with test app * test: attempt to fix build issue with test app * test: remove test app from library type check * test: attempt to fix pod install for test app * test: attempt to fix podfile issue with test app * test: attempt to fix podfile issue with test app * test: attempt to fix podfile issue with test app * test: attempt to fix podfile issue with test app * test: attempt to fix podfile issue with test app * test: attempt to fix podfile issue with test app * test: attempt to fix podfile issue with test app * test: attempt to fix podfile issue with test app * test: attempt to fix podfile issue with test app * fix: remove react-native-quick-base64 from test app * fix: add applesimutils to detox test workflow * test: use release build in detox tests * test: add wait to web view tests * test: extend web view test timeouts * test: extend test timeouts to reduce flakiness * test: adjust mailosaur timeout for tests * fix: adjusted timeout for waiting for successful test results * Update hosted.test.js * Android e2e detox test config (#60) * ops: added android detox test config
- Loading branch information
1 parent
e303b0b
commit ee48f90
Showing
43 changed files
with
11,891 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Detox Tests | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
ios-tests: | ||
runs-on: macos-latest | ||
|
||
env: | ||
NODE_OPTIONS: "--max-old-space-size=4096" | ||
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install applesimutils | ||
run: | | ||
brew tap wix/brew | ||
brew install applesimutils | ||
- name: Clean Derived Data | ||
run: | | ||
rm -rf ~/Library/Developer/Xcode/DerivedData | ||
- name: Install Dependencies | ||
run: | | ||
rm -rf node_modules && npm install | ||
cd example && rm -rf node_modules && npm install | ||
cd ios && rm -rf Pods && pod cache clean --all && pod install && cd .. | ||
- name: Run Detox iOS Tests | ||
working-directory: example | ||
run: | | ||
npx detox build --configuration ios.sim.release | ||
npx detox test --configuration ios.sim.release --cleanup | ||
shell: bash | ||
|
||
android-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Enable KVM | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
- name: Set environment variables | ||
run: | | ||
echo "MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }}" > example/.env | ||
- name: Install Dependencies | ||
run: | | ||
rm -rf node_modules && npm install | ||
cd example && rm -rf node_modules && npm install && cd .. | ||
- name: Start emulator and run tests | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 34 | ||
target: google_apis | ||
arch: x86_64 | ||
profile: Nexus 6 | ||
working-directory: ./example | ||
script: | | ||
npx detox build --configuration android.emu.release | ||
npx detox test --configuration android.emu.release --cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,3 +68,5 @@ android/keystores/debug.keystore | |
|
||
# generated by bob | ||
lib/ | ||
|
||
*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** @type {Detox.DetoxConfig} */ | ||
module.exports = { | ||
testRunner: { | ||
args: { | ||
'$0': 'jest', | ||
config: 'e2e/jest.config.js' | ||
}, | ||
jest: { | ||
setupTimeout: 120000 | ||
} | ||
}, | ||
apps: { | ||
'ios.debug': { | ||
type: 'ios.app', | ||
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/PassageReactNativeExample.app', | ||
build: 'xcodebuild -workspace ios/PassageReactNativeExample.xcworkspace -scheme PassageReactNativeExample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build' | ||
}, | ||
'ios.release': { | ||
type: 'ios.app', | ||
binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/PassageReactNativeExample.app', | ||
build: 'xcodebuild -workspace ios/PassageReactNativeExample.xcworkspace -scheme PassageReactNativeExample -configuration Release -sdk iphonesimulator -derivedDataPath ios/build' | ||
}, | ||
'android.debug': { | ||
type: 'android.apk', | ||
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk', | ||
build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug', | ||
reversePorts: [ | ||
8081 | ||
] | ||
}, | ||
'android.release': { | ||
type: 'android.apk', | ||
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk', | ||
build: 'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release' | ||
} | ||
}, | ||
devices: { | ||
simulator: { | ||
type: 'ios.simulator', | ||
device: { | ||
type: 'iPhone 15' | ||
} | ||
}, | ||
attached: { | ||
type: 'android.attached', | ||
device: { | ||
adbName: '.*' | ||
} | ||
}, | ||
emulator: { | ||
type: 'android.emulator', | ||
device: { | ||
avdName: 'test'// Use something like 'Pixel_6_Pro_API_33' when testing locally | ||
} | ||
} | ||
}, | ||
configurations: { | ||
'ios.sim.debug': { | ||
device: 'simulator', | ||
app: 'ios.debug' | ||
}, | ||
'ios.sim.release': { | ||
device: 'simulator', | ||
app: 'ios.release' | ||
}, | ||
'android.att.debug': { | ||
device: 'attached', | ||
app: 'android.debug' | ||
}, | ||
'android.att.release': { | ||
device: 'attached', | ||
app: 'android.release' | ||
}, | ||
'android.emu.debug': { | ||
device: 'emulator', | ||
app: 'android.debug' | ||
}, | ||
'android.emu.release': { | ||
device: 'emulator', | ||
app: 'android.release' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
example/android/app/src/androidTest/java/com/example_reactnative/DetoxTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.example_reactnative; | ||
|
||
import id.passage.example_reactnative.MainActivity; | ||
|
||
import com.wix.detox.BuildConfig; | ||
import com.wix.detox.Detox; | ||
import com.wix.detox.config.DetoxConfig; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
import androidx.test.filters.LargeTest; | ||
import androidx.test.rule.ActivityTestRule; | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
@LargeTest | ||
public class DetoxTest { | ||
@Rule | ||
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false); | ||
|
||
@Test | ||
public void runDetoxTests() { | ||
DetoxConfig detoxConfig = new DetoxConfig(); | ||
detoxConfig.idlePolicyConfig.masterTimeoutSec = 90; | ||
detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60; | ||
detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 180 : 60); | ||
|
||
Detox.runTests(mActivityRule, detoxConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
<resources> | ||
<string name="app_name">PassageReactNativeExample</string> | ||
<!-- Required Passage app settings --> | ||
<string name="passage_auth_origin">YOUR_AUTH_ORIGIN</string> | ||
<string name="passage_auth_origin">smoggy-orchid-mule.withpassage-uat.com</string> | ||
<string name="asset_statements"> | ||
[{ | ||
\"include\": \"https://@string/passage_auth_origin/.well-known/assetlinks.json\" | ||
}] | ||
</string> | ||
|
||
<string name="clientApiBasePath">https://auth-uat.passage.dev/v1</string> | ||
</resources> |
7 changes: 7 additions & 0 deletions
7
example/android/app/src/main/res/xml/network_security_config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<network-security-config> | ||
<domain-config cleartextTrafficPermitted="true"> | ||
<domain includeSubdomains="true">10.0.2.2</domain> | ||
<domain includeSubdomains="true">localhost</domain> | ||
</domain-config> | ||
</network-security-config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.