Skip to content

Commit 378aa72

Browse files
szymonrybczakfacebook-github-bot
authored andcommitted
Unify test-e2e command in rn-tester-e2e pacakge (#38701)
Summary: This PR is small cleanup in scripts in `rn-tester-e2e` package, it creates unified script so that we can easily pass platform as an argument. Context: #36267 (comment) ## Changelog: [INTERNAL] [CHANGED] - Unify `test-e2e` command in `rn-tester-e2e` package Pull Request resolved: #38701 Test Plan: CI Green ✅ Reviewed By: NickGerleman, cipolleschi Differential Revision: D47949821 Pulled By: cortinico fbshipit-source-id: 90bbc96281e89dec505999ff5e51db7ca78da6dc
1 parent 00b142f commit 378aa72

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ jobs:
790790
name: Run E2E tests
791791
command: |
792792
cd packages/rn-tester-e2e
793-
yarn test-ios-e2e
793+
yarn test-e2e ios
794794
795795
# -------------------------
796796
# JOBS: Android E2E Tests
@@ -849,7 +849,7 @@ jobs:
849849
name: Run E2E tests
850850
command: |
851851
cd packages/rn-tester-e2e
852-
yarn test-android-e2e
852+
yarn test-e2e android
853853
# -------------------------
854854
# JOBS: Test Android
855855
# -------------------------

packages/rn-tester-e2e/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ Now, make sure that the iOS simulator/the Android emulator is up and running.
105105
Finally, you can open a third terminal window and run:
106106
107107
```bash
108-
yarn test-android-e2e # for android
109-
yarn test-ios-e2e # for ios
108+
yarn test-e2e android # for android
109+
yarn test-e2e ios # for ios
110110
```
111111
112112
Now you should see the RNTester app being open, and the defined test being run.

packages/rn-tester-e2e/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
"directory": "packages/rn-tester-e2e"
1212
},
1313
"scripts": {
14-
"test": "jest --runInBand",
15-
"test-android-e2e": "E2E_DEVICE=\"android\" yarn test",
16-
"test-ios-e2e": "E2E_DEVICE=\"ios\" yarn test"
14+
"test-e2e": "node ./../../scripts/e2e/run-e2e-tests.js"
1715
},
1816
"devDependencies": {
1917
"appium": "^2.0.0",

scripts/e2e/run-e2e-tests.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
const SUPPORTED_PLATFORMS = ['ios', 'android'];
9+
10+
if (process.argv.length !== 3 || !SUPPORTED_PLATFORMS.includes(process.argv[2])) {
11+
throw new Error(`Invalid platform. Supported platforms are: ${SUPPORTED_PLATFORMS.join(', ')}`);
12+
}
13+
14+
const platform = process.argv[2];
15+
const { execSync } = require('child_process');
16+
execSync(`E2E_DEVICE=${platform} jest --runInBand`, { stdio: 'inherit' });

0 commit comments

Comments
 (0)