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

rework detox configuration, don't use expo app #1786

Merged
merged 5 commits into from
Jun 6, 2024
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
28 changes: 17 additions & 11 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
npm run check-dependencies
applications:
name: e2e-${{ matrix.app_type }}-${{ matrix.jhipster_version }}
runs-on: macos-13
runs-on: macos-14
needs: [check-dependencies]
timeout-minutes: 90
defaults:
Expand Down Expand Up @@ -73,6 +73,7 @@ jobs:
entity_jdl: entities-flickr2.jdl
- app_type: OauthApp
auth_type: oauth2
backend: 'false'
dto: false
env:
JHI_REACT_NATIVE_APP_NAME: ${{ matrix.app_type }}
Expand All @@ -85,6 +86,7 @@ jobs:
PLATFORM: ios
JHI_RECORD_VIDEO: ${{ github.event.inputs.recordVideo || 'false' }}
JHI_SCREENSHOTS: ${{ github.event.inputs.screenshots || 'false' }}
FORCE_COLOR: true
steps:
- uses: jhipster/actions/create-app-path@v0
with:
Expand Down Expand Up @@ -140,21 +142,25 @@ jobs:
cmd: cli.cjs --force --skip-install
- run: npm install
if: steps.compare.outputs.equals != 'true'
- run: $SCRIPT_DIR/run-detox-tests.sh
name: 'TESTING: run detox tests'
if: steps.compare.outputs.equals != 'true'
timeout-minutes: 35
- run: $SCRIPT_DIR/rename-detox-screenshots.sh
name: 'TESTING: rename detox screenshots to a valid filename'
if: steps.compare.outputs.equals != 'true'
- run: npx expo prebuild -p ios
- run: git add . && git diff
- run: npm run e2e:build:ios
- run: |
npm run app:start &
npm install -g wait-on
wait-on -t 60000 http-get://127.0.0.1:8080/management/health
if: matrix.backend != 'false'
working-directory: ${{ github.workspace }}/backend
- run: npm run e2e:test:ios
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: expo-app-${{ matrix.app_type }}-${{ matrix.jhipster_version }}
path: |
${{ runner.workspace }}/${{ matrix.app_type }}/
!${{ runner.workspace }}/${{ matrix.app_type }}/node_modules
!${{ runner.workspace }}/${{ matrix.app_type }}/e2e/Exponent.app
${{ github.workspace }}/client/
!${{ github.workspace }}/**/android
!${{ github.workspace }}/**/ios
!${{ github.workspace }}/**/node_modules
ios-result:
permissions:
contents: none
Expand Down
12 changes: 6 additions & 6 deletions generators/app/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`SubGenerator app of reactNative JHipster blueprint > run > should succeed 1`] = `
{
"../client/.detoxrc.json": {
"../client/.detoxrc.cjs": {
"stateCleared": "modified",
},
"../client/.editorconfig": {
Expand Down Expand Up @@ -362,10 +362,10 @@ exports[`SubGenerator app of reactNative JHipster blueprint > run > should succe
"../client/e2e/account/settings-screen.spec.js": {
"stateCleared": "modified",
},
"../client/e2e/config.json": {
"../client/e2e/home-screen.spec.js": {
"stateCleared": "modified",
},
"../client/e2e/home-screen.spec.js": {
"../client/e2e/jest.config.cjs": {
"stateCleared": "modified",
},
"../client/e2e/scripts/download-expo.sh": {
Expand Down Expand Up @@ -496,7 +496,7 @@ exports[`SubGenerator app of reactNative JHipster blueprint > run > should succe

exports[`SubGenerator app of reactNative JHipster blueprint > with custom reactNative path > should succeed 1`] = `
{
"../reactNative-app/.detoxrc.json": {
"../reactNative-app/.detoxrc.cjs": {
"stateCleared": "modified",
},
"../reactNative-app/.editorconfig": {
Expand Down Expand Up @@ -856,10 +856,10 @@ exports[`SubGenerator app of reactNative JHipster blueprint > with custom reactN
"../reactNative-app/e2e/account/settings-screen.spec.js": {
"stateCleared": "modified",
},
"../reactNative-app/e2e/config.json": {
"../reactNative-app/e2e/home-screen.spec.js": {
"stateCleared": "modified",
},
"../reactNative-app/e2e/home-screen.spec.js": {
"../reactNative-app/e2e/jest.config.cjs": {
"stateCleared": "modified",
},
"../reactNative-app/e2e/scripts/download-expo.sh": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`SubGenerator reactNative of reactNative JHipster blueprint > Entity Test: Search Engine Disabled, Detox Enabled > should succeed 1`] = `
{
".detoxrc.json": {
".detoxrc.cjs": {
"stateCleared": "modified",
},
".editorconfig": {
Expand Down Expand Up @@ -395,15 +395,15 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > Entity Tes
"e2e/account/settings-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/config.json": {
"stateCleared": "modified",
},
"e2e/entities/foo.spec.js": {
"stateCleared": "modified",
},
"e2e/home-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/jest.config.cjs": {
"stateCleared": "modified",
},
"e2e/scripts/download-expo.sh": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -978,7 +978,7 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > Entity Tes

exports[`SubGenerator reactNative of reactNative JHipster blueprint > Entity Test: Search Engine and Detox Enabled > should succeed 1`] = `
{
".detoxrc.json": {
".detoxrc.cjs": {
"stateCleared": "modified",
},
".editorconfig": {
Expand Down Expand Up @@ -1374,15 +1374,15 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > Entity Tes
"e2e/account/settings-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/config.json": {
"stateCleared": "modified",
},
"e2e/entities/foo.spec.js": {
"stateCleared": "modified",
},
"e2e/home-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/jest.config.cjs": {
"stateCleared": "modified",
},
"e2e/scripts/download-expo.sh": {
"stateCleared": "modified",
},
Expand Down
18 changes: 9 additions & 9 deletions generators/react-native/__snapshots__/generator.spec.mjs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket

exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket Disabled, JWT Authentication, With Detox Test > should succeed 1`] = `
{
".detoxrc.json": {
".detoxrc.cjs": {
"stateCleared": "modified",
},
".editorconfig": {
Expand Down Expand Up @@ -796,10 +796,10 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket
"e2e/account/settings-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/config.json": {
"e2e/home-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/home-screen.spec.js": {
"e2e/jest.config.cjs": {
"stateCleared": "modified",
},
"e2e/scripts/download-expo.sh": {
Expand Down Expand Up @@ -1355,7 +1355,7 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket

exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket Enabled with Spring, JWT Authentication, With Detox Test > should succeed 1`] = `
{
".detoxrc.json": {
".detoxrc.cjs": {
"stateCleared": "modified",
},
".editorconfig": {
Expand Down Expand Up @@ -1730,10 +1730,10 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket
"e2e/account/settings-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/config.json": {
"e2e/home-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/home-screen.spec.js": {
"e2e/jest.config.cjs": {
"stateCleared": "modified",
},
"e2e/scripts/download-expo.sh": {
Expand Down Expand Up @@ -2256,7 +2256,7 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket

exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket Enabled with Spring, OAuth2 Authentication, With Detox Test > should succeed 1`] = `
{
".detoxrc.json": {
".detoxrc.cjs": {
"stateCleared": "modified",
},
".editorconfig": {
Expand Down Expand Up @@ -2595,10 +2595,10 @@ exports[`SubGenerator reactNative of reactNative JHipster blueprint > WebSocket
"babel.config.js": {
"stateCleared": "modified",
},
"e2e/config.json": {
"e2e/home-screen.spec.js": {
"stateCleared": "modified",
},
"e2e/home-screen.spec.js": {
"e2e/jest.config.cjs": {
"stateCleared": "modified",
},
"e2e/scripts/download-expo.sh": {
Expand Down
4 changes: 2 additions & 2 deletions generators/react-native/files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ const files = {
{
condition: context => context.detox === true,
templates: [
'.detoxrc.json',
'e2e/config.json',
'.detoxrc.cjs',
'e2e/jest.config.cjs',
'e2e/home-screen.spec.js',
'e2e/utils.js',
'e2e/scripts/download-expo.sh',
Expand Down
83 changes: 83 additions & 0 deletions generators/react-native/templates/.detoxrc.cjs.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/** @type {Detox.DetoxConfig} */
module.exports = {
testRunner: {
args: {
'$0': 'jest',
config: 'e2e/jest.config.cjs'
},
jest: {
setupTimeout: 120000
}
},
apps: {
'ios.debug': {
type: 'ios.app',
binaryPath: 'e2e/Exponent.app',
build: 'xcodebuild -workspace ios/<%- baseName %>.xcworkspace -scheme <%- baseName %> -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build'
},
'ios.release': {
type: 'ios.app',
binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/<%- baseName %>.app',
build: 'xcodebuild -workspace ios/<%- baseName %>.xcworkspace -scheme <%- baseName %> -configuration Release -sdk iphonesimulator -derivedDataPath ios/build'
},
'android.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
reversePorts: [
8081
]
},
'android.release': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
build: 'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release'
}
},
devices: {
simulator: {
type: 'ios.simulator',
device: {
type: 'iPhone 15'
}
},
attached: {
type: 'android.attached',
device: {
adbName: '.*'
}
},
emulator: {
type: 'android.emulator',
device: {
avdName: 'Pixel_3a_API_30_x86'
}
}
},
configurations: {
'ios.sim.debug': {
device: 'simulator',
app: 'ios.debug'
},
'ios.sim.release': {
device: 'simulator',
app: 'ios.release'
},
'android.att.debug': {
device: 'attached',
app: 'android.debug'
},
'android.att.release': {
device: 'attached',
app: 'android.release'
},
'android.emu.debug': {
device: 'emulator',
app: 'android.debug'
},
'android.emu.release': {
device: 'emulator',
app: 'android.release'
}
}
};
44 changes: 0 additions & 44 deletions generators/react-native/templates/.detoxrc.json.ejs

This file was deleted.

12 changes: 0 additions & 12 deletions generators/react-native/templates/e2e/config.json.ejs

This file was deleted.

12 changes: 12 additions & 0 deletions generators/react-native/templates/e2e/jest.config.cjs.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
rootDir: '..',
testMatch: ['<rootDir>/e2e/**/*.spec.js'],
testTimeout: 120000,
maxWorkers: 1,
globalSetup: 'detox/runners/jest/globalSetup',
globalTeardown: 'detox/runners/jest/globalTeardown',
reporters: ['detox/runners/jest/reporter'],
testEnvironment: 'detox/runners/jest/testEnvironment',
verbose: true,
};
Loading
Loading