-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support parallel test execution #609
Conversation
doronpr
commented
Mar 6, 2018
- fixed merge issues
- fixed missing coverage warnings
# Conflicts: # detox/src/devices/AppleSimUtils.js # detox/test/package.json
# Conflicts: # detox/src/devices/AppleSimUtils.js # detox/test/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you able to attach to debugger when using jest as test runner ?
detox/test/e2e/config.json
Outdated
"setupTestFrameworkScriptFile" : "./helpers/init.js", | ||
"bail": true, | ||
"verbose": true, | ||
"forceExit": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should validate Detox doesn't leave anything open, and that everything is being closed correctly.
Please remove forceExit
detox/test/e2e/config.json
Outdated
"testEnvironment": "node", | ||
"bail": true, | ||
"verbose": true, | ||
"forceExit": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should validate Detox doesn't leave anything open, and that everything is being closed correctly.
Please remove forceExit
detox/local-cli/detox-test.js
Outdated
cp.execSync(command, {stdio: 'inherit'}); | ||
} | ||
|
||
function runJest() { | ||
const currentConfiguration = config.configurations && config.configurations[program.configuration]; | ||
const maxTestWorkers = _.get(currentConfiguration, 'maxTestWorkers', 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the same way to get configuration on all variables, either move all to _.get
, use getConfigFor
, or "vanilla"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
detox/src/devices/DeviceRegistry.js
Outdated
} | ||
}; | ||
|
||
const writeLockedDevices = lockedDevices => fs.writeFileSync(LOCK_FILE, JSON.stringify(lockedDevices)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use functions instead of consts when declaring functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
detox/src/devices/AppleSimUtils.js
Outdated
const stdout = _.get(result, 'stdout'); | ||
const runtimes = JSON.parse(stdout); | ||
const newestRuntime = _.maxBy(runtimes.runtimes, r => Number(r.version)); | ||
if (newestRuntime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if there no newestRuntime
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. added handling
detox/src/devices/DeviceRegistry.js
Outdated
|
||
async _createDeviceIfNecessary ({deviceIds, deviceType}) { | ||
const numberOfDevicesNeededToCreate = Math.max(this.maxTestRunners - deviceIds.length, 0); | ||
_.times(numberOfDevicesNeededToCreate, async () => await this.createDevice(deviceType)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if xcrun simctl
supports it, we may be able to create all devices simultaneously and use Promise.all to wait for all responses instead of doing them serially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. It's Xcode after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was changed in Earl Grey?
detox/test/package.json
Outdated
"react": "16.2.0", | ||
"react-native": "0.53.3" | ||
"react": "16.0.0", | ||
"react-native": "0.51.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS RN 53 support is supposedly broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what way?
Also, if possible, I would like to understand what the strategy for device creation and reuse is. Perhaps you've discussed it, but I am not in the know. |
detox/src/devices/AppleSimUtils.js
Outdated
const newestRuntime = _.maxBy(runtimes.runtimes, r => Number(r.version)); | ||
if (newestRuntime) { | ||
console.log('Creating simulator', `create "${type}" "${type}" "${newestRuntime.identifier}"`) | ||
await this._execSimctl({cmd: `create "${type}" "${type}" "${newestRuntime.identifier}"`}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name should not be the type:
const name = `detox_${type}_${count}`
await this._execSimctl({cmd: `create "${name}" "${type}" "${newestRuntime.identifier}"`});
Now, when you change the name, you won't be able to query applesimutils
by name anymore. @LeoNatan added query byType and byId. please check the implementation in:
https://github.com/wix/detox/compare/parallelSupport#diff-2ec04c0d120ceb57a189afbc6a59a9e8R27
https://github.com/wix/detox/compare/parallelSupport#diff-2ec04c0d120ceb57a189afbc6a59a9e8R39
detox/src/devices/DeviceRegistry.js
Outdated
} | ||
|
||
async getDevice(deviceType) { | ||
await retry(() => plockfile.lockSync(LOCK_FILE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may want to add Number.MAX_SAFE_INTEGER as retry amount, and reduce the exponential backoff timeouts to minimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
detox/src/devices/DeviceRegistry.js
Outdated
const plockfile = require('proper-lockfile'); | ||
const _ = require('lodash'); | ||
const retry = require('../utils/retry'); | ||
const LOCK_FILE = './device.registry.state.lock'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To support multiple Detox runs (e.g. in a non virtualized CI machine) LOCK_FILE should be added globally. We already create a ~/Library/Detox/
when compiling the framework, I think LOCK_FILE should be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Still missing - DOCS! |
@doronpr, time to stress test some build agents. |