Skip to content

Commit 9ee7ae7

Browse files
author
Krzysztof Borowy
committed
run e2e
1 parent 15c10b9 commit 9ee7ae7

File tree

5 files changed

+114
-21
lines changed

5 files changed

+114
-21
lines changed

.github/workflows/ci.yml

Lines changed: 106 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Node.js
1818
uses: actions/setup-node@v3.6.0
1919
with:
20-
node-version: 16
20+
node-version: 18.16.1
2121
cache: yarn
2222
- name: Install JS dependencies
2323
run: yarn
@@ -32,17 +32,26 @@ jobs:
3232
- name: Set up Node.js
3333
uses: actions/setup-node@v3.6.0
3434
with:
35-
node-version: 16
35+
node-version: 18.16.1
3636
cache: yarn
3737
- name: Install JS dependencies
3838
run: |
3939
yarn
4040
- name: Test Next Storage
41-
uses: gradle/gradle-build-action@v2.4.2
41+
uses: gradle/gradle-build-action@v2
4242
with:
4343
gradle-version: wrapper
4444
arguments: react-native-async-storage_async-storage:test
4545
build-root-directory: example/android
46+
- name: Build e2e binary
47+
run: |
48+
yarn build:e2e:android
49+
- name: Upload e2e binary
50+
if: github.event_name == 'pull_request'
51+
uses: actions/upload-artifact@v3
52+
with:
53+
name: app-release.apk
54+
path: example/android/app/build/outputs/apk/release/
4655
ios:
4756
name: iOS
4857
runs-on: macos-latest
@@ -58,7 +67,7 @@ jobs:
5867
- name: Set up Node.js
5968
uses: actions/setup-node@v3.6.0
6069
with:
61-
node-version: 16
70+
node-version: 18.16.1
6271
cache: yarn
6372
- name: Set up environment
6473
run: |
@@ -74,18 +83,18 @@ jobs:
7483
run: |
7584
pod install
7685
working-directory: example/ios
77-
- name: Boot simulator
78-
run: |
79-
./scripts/ios_e2e.sh 'run_simulator'
80-
- name: Build
86+
- name: Build e2e binary
8187
run: |
8288
yarn build:e2e:ios
83-
- name: Test
84-
if: false
85-
run: |
86-
yarn test:e2e:ios
89+
- name: Upload e2e binary
90+
uses: actions/upload-artifact@v3
91+
if: github.event_name == 'pull_request'
92+
with:
93+
name: ReactTestApp.app
94+
path: example/ios/build/Build/Products/Release-iphonesimulator/ReactTestApp.app
8795
macos:
8896
name: macOS
97+
if: false # TEMP, Remove once done this PR
8998
runs-on: macos-latest
9099
steps:
91100
- name: Checkout
@@ -99,7 +108,7 @@ jobs:
99108
- name: Set up Node.js
100109
uses: actions/setup-node@v3.6.0
101110
with:
102-
node-version: 16
111+
node-version: 18.16.1
103112
cache: yarn
104113
- name: Install JS dependencies
105114
run: |
@@ -120,6 +129,7 @@ jobs:
120129
yarn test:e2e:macos
121130
windows:
122131
name: Windows
132+
if: false # TEMP, Remove once done this PR
123133
runs-on: windows-2022
124134
steps:
125135
- name: Set up MSBuild
@@ -131,7 +141,7 @@ jobs:
131141
- name: Set up Node.js
132142
uses: actions/setup-node@v3.6.0
133143
with:
134-
node-version: 16
144+
node-version: 18.16.1
135145
cache: yarn
136146
- name: Install JS dependencies
137147
run: |
@@ -142,6 +152,87 @@ jobs:
142152
- name: Build
143153
run: |
144154
yarn react-native run-windows --release --arch x64 --logging --no-packager --no-launch --no-deploy --msbuildprops "BundleEntryFile=index.ts" --no-telemetry
155+
156+
157+
e2e-tests:
158+
name: Run e2e tests
159+
needs: [review, android, ios]
160+
if: github.event_name == 'pull_request'
161+
strategy:
162+
matrix:
163+
platform: [ android, ios ]
164+
runs-on: macos-latest
165+
steps:
166+
- name: Checkout
167+
uses: actions/checkout@v3
168+
- name: Set up Node.js
169+
uses: actions/setup-node@v3.6.0
170+
with:
171+
node-version: 18.16.1
172+
cache: yarn
173+
- name: Install JS dependencies
174+
run: |
175+
yarn
176+
- name: Gradle cache
177+
uses: gradle/gradle-build-action@v2
178+
- name: Start Appium server
179+
run: |
180+
yarn appium --config example/appium.config.js &
181+
- name: Wait for appium boot
182+
run: |
183+
sleep 5
184+
185+
# ios part
186+
- name: Download iOS binary
187+
uses: actions/download-artifact@v3
188+
if: matrix.platform == 'ios'
189+
with:
190+
name: ReactTestApp.app
191+
path: example/ios/build/Build/Products/Release-iphonesimulator/ReactTestApp.app
192+
- uses: futureware-tech/simulator-action@v2
193+
if: matrix.platform == 'ios'
194+
with:
195+
model: 'iPhone 14'
196+
- name: Run iOS e2e
197+
if: matrix.platform == 'ios'
198+
run: |
199+
yarn test:e2e:ios
200+
201+
# android part
202+
- name: Download android binary
203+
uses: actions/download-artifact@v3
204+
if: matrix.platform == 'android'
205+
with:
206+
name: app-release.apk
207+
path: example/android/app/build/outputs/apk/release/
208+
- name: AVD cache
209+
if: matrix.platform == 'android'
210+
uses: actions/cache@v3
211+
id: avd-cache
212+
with:
213+
path: |
214+
~/.android/avd/*
215+
~/.android/adb*
216+
key: avd-29
217+
- name: create AVD and generate snapshot for caching
218+
if: matrix.platform == 'android' && steps.avd-cache.outputs.cache-hit != 'true'
219+
uses: reactivecircus/android-emulator-runner@v2
220+
with:
221+
api-level: 29
222+
force-avd-creation: false
223+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
224+
disable-animations: false
225+
script: echo "Generated AVD snapshot for caching."
226+
- name: Run Android e2e tests
227+
if: matrix.platform == 'android'
228+
uses: reactivecircus/android-emulator-runner@v2
229+
with:
230+
api-level: 29
231+
force-avd-creation: false
232+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
233+
disable-animations: true
234+
script: yarn test:e2e:android
235+
145236
release:
146237
name: Release
147238
needs: [review, android, ios, macos, windows]
@@ -155,7 +246,7 @@ jobs:
155246
- name: Set up Node.js
156247
uses: actions/setup-node@v3.6.0
157248
with:
158-
node-version: 16
249+
node-version: 18.16.1
159250
cache: yarn
160251
- name: Install JS dependencies
161252
run: |

example/jest.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { Config as JestConfig } from 'jest';
33

44
const config: JestConfig = {
55
preset: 'react-native',
6-
testTimeout: 60000,
6+
testTimeout: 120000,
77
bail: 0,
88
rootDir: '..',
9+
transform: {},
910
setupFilesAfterEnv: ['./example/jest.setup.ts'],
1011
testMatch: ['**/?(*.)spec.ts(x)?'],
1112
moduleNameMapper: {

example/jest.setup.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ const Capabilities = {
1010
'example/android/app/build/outputs/apk/release/app-release.apk',
1111
'appium:automationName': 'UiAutomator2',
1212
'appium:newCommandTimeout': 240,
13+
'appium:enforceAppInstall': true,
1314
'appium:appWaitActivity':
1415
'com.microsoft.reacttestapp.component.ComponentActivity',
1516
},
1617
ios: {
1718
platformName: 'iOS',
18-
'appium:platformVersion': '16.4',
19+
'appium:platformVersion': '16.2',
1920
'appium:deviceName': 'iPhone 14',
2021
'appium:automationName': 'XCUITest',
2122
'appium:app':
@@ -34,7 +35,7 @@ function getDriverConfig(platform: string | undefined) {
3435

3536
const config: RemoteOptions = {
3637
port: 4723,
37-
waitforTimeout: 60000,
38+
waitforTimeout: 90000,
3839
logLevel: 'error',
3940
capabilities: Capabilities[platform],
4041
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"concurrently": "^6.4.0",
8282
"eslint": "^8.0.0",
8383
"expo": "^48.0.0",
84-
"jest": "^29.5.0",
84+
"jest": "^29.3.1",
8585
"lodash": "^4.17.21",
8686
"prettier": "^2.5.1",
8787
"react": "18.2.0",

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,7 +3189,7 @@ __metadata:
31893189
concurrently: ^6.4.0
31903190
eslint: ^8.0.0
31913191
expo: ^48.0.0
3192-
jest: ^29.5.0
3192+
jest: ^29.3.1
31933193
lodash: ^4.17.21
31943194
merge-options: ^3.0.4
31953195
prettier: ^2.5.1
@@ -11205,7 +11205,7 @@ __metadata:
1120511205
languageName: node
1120611206
linkType: hard
1120711207

11208-
"jest@npm:^29.5.0":
11208+
"jest@npm:^29.3.1":
1120911209
version: 29.5.0
1121011210
resolution: "jest@npm:29.5.0"
1121111211
dependencies:

0 commit comments

Comments
 (0)