-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6730 from StoDevX/dependabot/npm_and_yarn/detox-2…
…0.1.2 Bump detox from 19.12.1 to 20.1.2
- Loading branch information
Showing
45 changed files
with
931 additions
and
950 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}, | ||
}, | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
} |
Oops, something went wrong.