Skip to content
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

test: Improve E2E test consistency #55554

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
~/.appium
key: ${{ runner.os }}-tests-setup-${{ hashFiles('package-lock.json') }}

- name: Prepare tests setup
run: npm run native test:e2e:setup

- name: Gradle cache
uses: gradle/gradle-build-action@b5126f31dbc19dd434c3269bf8c28c315e121da2 # v2.8.1

Expand Down
12 changes: 8 additions & 4 deletions packages/react-native-editor/bin/test-e2e-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ fi
output=$($APPIUM_CMD driver list --installed --json)

if echo "$output" | grep -q 'uiautomator2'; then
echo 'UiAutomator2 is installed, skipping installation.'
echo '[info] UiAutomator2 is installed, skipping installation.'
else
echo 'UiAutomator2 not found, installing...'
echo '[info] UiAutomator2 not found, installing...'
$APPIUM_CMD driver install uiautomator2
fi

if echo "$output" | grep -q 'xcuitest'; then
echo 'XCUITest is installed, skipping installation.'
echo '[info] XCUITest is installed, skipping installation.'
else
echo 'XCUITest not found, installing...'
echo '[info] XCUITest not found, installing...'
$APPIUM_CMD driver install xcuitest
fi

# Mitigate conflicts between development server caches and E2E tests
npm run clean:runtime > /dev/null
echo '[info] Runtime cache cleaned.'
4 changes: 2 additions & 2 deletions packages/react-native-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@
"test:e2e:setup": "./bin/test-e2e-setup.sh",
"test:e2e:bundle:android": "mkdir -p android/app/src/main/assets && npm run rn-bundle -- --reset-cache --platform android --dev false --minify false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
"test:e2e:build-app:android": "cd android && ./gradlew clean && ./gradlew assembleDebug",
"test:e2e:android:local": "npm run test:e2e:setup && npm run test:e2e:bundle:android && npm run test:e2e:build-app:android && TEST_RN_PLATFORM=android npm run device-tests:local",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change treats test:e2e:setup as a one-off command run when setting up or repairing the test environment, rather than running the test:e2e:setup command on every test run. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes sense to me 👍

"test:e2e:android:local": "npm run test:e2e:bundle:android && npm run test:e2e:build-app:android && TEST_RN_PLATFORM=android npm run device-tests:local",
"test:e2e:bundle:ios": "mkdir -p ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app && npm run bundle:ios && cp bundle/ios/App.js ./ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle && cp -r bundle/ios/assets ./ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/",
"test:e2e:build-app:ios": "npm run preios && ./bin/build_e2e_ios_app",
"test:e2e:build-wda": "xcodebuild -project ~/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 13' -derivedDataPath ios/build/WDA",
"test:e2e:ios:local": "npm run test:e2e:setup && npm run test:e2e:bundle:ios && npm run test:e2e:build-app:ios && npm run test:e2e:build-wda && TEST_RN_PLATFORM=ios npm run device-tests:local",
"test:e2e:ios:local": "npm run test:e2e:bundle:ios && npm run test:e2e:build-app:ios && npm run test:e2e:build-wda && TEST_RN_PLATFORM=ios npm run device-tests:local",
"build:gutenberg": "cd gutenberg && npm ci && npm run build",
"clean": "npm run clean:build-artifacts; npm run clean:aztec; npm run clean:haste; npm run clean:metro; npm run clean:watchman",
"clean:runtime": "npm run clean:haste; npm run clean:metro; npm run clean:watchman; npm run clean:babel-cache",
Expand Down
Loading