Skip to content

Commit

Permalink
added missing mobile-e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
vygandas committed Dec 16, 2023
1 parent d5a996b commit 039d5f2
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/mobile-e2e/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic"
}
]
],
"plugins": []
}
89 changes: 89 additions & 0 deletions apps/mobile-e2e/.detoxrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"testRunner": {
"args": {
"$0": "jest",
"config": "./jest.config.json"
},
"jest": {
"setupTimeout": 120000
}
},
"apps": {
"ios.debug": {
"type": "ios.app",
"build": "cd ../../apps/mobile/ios && xcodebuild -workspace Mobile.xcworkspace -scheme Mobile -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
"binaryPath": "../../apps/mobile/ios/build/Build/Products/Debug-iphonesimulator/Mobile.app"
},
"ios.release": {
"type": "ios.app",
"build": "cd ../../apps/mobile/ios && xcodebuild -workspace Mobile.xcworkspace -scheme Mobile -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
"binaryPath": "../../apps/mobile/ios/build/Build/Products/Release-iphonesimulator/Mobile.app"
},

"ios.local": {
"type": "ios.app",
"build": "yarn nx run mobile:build --platform ios --profile preview --wait --local --no-interactive --output=../../apps/mobile/dist/Mobile.tar.gz",
"binaryPath": "../../apps/mobile/dist/Mobile.app"
},

"android.debug": {
"type": "android.apk",
"build": "cd ../../apps/mobile/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug",
"binaryPath": "../../apps/mobile/android/app/build/outputs/apk/debug/app-debug.apk"
},
"android.release": {
"type": "android.apk",
"build": "cd ../../apps/mobile/android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release",
"binaryPath": "../../apps/mobile/android/app/build/outputs/apk/release/app-release.apk"
},

"android.local": {
"type": "android.apk",
"build": "yarn nx run mobile:build --platform android --profile preview --wait --local --no-interactive --output=../../apps/mobile/dist/Mobile.apk",
"binaryPath": "../../apps/mobile/dist/Mobile.apk"
}
},
"devices": {
"simulator": {
"type": "ios.simulator",
"device": {
"type": "iPhone 14"
}
},
"emulator": {
"type": "android.emulator",
"device": {
"avdName": "Pixel_4a_API_30"
}
}
},
"configurations": {
"ios.sim.release": {
"device": "simulator",
"app": "ios.release"
},
"ios.sim.debug": {
"device": "simulator",
"app": "ios.debug"
},

"ios.sim.local": {
"device": "simulator",
"app": "ios.local"
},

"android.emu.release": {
"device": "emulator",
"app": "android.release"
},
"android.emu.debug": {
"device": "emulator",
"app": "android.debug"
},

"android.emu.local": {
"device": "emulator",
"app": "android.local"
}
}
}
18 changes: 18 additions & 0 deletions apps/mobile-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
22 changes: 22 additions & 0 deletions apps/mobile-e2e/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"preset": "../../jest.preset",
"rootDir": ".",
"testMatch": [
"<rootDir>/src/**/*.test.ts?(x)",
"<rootDir>/src/**/*.spec.ts?(x)"
],
"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,
"setupFilesAfterEnv": ["<rootDir>/test-setup.ts"],
"transform": {
"^.+\\.(ts|js|html)$": [
"ts-jest",
{ "tsconfig": "<rootDir>/tsconfig.e2e.json" }
]
}
}
79 changes: 79 additions & 0 deletions apps/mobile-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "mobile-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/mobile-e2e/src",
"projectType": "application",
"targets": {
"build-ios": {
"executor": "@nx/detox:build",
"options": {
"detoxConfiguration": "ios.sim.local"
},
"configurations": {
"bare": {
"detoxConfiguration": "ios.sim.debug"
},
"production": {
"detoxConfiguration": "ios.sim.release"
}
}
},
"test-ios": {
"executor": "@nx/detox:test",
"options": {
"detoxConfiguration": "ios.sim.local",
"buildTarget": "mobile-e2e:build-ios"
},
"configurations": {
"bare": {
"detoxConfiguration": "ios.sim.debug",
"buildTarget": "mobile-e2e:build-ios:bare"
},
"production": {
"detoxConfiguration": "ios.sim.release",
"buildTarget": "mobile-e2e:build-ios:production"
}
}
},
"build-android": {
"executor": "@nx/detox:build",
"options": {
"detoxConfiguration": "android.emu.local"
},
"configurations": {
"bare": {
"detoxConfiguration": "android.emu.debug"
},
"production": {
"detoxConfiguration": "android.emu.release"
}
}
},
"test-android": {
"executor": "@nx/detox:test",
"options": {
"detoxConfiguration": "android.emu.local",
"buildTarget": "mobile-e2e:build-android"
},
"configurations": {
"bare": {
"detoxConfiguration": "android.emu.debug",
"buildTarget": "mobile-e2e:build-android:bare"
},
"production": {
"detoxConfiguration": "android.emu.release",
"buildTarget": "mobile-e2e:build-android:production"
}
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/mobile/**/*.{ts,tsx,js,jsx}"]
}
}
},
"tags": [],
"implicitDependencies": ["mobile"]
}
11 changes: 11 additions & 0 deletions apps/mobile-e2e/src/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { device, element, by, expect } from 'detox'

describe('Mobile', () => {
beforeEach(async () => {
await device.reloadReactNative()
})

it('should display welcome message', async () => {
await expect(element(by.id('heading'))).toHaveText('Welcome Mobile 👋')
})
})
5 changes: 5 additions & 0 deletions apps/mobile-e2e/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { device } from 'detox'

beforeAll(async () => {
await device.launchApp()
})
10 changes: 10 additions & 0 deletions apps/mobile-e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["node", "jest", "detox"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}
10 changes: 10 additions & 0 deletions apps/mobile-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.e2e.json"
}
]
}

0 comments on commit 039d5f2

Please sign in to comment.