Skip to content

Commit

Permalink
test: iOS E2E tests set OS version (WordPress#55661)
Browse files Browse the repository at this point in the history
* test: iOS E2E tests set OS version

Without setting this, cryptic errors result where Xcode may attempt to
build the app for the local development machine, rather than the
targeted iOS simulator.

```
** BUILD FAILED **

❌ gutenberg/packages/react-native-editor/ios/GutenbergDemo.xcodeproj: Provisioning profile "Gutenberg Development" doesn't include the currently selected device "MacBook Pro" (identifier [REDACTED]). (in target 'GutenbergDemo' from project 'GutenbergDemo')
```

* docs: Fix incorrect E2E test example scripts

The nested npm script requires additional `--` separators to pass the
argument to the resulting Jest command.
  • Loading branch information
dcalhoun authored Oct 27, 2023
1 parent f5ab705 commit 87f51be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/react-native-editor/__device-tests__/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ You can filter which test runs by one of two ways:
npm run native test:e2e:ios:local gutenberg-editor-paragraph.test.js

# Enable watch mode on iOS
npm run native test:e2e:ios:local -- --watch
npm run native test:e2e:ios:local -- -- -- --watch
```

## Speeding Up Test Runs
Expand All @@ -90,7 +90,11 @@ While we must run all of these at least once to produce a testable app, it is of
By default `device-tests:local` runs tests for Android. To run tests on iOS, you can prefix the script with the `TEST_RN_PLATFORM` environment variable.

```shell
# Run tests on iOS
TEST_RN_PLATFORM=ios npm run native device-tests:local

# Run tests on iOS with watch mode enabled
TEST_RN_PLATFORM=ios npm run native device-tests:local -- -- --watch
```

## Debugging Tests
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-editor/bin/build_e2e_ios_app
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -o pipefail

DEFAULT_DESTINATION='platform=iOS Simulator,name=iPhone 14'
DEFAULT_DESTINATION='platform=iOS Simulator,name=iPhone 14,OS=16.2'
if [[ -z "${RN_EDITOR_E2E_IOS_DESTINATION-}" ]]; then
DESTINATION="$DEFAULT_DESTINATION"
else
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"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 14' -derivedDataPath ios/build/WDA",
"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 14,OS=16.2' -derivedDataPath ios/build/WDA",
"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",
Expand Down

0 comments on commit 87f51be

Please sign in to comment.