chore(react-native): uncomment detox e2e test to build and test native ios (#7479)

This commit is contained in:
Emily Xiong 2021-11-08 12:33:13 -05:00 committed by GitHub
parent 8d6ac4f694
commit 9eb3ac58e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 67 additions and 25 deletions

View File

@ -125,11 +125,25 @@ jobs:
sudo apt-get install lsof sudo apt-get install lsof
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Homebrew cache directory path
if: ${{ matrix.os == 'macos-latest' }}
id: homebrew-cache-dir-path
run: echo "::set-output name=dir::$(brew --cache)"
- name: Cache Homebrew
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/cache@v2
with:
path: ${{ steps.homebrew-cache-dir-path.outputs.dir }}
key: brew-${{ matrix.node-version }}
restore-keys: |
brew-
- name: Install applesimutils, reset ios simulators - name: Install applesimutils, reset ios simulators
if: ${{ matrix.os == 'macos-latest' }} if: ${{ matrix.os == 'macos-latest' }}
run: | run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
brew install applesimutils HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
xcrun simctl shutdown all && xcrun simctl erase all xcrun simctl shutdown all && xcrun simctl erase all
- name: Run e2e tests - name: Run e2e tests

View File

@ -6,6 +6,7 @@ import {
runCLIAsync, runCLIAsync,
uniq, uniq,
getSelectedPackageManager, getSelectedPackageManager,
killPorts,
} from '@nrwl/e2e/utils'; } from '@nrwl/e2e/utils';
describe('Detox', () => { describe('Detox', () => {
@ -37,14 +38,10 @@ describe('Detox', () => {
`generate @nrwl/react-native:app ${appName} --e2eTestRunner=detox --linter=eslint` `generate @nrwl/react-native:app ${appName} --e2eTestRunner=detox --linter=eslint`
); );
expect(runCLI(`build-ios ${appName}-e2e`)).toContain( expect(runCLI(`build-ios ${appName}-e2e --prod`)).toContain(
'Running target "build-ios" succeeded' 'Running target "build-ios" succeeded'
); );
// comment out due to github issue that unable to build xcode error 12.5 https://github.com/facebook/react-native/issues/31480
/* expect(runCLI(`build-ios ${appName}-e2e --pod`)).toContain(
'Running target "build-ios" succeeded'
);
expect( expect(
runCLI( runCLI(
`test-ios ${appName}-e2e --prod --debugSynchronization=true --loglevel=trace` `test-ios ${appName}-e2e --prod --debugSynchronization=true --loglevel=trace`
@ -52,8 +49,7 @@ describe('Detox', () => {
).toContain('Running target "test-ios" succeeded'); ).toContain('Running target "test-ios" succeeded');
await killPorts(8081); // kill the port for the serve command await killPorts(8081); // kill the port for the serve command
*/ }, 3000000);
}, 1000000);
} }
}); });
}); });

View File

@ -1,6 +1,9 @@
import { import {
checkFilesExist, checkFilesExist,
expectTestsPass,
getSelectedPackageManager, getSelectedPackageManager,
isOSX,
killPorts,
newProject, newProject,
readJson, readJson,
runCLI, runCLI,
@ -34,15 +37,14 @@ describe('react native', () => {
return updated; return updated;
}); });
const appTestResults = await runCLIAsync(`test ${appName}`); expectTestsPass(await runCLIAsync(`test ${appName}`));
expect(appTestResults.combinedOutput).toContain( expectTestsPass(await runCLIAsync(`test ${libName}`));
'Test Suites: 1 passed, 1 total'
);
const libTestResults = await runCLIAsync(`test ${libName}`); const appLintResults = await runCLIAsync(`lint ${appName}`);
expect(libTestResults.combinedOutput).toContain( expect(appLintResults.combinedOutput).toContain('All files pass linting.');
'Test Suites: 1 passed, 1 total'
); const libLintResults = await runCLIAsync(`lint ${libName}`);
expect(libLintResults.combinedOutput).toContain('All files pass linting.');
const iosBundleResult = await runCLIAsync(`bundle-ios ${appName}`); const iosBundleResult = await runCLIAsync(`bundle-ios ${appName}`);
expect(iosBundleResult.combinedOutput).toContain( expect(iosBundleResult.combinedOutput).toContain(

View File

@ -30,6 +30,19 @@
"alwaysAddToPackageJson": false "alwaysAddToPackageJson": false
} }
} }
},
"13.2.0": {
"version": "13.2.0-beta.0",
"packages": {
"detox": {
"version": "19.0.0",
"alwaysAddToPackageJson": false
},
"@testing-library/jest-dom": {
"version": "5.15.0",
"alwaysAddToPackageJson": false
}
}
} }
} }
} }

