detox 20.4.0 → 20.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/Detox-android/com/wix/detox/{20.4.0/detox-20.4.0-javadoc.jar → 20.5.0/detox-20.5.0-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0-javadoc.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{20.4.0/detox-20.4.0-sources.jar → 20.5.0/detox-20.5.0-sources.jar} +0 -0
  7. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{20.4.0/detox-20.4.0.pom → 20.5.0/detox-20.5.0.pom} +1 -1
  12. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0.pom.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0.pom.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0.pom.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.5.0/detox-20.5.0.pom.sha512 +1 -0
  16. package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
  17. package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
  18. package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
  19. package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
  20. package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
  21. package/Detox-ios-src.tbz +0 -0
  22. package/Detox-ios.tbz +0 -0
  23. package/index.d.ts +2 -0
  24. package/local-cli/cli.js +1 -1
  25. package/local-cli/init.js +2 -2
  26. package/local-cli/start.js +49 -0
  27. package/local-cli/startCommand/AppStartCommand.js +65 -0
  28. package/local-cli/testCommand/TestRunnerCommand.js +29 -0
  29. package/local-cli/testCommand/builder.js +5 -0
  30. package/package.json +3 -2
  31. package/src/configuration/collectCliConfig.js +1 -0
  32. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0-javadoc.jar.md5 +0 -1
  33. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0-javadoc.jar.sha1 +0 -1
  34. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0-javadoc.jar.sha256 +0 -1
  35. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0-javadoc.jar.sha512 +0 -1
  36. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0-sources.jar.md5 +0 -1
  37. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0-sources.jar.sha1 +0 -1
  38. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0-sources.jar.sha256 +0 -1
  39. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0-sources.jar.sha512 +0 -1
  40. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0.pom.md5 +0 -1
  41. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0.pom.sha1 +0 -1
  42. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0.pom.sha256 +0 -1
  43. package/Detox-android/com/wix/detox/20.4.0/detox-20.4.0.pom.sha512 +0 -1
  44. /package/Detox-android/com/wix/detox/{20.4.0/detox-20.4.0.aar → 20.5.0/detox-20.5.0.aar} +0 -0
  45. /package/Detox-android/com/wix/detox/{20.4.0/detox-20.4.0.aar.md5 → 20.5.0/detox-20.5.0.aar.md5} +0 -0
  46. /package/Detox-android/com/wix/detox/{20.4.0/detox-20.4.0.aar.sha1 → 20.5.0/detox-20.5.0.aar.sha1} +0 -0
  47. /package/Detox-android/com/wix/detox/{20.4.0/detox-20.4.0.aar.sha256 → 20.5.0/detox-20.5.0.aar.sha256} +0 -0
  48. /package/Detox-android/com/wix/detox/{20.4.0/detox-20.4.0.aar.sha512 → 20.5.0/detox-20.5.0.aar.sha512} +0 -0
@@ -0,0 +1 @@
1
+ 312ca2e6d26a005375c7d31f7a489b60
@@ -0,0 +1 @@
1
+ 80debe0a3a1ed317173f56f92cbfd1f108f3fb6c
@@ -0,0 +1 @@
1
+ ceeb582236c99040fb116be37c6eb97c67ecdf91f8cdd1d5dade614a3180375c
@@ -0,0 +1 @@
1
+ 08dcd64b4e65c486a7fe0d4a59b23e4b9ffc037b4afad03db9cb820b97867e22693d929b7e896f41c11c8a4e3e0d0dbbc11799a69f438d46aeeb8ebb8b157056
@@ -0,0 +1 @@
1
+ 643850c6dad298f22d9ce657af17dd5c
@@ -0,0 +1 @@
1
+ e483f7ab88c2b2d5882d1c825155856c61ba059f
@@ -0,0 +1 @@
1
+ 2ee1a851c254668619e44df167d0b1d86bd63edb9414a239f1fcea380c39a077
@@ -0,0 +1 @@
1
+ 3446a90564f2af11a6b6221f114ccd8786044080e222ed698fef6a92d706faed154fdaa976c0dca162db58976170a60b7bc05d5e931a1b1bbf02ff8292d0c47c
@@ -3,7 +3,7 @@
3
3
  <modelVersion>4.0.0</modelVersion>
4
4
  <groupId>com.wix</groupId>
5
5
  <artifactId>detox</artifactId>
6
- <version>20.4.0</version>
6
+ <version>20.5.0</version>
7
7
  <packaging>aar</packaging>
8
8
  <name>Detox</name>
9
9
  <description>Gray box end-to-end testing and automation library for mobile apps</description>
@@ -0,0 +1 @@
1
+ e6f8b937b6573484515f78adcc830096
@@ -0,0 +1 @@
1
+ 59e4b461ba168a526c1c629fb29ded508472e732
@@ -0,0 +1 @@
1
+ b455e110295c40221b1620cfe6ffc905fc9623b36a5f38fabf52316def1f9749
@@ -0,0 +1 @@
1
+ 766004a843b60ee7b385f26324762d8f18d35064324fb7ab5c24e59816869745401dafbfc3517ff55948527fd0411a2b9382b3f29de8aa6756e61df58a3c416c
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>20.4.0</latest>
7
- <release>20.4.0</release>
6
+ <latest>20.5.0</latest>
7
+ <release>20.5.0</release>
8
8
  <versions>
9
- <version>20.4.0</version>
9
+ <version>20.5.0</version>
10
10
  </versions>
11
- <lastUpdated>20230228144344</lastUpdated>
11
+ <lastUpdated>20230304081841</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- cdc80e0982319a663e6f0e4ac720d785
1
+ 7ef4d0c49e15b7641923a73bf049cb58
@@ -1 +1 @@
1
- 5cd147e3e28a8e1ae4b256edfabaac149e2c1387
1
+ 7612e7860c59949c39e71cd063713aa3a3fc9022
@@ -1 +1 @@
1
- 0fd84cc6744732697aa0a9769b6febb6b432d765b4223b48c34a6b3bfd240483
1
+ 1c0015aa8cdb2feaedfea04b080a429eac94a39c39220f67eb46dcd205ff136b
@@ -1 +1 @@
1
- 452aea17d2dbacd7d844c8f9d370c9931ae1196ac85020666f60ed7d8ddfc561d783abcec6f3c3b6b3a677be57cdf0a8966fc8254876e079e4c2d5dd0a229288
1
+ 585e914dd526582d4dc520c65d85c69d5ec7ad6abcac74db26832293e300ecf64241d0d1a4814b2b9627125cc02ffbee8964b23783a016233c6ba5676989952c
package/Detox-ios-src.tbz CHANGED
Binary file
package/Detox-ios.tbz CHANGED
Binary file
package/index.d.ts CHANGED
@@ -331,6 +331,7 @@ declare global {
331
331
  binaryPath: string;
332
332
  bundleId?: string;
333
333
  build?: string;
334
+ start?: string;
334
335
  launchArgs?: Record<string, any>;
335
336
  }
336
337
 
@@ -339,6 +340,7 @@ declare global {
339
340
  binaryPath: string;
340
341
  bundleId?: string;
341
342
  build?: string;
343
+ start?: string;
342
344
  testBinaryPath?: string;
343
345
  launchArgs?: Record<string, any>;
344
346
  /**
package/local-cli/cli.js CHANGED
@@ -12,7 +12,7 @@ const { isErrorAlreadyLogged } = require('./utils/cliErrorHandling');
12
12
  yargs
13
13
  .scriptName('detox')
14
14
  .parserConfiguration({
15
- 'boolean-negation': false,
15
+ 'boolean-negation': true,
16
16
  'camel-case-expansion': false,
17
17
  'dot-notation': false,
18
18
  'duplicate-arguments-array': false,
package/local-cli/init.js CHANGED
@@ -93,13 +93,13 @@ function createDefaultConfigurations() {
93
93
  'android.debug': {
94
94
  type: 'android.apk',
95
95
  binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
96
- build: 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -',
96
+ build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
97
97
  reversePorts: [8081],
98
98
  },
99
99
  'android.release': {
100
100
  type: 'android.apk',
101
101
  binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
102
- build: 'cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -',
102
+ build: 'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release',
103
103
  },
104
104
  },
105
105
  devices: {
@@ -0,0 +1,49 @@
1
+ const _ = require('lodash');
2
+
3
+ const detox = require('../internals');
4
+
5
+ const AppStartCommand = require('./startCommand/AppStartCommand');
6
+
7
+ module.exports.command = 'start';
8
+ module.exports.desc = 'Run app "start" scripts inside the selected configuration';
9
+ module.exports.builder = {
10
+ C: {
11
+ alias: 'config-path',
12
+ describe: 'Specify Detox config file path. If not supplied, Detox searches for .detoxrc[.js] or "detox" section in package.json',
13
+ },
14
+ c: {
15
+ alias: ['configuration'],
16
+ describe:
17
+ 'Select a local configuration from your defined configurations to extract the app "start" scripts from. If not supplied, and there\'s only one configuration, Detox will default to it',
18
+ },
19
+ f: {
20
+ alias: 'force',
21
+ describe: 'Ignore errors from the "start" scripts and proceed',
22
+ boolean: true,
23
+ }
24
+ };
25
+
26
+ module.exports.handler = async function start(argv) {
27
+ const { apps: appsConfig } = await detox.resolveConfig({ argv });
28
+ const startCommands = _(appsConfig)
29
+ .values()
30
+ .map(app => app.start)
31
+ .filter(Boolean)
32
+ .map(cmd => new AppStartCommand({
33
+ cmd,
34
+ passthrough: argv['--'],
35
+ forceSpawn: argv.force,
36
+ }))
37
+ .value();
38
+
39
+ if (startCommands.length) {
40
+ try {
41
+ await Promise.all(startCommands.map(c => c.execute()));
42
+ } catch (e) {
43
+ await Promise.allSettled(startCommands.map(c => c.stop()));
44
+ throw e;
45
+ }
46
+ } else {
47
+ detox.log.warn('No "start" commands were found in the app configs.');
48
+ }
49
+ };
@@ -0,0 +1,65 @@
1
+ const execa = require('execa');
2
+
3
+ const detox = require('../../internals');
4
+ const { DetoxRuntimeError } = require('../../src/errors');
5
+ const Deferred = require('../../src/utils/Deferred');
6
+ const log = detox.log.child({ cat: ['lifecycle', 'cli'] });
7
+
8
+ class AppStartCommand {
9
+ constructor({ cmd, passthrough = [], forceSpawn = false }) {
10
+ this._id = Math.random();
11
+ this._cmd = cmd;
12
+ this._passthrough = passthrough;
13
+ this._forceSpawn = forceSpawn;
14
+
15
+ this._cpHandle = null;
16
+ this._cpDeferred = new Deferred();
17
+ }
18
+
19
+ execute() {
20
+ const cmd = [this._cmd, ...this._passthrough].join(' ');
21
+
22
+ log.info.begin({ id: this._id }, cmd);
23
+
24
+ const onEnd = (msg, code, signal) => {
25
+ log.trace.end({ id: this._id, code, signal }, msg);
26
+ this._cpDeferred.resolve();
27
+ };
28
+
29
+ const onError = (msg, code, signal) => {
30
+ const logLevel = this._forceSpawn ? 'warn' : 'error';
31
+ log[logLevel].end({ id: this._id, code, signal }, msg);
32
+ if (this._forceSpawn) {
33
+ this._cpDeferred.resolve();
34
+ } else {
35
+ this._cpDeferred.reject(new DetoxRuntimeError(msg));
36
+ }
37
+ };
38
+
39
+ this._cpHandle = execa.command(cmd, { stdio: 'inherit', shell: true });
40
+ this._cpHandle.on('error', onError);
41
+ this._cpHandle.on('exit', (code, signal) => {
42
+ const reason = code == null ? `signal ${signal}` : `code ${code}`;
43
+ const msg = `Command exited with ${reason}: ${cmd}`;
44
+ if (signal || code === 0) {
45
+ onEnd(msg, code, signal);
46
+ } else {
47
+ onError(msg, code, signal);
48
+ }
49
+
50
+ this._cpHandle = null;
51
+ });
52
+
53
+ return this._cpDeferred.promise;
54
+ }
55
+
56
+ async stop() {
57
+ if (this._cpHandle) {
58
+ this._cpHandle.kill();
59
+ }
60
+
61
+ return this._cpDeferred.promise;
62
+ }
63
+ }
64
+
65
+ module.exports = AppStartCommand;
@@ -9,6 +9,8 @@ const log = detox.log.child({ cat: ['lifecycle', 'cli'] });
9
9
  const { printEnvironmentVariables, prependNodeModulesBinToPATH } = require('../../src/utils/envUtils');
10
10
  const { toSimplePath } = require('../../src/utils/pathUtils');
11
11
  const { escapeSpaces, useForwardSlashes } = require('../../src/utils/shellUtils');
12
+ const sleep = require('../../src/utils/sleep');
13
+ const AppStartCommand = require('../startCommand/AppStartCommand');
12
14
  const { markErrorAsLogged } = require('../utils/cliErrorHandling');
13
15
 
14
16
  const TestRunnerError = require('./TestRunnerError');
@@ -23,11 +25,14 @@ class TestRunnerCommand {
23
25
  const cliConfig = opts.config.cli;
24
26
  const deviceConfig = opts.config.device;
25
27
  const runnerConfig = opts.config.testRunner;
28
+ const appsConfig = opts.config.apps;
26
29
 
27
30
  this._argv = runnerConfig.args;
28
31
  this._retries = runnerConfig.retries;
29
32
  this._envHint = this._buildEnvHint(opts.env);
33
+ this._startCommands = this._prepareStartCommands(appsConfig, cliConfig);
30
34
  this._envFwd = {};
35
+
31
36
  if (runnerConfig.forwardEnv) {
32
37
  this._envFwd = this._buildEnvOverride(cliConfig, deviceConfig);
33
38
  Object.assign(this._envHint, this._envFwd);
@@ -38,6 +43,15 @@ class TestRunnerCommand {
38
43
  let runsLeft = 1 + this._retries;
39
44
  let launchError = null;
40
45
 
46
+ if (this._startCommands.length > 0) {
47
+ try {
48
+ await Promise.race([sleep(1000), ...this._startCommands.map(cmd => cmd.execute())]);
49
+ } catch (e) {
50
+ await Promise.allSettled(this._startCommands.map(cmd => cmd.stop()));
51
+ throw e;
52
+ }
53
+ }
54
+
41
55
  do {
42
56
  try {
43
57
  await this._spawnTestRunner();
@@ -67,6 +81,8 @@ class TestRunnerCommand {
67
81
  }
68
82
  } while (launchError && runsLeft > 0);
69
83
 
84
+ await Promise.allSettled(this._startCommands.map(cmd => cmd.stop()));
85
+
70
86
  if (launchError) {
71
87
  throw launchError;
72
88
  }
@@ -80,6 +96,19 @@ class TestRunnerCommand {
80
96
  .value();
81
97
  }
82
98
 
99
+ _prepareStartCommands(appsConfig, cliConfig) {
100
+ if (`${cliConfig.start}` === 'false') {
101
+ return [];
102
+ }
103
+
104
+ return _.values(appsConfig)
105
+ .filter(app => app.start)
106
+ .map(app => new AppStartCommand({
107
+ cmd: app.start,
108
+ forceSpawn: cliConfig.start === 'force',
109
+ }));
110
+ }
111
+
83
112
  /**
84
113
  * @param {DetoxInternals.CLIConfig} cliConfig
85
114
  * @param {Detox.DetoxDeviceConfig} deviceConfig
@@ -28,6 +28,11 @@ module.exports = {
28
28
  describe: 'Reuse existing installed app (do not delete + reinstall) for a faster run.',
29
29
  boolean: true,
30
30
  },
31
+ start: {
32
+ group: 'Execution:',
33
+ describe: 'Run app "start" scripts before running the tests. Use --no-start to disable that, and --start=force to ignore errors.',
34
+ default: true,
35
+ },
31
36
  u: {
32
37
  alias: 'cleanup',
33
38
  group: 'Execution:',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "detox",
3
3
  "description": "E2E tests and automation for mobile",
4
- "version": "20.4.0",
4
+ "version": "20.5.0",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -63,6 +63,7 @@
63
63
  "caf": "^15.0.1",
64
64
  "chalk": "^2.4.2",
65
65
  "child-process-promise": "^2.2.0",
66
+ "execa": "^5.1.1",
66
67
  "find-up": "^4.1.0",
67
68
  "fs-extra": "^4.0.2",
68
69
  "funpermaproxy": "^1.1.0",
@@ -199,5 +200,5 @@
199
200
  }
200
201
  }
201
202
  },
202
- "gitHead": "9329070b1dca0702015f44b3e75dd11f70651a5b"
203
+ "gitHead": "e7866370faef479abd6ff98aa1607e420d75b9ef"
203
204
  }
@@ -55,6 +55,7 @@ function collectCliConfig({ argv }) {
55
55
  useCustomLogger: asBoolean(get('use-custom-logger')),
56
56
  retries: asNumber(get('retries')),
57
57
  inspectBrk: asBoolean(get('inspect-brk')),
58
+ start: get('start'),
58
59
  }, _.isUndefined);
59
60
  }
60
61
 
@@ -1 +0,0 @@
1
- fe1f11c2f7311ae0f6b13926808a59fc
@@ -1 +0,0 @@
1
- bd54a4027638a599254b2df73919dd4fc2633ec2
@@ -1 +0,0 @@
1
- 7f7ab53c44e53bb959746e8ccc107e3f04d2aca31ec75fb544891db0eb91a476
@@ -1 +0,0 @@
1
- 83af81079557e46d8b995f28b6e8ed8a221d02e9d6319146d978b84df530ff6289806c6b9c13de94cb5023948a986ee8dc8a4dfc15ab8c683af1cb6013e4e1a8
@@ -1 +0,0 @@
1
- 1493e043853c3f2a42d0d63062b796f1
@@ -1 +0,0 @@
1
- a2da124a011cf479474605ddefd629fc192498b4
@@ -1 +0,0 @@
1
- 8d64a4b32323c64dcec482f322d19233577ffc5fe3895e3ca30d9cb220504409
@@ -1 +0,0 @@
1
- 2bb0aaf9f7232f18adcebd3d1fc1424d1d8f1d47892663f962030ef7db1a02eb7943844aa69f14b4ebeb01d0dd562dc0420fb0ff7152a38ca44e1a525a58d745
@@ -1 +0,0 @@
1
- a2316bed8a49f4fd9eb9658c90571244
@@ -1 +0,0 @@
1
- 101c01798b6766fca29a04a0cfc4a236db6416fe
@@ -1 +0,0 @@
1
- cc58b9b38e7a2ea38be0e50f76895e2d01806142ea99293eab307482321586c6
@@ -1 +0,0 @@
1
- df4124c805c1232369779953fb57f1b8d8bb9ee0de3f3e66e72f33254422e2a39a8b76fdbbffef7dc8c796eefce26fbf85723f4e7a28c8b6591d2fe085b89e14