Skip to content

Commit

Permalink
Merge pull request #6730 from StoDevX/dependabot/npm_and_yarn/detox-2…
Browse files Browse the repository at this point in the history
…0.1.2

Bump detox from 19.12.1 to 20.1.2
  • Loading branch information
hawkrives authored Jan 21, 2023
2 parents abc23c3 + a8c1d47 commit 1c5e1c6
Show file tree
Hide file tree
Showing 45 changed files with 931 additions and 950 deletions.
73 changes: 0 additions & 73 deletions .detoxrc.js

This file was deleted.

14 changes: 1 addition & 13 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,12 @@ jobs:
with:
cache_key: ${{ matrix.os }}
- run: sudo xcode-select -s /Applications/Xcode_13.1.app
- run: git fetch --prune --unshallow
- run: npm ci
env:
SKIP_POSTINSTALL: '1'
- run: bundle exec pod install --deployment
working-directory: ./ios
- run: brew tap wix/brew
- run: brew install applesimutils
- run: bundle exec fastlane ios ci-run
env:
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
GIT_COMMIT_DESC: $(git log --format=oneline -n 1 $GITHUB_SHA)
FASTLANE_SKIP_UPDATE_CHECK: '1'
FASTLANE_DISABLE_ANIMATION: '1'
SENTRY_ORG: frog-pond-labs
SENTRY_PROJECT: all-about-olaf
SENTRY_AUTH_TOKEN: ${{ secrets.HOSTED_SENTRY_AUTH_TOKEN }}
GITHUB_KEYS_REPOSITORY_TOKEN: ${{ secrets.GITHUB_KEYS_REPOSITORY_TOKEN }}
- run: npx detox build e2e --configuration ios.sim.release
- run: npx detox test e2e --configuration ios.sim.release --cleanup
- run: npx detox test e2e --configuration ios.sim.release --cleanup --debug-synchronization 500
112 changes: 112 additions & 0 deletions detox.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// @ts-check
/* eslint-disable @typescript-eslint/no-var-requires */

/**
* @typedef { 'Debug' | 'Release' } Configuration
*/

const fs = require('node:fs')
const process = require('node:process')
const path = require('node:path')

/**
* @returns {string}
*/
function findCurrentDeploymentTarget() {
let pbxproj = fs.readFileSync(
path.join(__dirname, 'ios', 'AllAboutOlaf.xcodeproj', 'project.pbxproj'),
{encoding: 'utf-8'},
)

const target = pbxproj
.split('\n')
.find((line) => line.includes('IPHONEOS_DEPLOYMENT_TARGET'))
?.replace(/.*IPHONEOS_DEPLOYMENT_TARGET = (.*?);/u, '$1')

if (!target || !/\d+[.]\d+/u.test(target)) {
console.error(
`Could not find valid IPHONEOS_DEPLOYMENT_TARGET; found ${target}`,
)
process.exit(1)
}

return target
}

const iPhoneSimulatorDevice = 'iPhone 11 Pro'
const currentDeploymentTarget = findCurrentDeploymentTarget()

/**
* @param {Configuration} configuration
* @returns {string}
*/
function generateBuildCommand(configuration) {
return [
'xcodebuild',
'-workspace ios/AllAboutOlaf.xcworkspace',
'-scheme AllAboutOlaf',
`-configuration ${configuration}`,
`-destination 'platform=iOS Simulator,name=${iPhoneSimulatorDevice},OS=${currentDeploymentTarget}'`,
'-derivedDataPath ios/build',
'build',
].join(' ')
}

/**
* @param {Configuration} configuration
* @returns {string}
*/
function generateBinaryPath(configuration) {
return path.join(
'ios',
'build',
'Build',
'Products',
`${configuration}-iphonesimulator`,
'AllAboutOlaf.app',
)
}

module.exports = {
testRunner: {
$0: 'jest',
args: {
config: 'e2e/jest.config.js',
_: 'e2e',
},
},

configurations: {
'ios.sim.debug': {
device: 'ios.simulator',
app: 'ios.sim.debug',
},
'ios.sim.release': {
device: 'ios.simulator',
app: 'ios.sim.release',
},
},

apps: {
'ios.sim.debug': {
type: 'ios.app',
binaryPath: generateBinaryPath('Debug'),
build: generateBuildCommand('Debug'),
},
'ios.sim.release': {
type: 'ios.app',
binaryPath: generateBinaryPath('Release'),
build: generateBuildCommand('Release'),
},
},

devices: {
'ios.simulator': {
type: 'ios.simulator',
device: {
type: iPhoneSimulatorDevice,
os: currentDeploymentTarget,
},
},
},
}
25 changes: 0 additions & 25 deletions e2e/basic-smoke.spec.js

This file was deleted.

29 changes: 29 additions & 0 deletions e2e/basic-smoke.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {beforeAll, beforeEach, test} from '@jest/globals'
import {by, device, element, expect} from 'detox'

// launch the app once - do this per-test-file to grant only the permissions
// needed for a given test
beforeAll(async () => {
await device.launchApp()
})

// in this file, only reload the rn stuff between tests
beforeEach(async () => {
await device.reloadReactNative()
})

test('should show the home screen', async () => {
await expect(element(by.id('screen-homescreen'))).toBeVisible()
})

test('should show the settings screen after tap', async () => {
await element(by.id('button-open-settings')).tap()
await expect(element(by.text('Sign In to St. Olaf'))).toBeVisible()
})

test('should show home screen after tap to exit settings screen', async () => {
await element(by.id('button-open-settings')).tap()
await expect(element(by.id('screen-homescreen'))).not.toBeVisible()
await element(by.id('button-close-screen')).tap()
await expect(element(by.id('screen-homescreen'))).toBeVisible()
})
13 changes: 0 additions & 13 deletions e2e/config.json

This file was deleted.

22 changes: 0 additions & 22 deletions e2e/environment.js

This file was deleted.

7 changes: 0 additions & 7 deletions e2e/init.js
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
/* eslint-env jest */

import {device} from 'detox'

beforeAll(async () => {
await device.launchApp()
})
13 changes: 13 additions & 0 deletions e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
preset: 'ts-jest',
maxWorkers: 1,
rootDir: '..',
testMatch: ['<rootDir>/e2e/**/*.(test|spec).ts'],
setupFilesAfterEnv: ['<rootDir>/e2e/init.js'],
testTimeout: 120000,
verbose: true,
reporters: ['detox/runners/jest/reporter'],
globalSetup: 'detox/runners/jest/globalSetup',
globalTeardown: 'detox/runners/jest/globalTeardown',
testEnvironment: 'detox/runners/jest/testEnvironment',
}
Loading

0 comments on commit 1c5e1c6

Please sign in to comment.