View File

@ -28,11 +28,11 @@
"@nrwl/jest": "*", "@nrwl/jest": "*",
"@nrwl/linter": "*", "@nrwl/linter": "*",
"@nrwl/react": "*", "@nrwl/react": "*",
"@nrwl/workspace": "*",
"chalk": "^4.1.0" "chalk": "^4.1.0"
}, },
"peerDependencies": { "peerDependencies": {
"@nrwl/workspace": "*", "detox": "^19.0.0"
"detox": "^18.22.2"
}, },
"builders": "./executors.json", "builders": "./executors.json",
"ng-update": { "ng-update": {

View File

@ -1,5 +1,5 @@
export const nxVersion = '*'; export const nxVersion = '*';
export const detoxVersion = '18.22.2'; export const detoxVersion = '19.0.0';
export const typesDetoxVersion = '17.14.3'; export const typesDetoxVersion = '17.14.3';
export const testingLibraryJestDom = '5.14.1'; export const testingLibraryJestDom = '5.15.0';

View File

@ -262,6 +262,23 @@
"alwaysAddToPackageJson": false "alwaysAddToPackageJson": false
} }
} }
},
"13.2.0": {
"version": "13.2.0-beta.0",
"packages": {
"react-native": {
"version": "0.66.2",
"alwaysAddToPackageJson": false
},
"@types/react-native": {
"version": "0.66.2",
"alwaysAddToPackageJson": false
},
"@testing-library/jest-native": {
"version": "4.0.4",
"alwaysAddToPackageJson": false
}
}
} }
} }
} }

View File

@ -29,6 +29,7 @@
"@nrwl/jest": "*", "@nrwl/jest": "*",
"@nrwl/linter": "*", "@nrwl/linter": "*",
"@nrwl/react": "*", "@nrwl/react": "*",
"@nrwl/workspace": "*",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"ignore": "^5.0.4", "ignore": "^5.0.4",
"metro-resolver": "^0.66.2", "metro-resolver": "^0.66.2",
@ -36,8 +37,7 @@
"tsconfig-paths": "^3.9.0" "tsconfig-paths": "^3.9.0"
}, },
"peerDependencies": { "peerDependencies": {
"@nrwl/workspace": "*", "react-native": "^0.66.2"
"react-native": "^0.66.1"
}, },
"builders": "./executors.json", "builders": "./executors.json",
"ng-update": { "ng-update": {

View File

@ -1,7 +1,7 @@
export const nxVersion = '*'; export const nxVersion = '*';
export const reactNativeVersion = '0.66.1'; export const reactNativeVersion = '0.66.2';
export const typesReactNativeVersion = '0.65.8'; export const typesReactNativeVersion = '0.66.2';
export const metroVersion = '0.66.2'; export const metroVersion = '0.66.2';
@ -12,7 +12,7 @@ export const reactNativeCommunityCliAndroid = '6.1.0';
export const metroReactNativeBabelPresetVersion = '0.66.2'; export const metroReactNativeBabelPresetVersion = '0.66.2';
export const testingLibraryReactNativeVersion = '8.0.0'; export const testingLibraryReactNativeVersion = '8.0.0';
export const testingLibraryJestNativeVersion = '4.0.2'; export const testingLibraryJestNativeVersion = '4.0.4';
export const jestReactNativeVersion = '18.0.0'; export const jestReactNativeVersion = '18.0.0';