-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: e2e snapshot tests #2338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: e2e snapshot tests #2338
Changes from 41 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
b5332c0
chore: initial work on e2e rendering tests
CDFN 63ca90c
use proper arch in handshake message
CDFN 91a32b3
more work
CDFN 0189932
properly render component and improve C/S comms
CDFN 985a861
more work
CDFN 85895a5
basic working version with organized folders
CDFN 8a33b0b
fix bug causing not to send response when there are more than 1 tests
CDFN 7ce79aa
basic version of e2e tests
CDFN 3813852
reorganize code little bit
CDFN 8d5d2af
ios e2e tests support
CDFN 0f9456c
fix fabric support, add os and arch to diff name
CDFN a4dfc2f
remove note for self, add comment about hardcoding deviceScaleFactor
CDFN e69d098
fix incorrect method signature in react-native-view-shot spec
CDFN a4e47f1
Merge remote-tracking branch 'upstream/main' into feat/e2e
CDFN 1d5229c
add readme section about testing
CDFN 3ced4ba
formatting changes
CDFN 285edf8
fix app not starting after structure changes, add rendered images to …
CDFN a2e34a0
fix jest not shutting down after running all tests
CDFN c9836f7
fix: fix format-js task to reflect changes made to folder structure
CDFN 971f05b
add html test reports
CDFN 4dbeeea
correct test examples
CDFN f779711
add platform data to each test
CDFN dab53da
fix platform info
CDFN f1d9156
reorganize adding attachments
CDFN dd08f40
improve UX, graceful WS connection closing
CDFN 2205082
move testing info from readme to contributing
CDFN 0ceaef3
Merge branch 'main' into feat/e2e
CDFN 7dc90ad
open E2E view when E2E env is set, improve naming
CDFN 75c8c10
test e2e
CDFN d2d1554
remvoe non-existing task
CDFN 95a72af
increase timeout so tests can be run on CI, fix file not found error
CDFN 3b4f2ce
add auto connect
CDFN 8e950f9
remove logs
CDFN 6ee15ce
fix babel plugin order
CDFN 746d636
e2e CI tests
CDFN db00b06
Merge remote-tracking branch 'upstream/main' into feat/e2e
CDFN ce3041a
add gitignore
CDFN 3ce7a8b
Merge remote-tracking branch 'upstream/main' into feat/e2e
CDFN f76fc0a
Merge remote-tracking branch 'upstream/main' into feat/e2e
CDFN 69326a1
chore: move workflows from disabled folder
bohdanprog 573b774
feat: update workflows for e2e
bohdanprog c8278e2
feat: add types in TestingView component
bohdanprog 93fd82c
chore: remove unused imports
bohdanprog 62ef5ca
feat: add new test case
bohdanprog e286f04
feat: move GeneralSvgRenderingTest.spec.tsx to global tests folder an…
bohdanprog bcf8895
feat: add comment in helpers.ts
bohdanprog 511c153
feat: add support failed cases
bohdanprog 63615c7
Merge remote-tracking branch 'origin' into feat/e2e
bohdanprog bac2823
feat: add ability to set failer cases and add separate functionality …
bohdanprog bbd1399
feat: rename file with failed cases, add function to read and update …
bohdanprog 3e43665
chore: change file path
bohdanprog ccb1575
chore: add null check type to storeFailedResult
bohdanprog 9dbfada
feat: add Platform-specific extensions
bohdanprog 3d6da8f
feat: update tsconfig.json and update import in examples.tsx
bohdanprog af05406
fix: remove unnecesary files, and spicify platform
bohdanprog 9319f5d
Merge branch 'main' of github.com:software-mansion/react-native-svg i…
bohdanprog facee74
feat: add new patch pachage react-native-view-shot fix for windows pl…
bohdanprog 2624275
feat: update workflow for windows
bohdanprog 1006d67
fix: restore changes with library patch
bohdanprog 8bef9b9
fix: remove TestinView for windows platform
bohdanprog 6d7156f
chore: remove changes in tscofig
bohdanprog d88a6ef
fix: restore react-native-view patch
bohdanprog d4899d6
feat: update example apps
bohdanprog e490534
fix: web-example app
bohdanprog df4fbec
Merge branch 'main' of github.com:software-mansion/react-native-svg i…
bohdanprog 4752283
fix: hide E2E tests on Web and MacOS
jakex7 479c5fa
chore: disable E2E tests on main
jakex7 35efe7d
Merge branch 'main' of github.com:software-mansion/react-native-svg i…
bohdanprog 6b497a7
feat: update podfile.lock files
bohdanprog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,120 @@ | ||
name: Test Android e2e | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/android-e2e-test.yml' | ||
- 'apps/examples/**' | ||
- 'example/**' | ||
- 'android/**' | ||
- 'src/**' | ||
- 'e2e/**' | ||
- 'package.json' | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
test: | ||
runs-on: macos-12 | ||
timeout-minutes: 60 | ||
env: | ||
WORKING_DIRECTORY: example | ||
API_LEVEL: 34 | ||
SYSTEM_IMAGES: system-images;android-34;google_apis;x86_64 | ||
AVD_NAME: rn-svg-avd | ||
concurrency: | ||
group: android-e2e-example-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'yarn' | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'zulu' | ||
cache: 'gradle' | ||
- name: Install NDK | ||
uses: nttld/setup-ndk@v1 | ||
id: setup-ndk | ||
with: | ||
ndk-version: r26d | ||
local-cache: true | ||
- name: Set ANDROID_NDK | ||
run: echo "ANDROID_NDK=$ANDROID_HOME/ndk-bundle" >> $GITHUB_ENV | ||
- name: Cache SDK image | ||
id: cache-sdk-img | ||
uses: actions/cache@v3 | ||
with: | ||
path: $ANDROID_HOME/system-images/ | ||
key: ${{ runner.os }}-build-system-images-${{ env.SYSTEM_IMAGES }} | ||
- name: SKDs - download required images | ||
if: ${{ steps.cache-sdd-img.outputs.cache-hit != 'true' }} | ||
run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "system-images;android-34;google_apis;x86_64" | ||
- name: Cache AVD | ||
id: cache-avd | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.android/avd/${{ env.AVD_NAME }}.avd | ||
key: ${{ runner.os }}-avd-images-${{ env.SYSTEM_IMAGES }}-${{ env.AVD_NAME }} | ||
- name: Emulator - Create | ||
if: ${{ steps.cache-avd.outputs.cache-hit != 'true' }} | ||
run: $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n ${{ env.AVD_NAME }} --device 28 --package "${{ env.SYSTEM_IMAGES }}" --sdcard 512M | ||
- name: Emulator - Set screen settings | ||
if: ${{ steps.cache-avd.outputs.cache-hit != 'true' }} | ||
run: | | ||
echo "AVD config path: $HOME/.android/avd/${{ env.AVD_NAME }}.avd/config.ini" | ||
sed -i '' 's/.*hw\.lcd\.density.*/hw\.lcd\.density = 480/g' $HOME/.android/avd/${{ env.AVD_NAME }}.avd/config.ini | ||
sed -i '' 's/.*hw\.lcd\.width.*/hw\.lcd\.width = 1344/g' $HOME/.android/avd/${{ env.AVD_NAME }}.avd/config.ini | ||
sed -i '' 's/.*hw\.lcd\.height.*/hw\.lcd\.height = 2992/g' $HOME/.android/avd/${{ env.AVD_NAME }}.avd/config.ini | ||
- name: Emulator - Boot | ||
run: $ANDROID_HOME/emulator/emulator -memory 4096 -avd ${{ env.AVD_NAME }} -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim & | ||
|
||
- name: ADB Wait For Device | ||
run: adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;' | ||
timeout-minutes: 10 | ||
|
||
- name: Reverse TCP | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
run: adb devices | grep '\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} adb -s {} reverse tcp:8081 tcp:8081 | ||
|
||
- name: Install root node dependencies | ||
run: yarn | ||
|
||
- name: Install example app node dependencies | ||
run: yarn | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
|
||
- name: Build Android app | ||
working-directory: ${{ env.WORKING_DIRECTORY }}/android | ||
run: ./gradlew assembleDebug | ||
|
||
- name: Start Metro server | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
run: E2E=true yarn start &> output.log & | ||
|
||
- name: Install APK | ||
run: adb install -r ${{ env.WORKING_DIRECTORY }}/android/app/build/outputs/apk/debug/app-debug.apk | ||
|
||
- name: Launch APK | ||
run: 'while ! (adb shell monkey -p com.example 1 | grep -q "Events injected: 1"); do sleep 1; echo "Retrying due to errors in previous run..."; done' | ||
|
||
- name: Run e2e Tests | ||
run: E2E=true yarn e2e | ||
|
||
- name: Upload test report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: report | ||
path: | | ||
report.html | ||
jest-html-reporters-attach/ | ||
|
||
- name: Kill emulator (so it can be cached safely) | ||
run: adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done |
This file contains hidden or 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,93 @@ | ||
name: Test iOS e2e | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/android-e2e-test.yml' | ||
- 'apps/examples/**' | ||
- 'example/**' | ||
- 'apple/**' | ||
- 'src/**' | ||
- 'e2e/**' | ||
- 'package.json' | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
test: | ||
runs-on: macos-14 | ||
timeout-minutes: 60 | ||
env: | ||
WORKING_DIRECTORY: example | ||
DEVICE: iPhone 14 Pro | ||
XCODE_VERSION: latest-stable | ||
concurrency: | ||
group: ios-e2e-example-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Use latest stable Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ env.XCODE_VERSION }} | ||
|
||
- name: Restore react-native-svg node_modules from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }} | ||
restore-keys: ${{ runner.os }}-node-modules-svg- | ||
|
||
- name: Install react-native-svg node_modules | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Restore app node_modules from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.WORKING_DIRECTORY }}/node_modules | ||
key: ${{ runner.os }}-node-modules-${{ env.WORKING_DIRECTORY }}-${{ hashFiles(format('{0}/yarn.lock', env.WORKING_DIRECTORY)) }} | ||
restore-keys: ${{ runner.os }}-node-modules-${{ env.WORKING_DIRECTORY }}- | ||
|
||
- name: Install app node_modules | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Restore Pods from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ env.WORKING_DIRECTORY }}/ios/Pods | ||
~/Library/Caches/CocoaPods | ||
~/.cocoapods | ||
key: ${{ runner.os }}-pods-${{ env.WORKING_DIRECTORY }}-${{ hashFiles(format('{0}/ios/Podfile.lock', env.WORKING_DIRECTORY)) }} | ||
|
||
- name: Install Pods | ||
working-directory: ${{ env.WORKING_DIRECTORY }}/ios | ||
run: pod install | ||
|
||
- name: Restore build artifacts from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/Library/Developer/Xcode/DerivedData | ||
key: ${{ runner.os }}-ios-derived-data-${{ env.WORKING_DIRECTORY }}-${{ hashFiles(format('{0}/ios/Podfile.lock', env.WORKING_DIRECTORY)) }} | ||
- name: Start Metro server | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
run: E2E=true yarn start &> output.log & | ||
|
||
- name: Build app | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
run: E2E=true npx react-native@latest run-ios --simulator="${{ env.DEVICE }}" --mode Debug --verbose | ||
|
||
- name: Run e2e Tests | ||
run: E2E=true yarn e2e | ||
|
||
- name: Upload test report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: report | ||
path: | | ||
report.html | ||
jest-html-reporters-attach/ |
This file contains hidden or 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 |
---|---|---|
|
@@ -50,3 +50,6 @@ experimental/ | |
|
||
# VS Code | ||
.vscode/ | ||
|
||
jest-html-reporters-attach/ | ||
report.html |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.