Skip to content

Commit

Permalink
Fix E2E tests on Template (#45974)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #45974

This change fixes the E2E tests on the template on main.

There were two issues:
1. we were forcing the project on the 0.75 branch. We now use the current branch name
2. we were replacing all the versions for the dependencies that starts with `react-native` to the monorepo version. The problem is that also `react-native-community` packages starts with `react-native`. We now changes the versions if the dependency name starts with `react-native/`.

## Changelog:
[Internal] - Fix E2E tests on main

Reviewed By: cortinico

Differential Revision: D61122154

fbshipit-source-id: 07210fc9f63e99eac46894f13c7ca5359e186e6c
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Aug 13, 2024
1 parent 84fe531 commit eb2d985
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ jobs:
maestro-flow: ./packages/rn-tester/.maestro/

test_e2e_ios_templateapp:
# Template is not compatible with main anymore. We need to find a better strategy to test the template e2e
# if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
if: ${{ contains(github.ref, 'stable') }}
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
runs-on: macos-13
needs: build_npm_package
env:
Expand Down Expand Up @@ -261,8 +259,7 @@ jobs:
HERMES_PATH=$(find /tmp/react-native-tmp -type f -name "*.tar.gz")
echo "Hermes path is $HERMES_PATH"
# TODO: from next/latest/main convert to branch
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch 0.75-stable --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch ${{ github.ref_name }} --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
cd /tmp/RNTestProject/ios
bundle install
Expand All @@ -284,10 +281,8 @@ jobs:
maestro-flow: ./scripts/e2e/.maestro/

test_e2e_android_templateapp:
# Template is not compatible with main anymore. We need to find a better strategy to test the template e2e
# if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
if: ${{ contains(github.ref, 'stable') }}
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') }}
runs-on: 4-core-ubuntu
needs: build_npm_package
continue-on-error: true
strategy:
Expand Down Expand Up @@ -326,8 +321,7 @@ jobs:
MAVEN_LOCAL=/tmp/react-native-tmp/maven-local
echo "Maven local path is $MAVEN_LOCAL"
# TODO: from next/latest/main convert to branch
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch 0.75-stable --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch ${{ github.ref_name }} --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
echo "Feed maven local to gradle.properties"
cd /tmp/RNTestProject
Expand Down
8 changes: 4 additions & 4 deletions scripts/e2e/init-project-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ function _prepareHelloWorld(
// and update the dependencies and devDependencies of packages scoped as @react-native
// to the version passed as parameter
for (const key of Object.keys(packageJson.dependencies)) {
if (key.startsWith('@react-native')) {
if (key.startsWith('@react-native/')) {
packageJson.dependencies[key] = version;
}
}
for (const key of Object.keys(packageJson.devDependencies)) {
if (key.startsWith('@react-native')) {
if (key.startsWith('@react-native/')) {
packageJson.devDependencies[key] = version;
}
}
Expand Down Expand Up @@ -260,13 +260,13 @@ function _prepareTemplate(
// and update the dependencies and devDependencies of packages scoped as @react-native
// to the version passed as parameter
for (const key of Object.keys(packageJson.dependencies)) {
if (key.startsWith('@react-native')) {
if (key.startsWith('@react-native/')) {
packageJson.dependencies[key] = version;
}
}

for (const key of Object.keys(packageJson.devDependencies)) {
if (key.startsWith('@react-native')) {
if (key.startsWith('@react-native/')) {
packageJson.devDependencies[key] = version;
}
}
Expand Down

0 comments on commit eb2d985

Please # to comment.