I have a basic app that can be run and works on an iOS simulator but, when I try to run Detox tests, launchingApp seems not to be working. The app is a basic calculator that I can use and perform any manual test. All of the manual tests are working fine, but this is failing:
System (I know there are newer version, but I have to work with this ones if possible)
- Detox: 12.11.3
- react-native-cli: 2.0.1
- react-native: 0.31.0
- Node: 12.16.3
- Device: iOS Simulator (iPhone 8,iOS 13.4)
- Xcode: 11.4.1
- iOS: 13.4
- macOS: 10.15.4
init.js
const detox = require('detox');
const config = require('../package.json').detox;
before(async () => {
console.log("before init");
await detox.init(config, { launchApp: false });
console.log("after init");
});
after(async () => {
await detox.cleanup();
});
sampleTest.spec.js
describe('Basic test', function () {
beforeEach(async () => {
console.log("before app launched");
await device.launchApp({
newInstance: true,
launchArgs: { 'detoxPrintBusyIdleResources': 'YES' }
});
console.log("After app launched");
});
it('2 + 2 = 4', async () => {
console.error("Test case running");
await element(by.id('input-button-2')).tap();
await element(by.id('input-button-+')).tap();
await element(by.id('input-button-2')).tap();
await element(by.id('input-button-=')).tap();
await expect(element(by.id('display-text'))).toHaveText('4');
})
});
package.json
{
"name": "ReactCalculator",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"postinstall": "make postinstall"
},
"dependencies": {
"react": "15.2.1",
"react-native": "0.31.0",
"detox": "^12.11.0",
"mocha": "^6.1.4"
},
"detox": {
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/ReactCalculator.app",
"build": "xcodebuild -project ios/ReactCalculator.xcodeproj -scheme ReactCalculator -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 8,iOS 13.4"
}
},
"test-runner": "mocha",
"runner-config": "./mocha.opts",
"specs": ""
}
}
Log I see in the console
detox test
detox[4407] INFO: [test.js] node_modules/.bin/mocha --opts ./mocha.opts --configuration ios.sim.debug --grep :android: --invert --artifacts-location "artifacts/ios.sim.debug.2020-05-02 16-48-45Z" "e2e"
before init
detox[4408] INFO: [DetoxServer.js] server listening on localhost:53253...
after init
Basic test
before app launched
detox[4408] INFO: [AppleSimUtils.js] org.reactjs.native.example.ReactCalculator launched. To watch simulator logs, run:
/usr/bin/xcrun simctl spawn 410A2B91-5C4B-4DA8-97C9-F16E4EE2A3FB log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/myuser/Library/Developer/CoreSimulator/Devices/410A2B91-5C4B-4DA8-97C9-F16E4EE2A3FB/data/Containers/Bundle/Application/FF32A1C3-F0C5-4847-AD0A-B559FCC4D78E/ReactCalculator.app"'
1) "before each" hook for "2 + 2 = 4"
0 passing (2m)
1 failing
1) Basic test
"before each" hook for "2 + 2 = 4":
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/myuser/Desktop/ReactCalculator 2/e2e/sampleTest.spec.js)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
detox[4407] ERROR: [cli.js] Error: Command failed: node_modules/.bin/mocha --opts ./mocha.opts --configuration ios.sim.debug --grep :android: --invert --artifacts-location "artifacts/ios.sim.debug.2020-05-02 16-48-45Z" "e2e"
I have followed step-by-step this tutorial to install it: Detox getting started
Do someone have a clue of what is going on? I know I am not using the last versions of many dependencies but it is supposed to work like that.
Aucun commentaire:
Enregistrer un commentaire