detox 20.9.0 → 21.0.0-rc.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0-javadoc.jar → 21.0.0-rc.0/detox-21.0.0-rc.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0-sources.jar → 21.0.0-rc.0/detox-21.0.0-rc.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0.pom → 21.0.0-rc.0/detox-21.0.0-rc.0.pom} +1 -1
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-rc.0/detox-21.0.0-rc.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-framework.tbz +0 -0
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios-xcuitest.tbz +0 -0
- package/local-cli/build-framework-cache.js +1 -1
- package/local-cli/build-xcuitest-cache.js +16 -0
- package/local-cli/clean-framework-cache.js +1 -1
- package/local-cli/clean-xcuitest-cache.js +19 -0
- package/local-cli/rebuild-framework-cache.js +3 -3
- package/local-cli/rebuild-xcuitest-cache.js +21 -0
- package/package.json +3 -2
- package/scripts/build_framework.ios.sh +26 -60
- package/scripts/build_local_framework.ios.sh +62 -0
- package/scripts/build_local_xcuitest.ios.sh +53 -0
- package/scripts/build_xcuitest.ios.sh +23 -0
- package/scripts/pack_ios.sh +14 -5
- package/scripts/postinstall.js +10 -4
- package/src/client/Client.js +16 -1
- package/src/client/actions/actions.js +38 -0
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +3 -12
- package/src/devices/runtime/RuntimeDevice.js +5 -0
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -0
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +58 -2
- package/src/devices/runtime/drivers/ios/XCUITestUtils.js +209 -0
- package/src/devices/runtime/drivers/ios/allowNetworkPermissionsXCUITest.scpt +14 -0
- package/src/realms/DetoxPrimaryContext.js +2 -1
- package/src/server/DetoxSession.js +3 -0
- package/src/server/DetoxSessionManager.js +1 -0
- package/src/server/handlers/AnonymousConnectionHandler.js +1 -0
- package/src/utils/childProcess/exec.js +3 -1
- package/src/utils/environment.js +25 -1
- package/src/validation/ios/IosSimulatorEnvValidator.js +7 -4
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.9.0/detox-20.9.0.pom.sha512 +0 -1
- package/Detox-ios.tbz +0 -0
- package/scripts/build_universal_framework.sh +0 -14
- package/scripts/build_universal_framework_legacy.sh +0 -76
- package/scripts/build_universal_framework_modern.sh +0 -28
- /package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0.aar → 21.0.0-rc.0/detox-21.0.0-rc.0.aar} +0 -0
- /package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0.aar.md5 → 21.0.0-rc.0/detox-21.0.0-rc.0.aar.md5} +0 -0
- /package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0.aar.sha1 → 21.0.0-rc.0/detox-21.0.0-rc.0.aar.sha1} +0 -0
- /package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0.aar.sha256 → 21.0.0-rc.0/detox-21.0.0-rc.0.aar.sha256} +0 -0
- /package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0.aar.sha512 → 21.0.0-rc.0/detox-21.0.0-rc.0.aar.sha512} +0 -0
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
baeaa847e8b07933a9196e2709a0d1ca
|
@@ -0,0 +1 @@
|
|
1
|
+
32bab4951061cdcfd6468e343e466eef11c77f83
|
@@ -0,0 +1 @@
|
|
1
|
+
bb014ed3c149e55d5b8d935f23073d1f331e65429b4e08902e7fdbe4132abc47
|
@@ -0,0 +1 @@
|
|
1
|
+
194b9a7639c7fc57946f48f42631f27a05c0f40b76d5423680adf8f81e1888aba733f727304de39866ffc3936bec4601dc0a6a5e7edb2f7bc7c033c7a1fa7af5
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
c584b6f2658b7f69fc7eff3078073ac7
|
@@ -0,0 +1 @@
|
|
1
|
+
25f5866687eefc92072df48f039a83cdd9c01920
|
@@ -0,0 +1 @@
|
|
1
|
+
e8e05f7765f67ec70e25b716f2aecbb3f12291718edacf529a6ce233c2a0d8ff
|
@@ -0,0 +1 @@
|
|
1
|
+
b383d1ad33a026c618b714a34d8e74c13deceda321bcaa2c8039f1aa78bf12cddcddd60f5f396cf25b661fb2423523794476ca6cc5b3ee8b2a96923564818905
|
package/Detox-android/com/wix/detox/{20.9.0/detox-20.9.0.pom → 21.0.0-rc.0/detox-21.0.0-rc.0.pom}
RENAMED
@@ -3,7 +3,7 @@
|
|
3
3
|
<modelVersion>4.0.0</modelVersion>
|
4
4
|
<groupId>com.wix</groupId>
|
5
5
|
<artifactId>detox</artifactId>
|
6
|
-
<version>
|
6
|
+
<version>21.0.0-rc.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
|
+
5c56a4ac0d2ed10b75b58b05972b6e18
|
@@ -0,0 +1 @@
|
|
1
|
+
d2c190e331230f514dd4b3d76e0f7a61f5a701e7
|
@@ -0,0 +1 @@
|
|
1
|
+
017b1737afb957c69c05ddd30b6847026d33bbbf26f04c9be5dc1b9ad0dee73d
|
@@ -0,0 +1 @@
|
|
1
|
+
f7b03d096e8f3dda28682f9120d10d14dbe8db1ead87a337fcdb71eae70ea1d9b072049a6f0c7b5be210306ab8fadfdab3011729117bbb20aff447dd2b7f18e7
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<groupId>com.wix</groupId>
|
4
4
|
<artifactId>detox</artifactId>
|
5
5
|
<versioning>
|
6
|
-
<latest>
|
7
|
-
<release>
|
6
|
+
<latest>21.0.0-rc.0</latest>
|
7
|
+
<release>21.0.0-rc.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>
|
9
|
+
<version>21.0.0-rc.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20230511153710</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
7b6098f8f092f7bc592374cba63aad5e
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
1bea3260d9d2db371e06eece061a26c7746d7273
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
d5be2a929ea68d45baa34a5ae791de4757714b2bcf6d1701416f02d4f65e4552
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
b8318205a970d79dd3ac0ae691e59115cc11466e851432df0d399117844a845f1cca601e562004654540eec787cede9dc3d66bfa1a95c292937a38bc0ed6f190
|
Binary file
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
Binary file
|
@@ -9,7 +9,7 @@ module.exports.desc = 'Builds a cached Detox framework for the current environme
|
|
9
9
|
|
10
10
|
module.exports.handler = async function buildFrameworkCache() {
|
11
11
|
if (os.platform() === 'darwin') {
|
12
|
-
cp.execSync(path.join(__dirname, '../scripts/
|
12
|
+
cp.execSync(path.join(__dirname, '../scripts/build_local_framework.ios.sh'), { stdio: 'inherit' });
|
13
13
|
} else {
|
14
14
|
detox.log.info(`The command is supported only on macOS, skipping the execution.`);
|
15
15
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
const cp = require('child_process');
|
2
|
+
const os = require('os');
|
3
|
+
const path = require('path');
|
4
|
+
|
5
|
+
const detox = require('../internals');
|
6
|
+
|
7
|
+
module.exports.command = 'build-xcuitest-cache';
|
8
|
+
module.exports.desc = 'Builds a cached Detox XCUITest-runner for the current environment in ~/Library/Detox. The cached framework is unique for each combination of Xcode and Detox version (MacOS only).';
|
9
|
+
|
10
|
+
module.exports.handler = async function buildXCUITestCache() {
|
11
|
+
if (os.platform() === 'darwin') {
|
12
|
+
cp.execSync(path.join(__dirname, '../scripts/build_local_xcuitest.ios.sh'), { stdio: 'inherit' });
|
13
|
+
} else {
|
14
|
+
detox.log.info(`The command is supported only on MacOS, skipping the execution.`);
|
15
|
+
}
|
16
|
+
};
|
@@ -10,7 +10,7 @@ module.exports.desc = "Deletes all Detox cached frameworks from ~/Library/Detox.
|
|
10
10
|
|
11
11
|
module.exports.handler = async function cleanFrameworkCache() {
|
12
12
|
if (os.platform() === 'darwin') {
|
13
|
-
const frameworkPath = path.join(os.homedir(), '/Library/Detox');
|
13
|
+
const frameworkPath = path.join(os.homedir(), '/Library/Detox/ios/framework');
|
14
14
|
detox.log.info(`Removing framework binaries from ${frameworkPath}`);
|
15
15
|
await fs.remove(frameworkPath);
|
16
16
|
} else {
|
@@ -0,0 +1,19 @@
|
|
1
|
+
const os = require('os');
|
2
|
+
const path = require('path');
|
3
|
+
|
4
|
+
const fs = require('fs-extra');
|
5
|
+
|
6
|
+
const detox = require('../internals');
|
7
|
+
|
8
|
+
module.exports.command = 'clean-xcuitest-cache';
|
9
|
+
module.exports.desc = "Deletes all Detox cached XCUITest-runners from ~/Library/Detox. Cached framework can be rebuilt using the 'build-xcuitest-cache' command (MacOS only).";
|
10
|
+
|
11
|
+
module.exports.handler = async function cleanXCUITestCache() {
|
12
|
+
if (os.platform() === 'darwin') {
|
13
|
+
const frameworkPath = path.join(os.homedir(), '/Library/Detox/ios/xcuitest-runner');
|
14
|
+
detox.log.info(`Removing XCUITest-runner binaries from ${frameworkPath}`);
|
15
|
+
await fs.remove(frameworkPath);
|
16
|
+
} else {
|
17
|
+
detox.log.info(`The command is supported only on MacOS, skipping the execution.`);
|
18
|
+
}
|
19
|
+
};
|
@@ -9,12 +9,12 @@ const log = require('../src/utils/logger').child({ cat: 'cli' });
|
|
9
9
|
module.exports.command = 'rebuild-framework-cache';
|
10
10
|
module.exports.desc = 'Rebuilds a cached Detox framework for the current environment in ~/Library/Detox. The cached framework is unique for each combination of Xcode and Detox version. (macOS only)';
|
11
11
|
|
12
|
-
module.exports.handler = async function
|
12
|
+
module.exports.handler = async function rebuildFrameworkCache() {
|
13
13
|
if (os.platform() === 'darwin') {
|
14
|
-
const frameworkPath = path.join(os.homedir(), '/Library/Detox');
|
14
|
+
const frameworkPath = path.join(os.homedir(), '/Library/Detox/ios/framework');
|
15
15
|
log.info(`Removing framework binaries from ${frameworkPath}`);
|
16
16
|
await fs.remove(frameworkPath);
|
17
|
-
cp.execSync(path.join(__dirname, '../scripts/
|
17
|
+
cp.execSync(path.join(__dirname, '../scripts/build_local_framework.ios.sh'), { stdio: 'inherit' });
|
18
18
|
} else {
|
19
19
|
log.info(`The command is supported only on macOS, skipping the execution.`);
|
20
20
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
const cp = require('child_process');
|
2
|
+
const os = require('os');
|
3
|
+
const path = require('path');
|
4
|
+
|
5
|
+
const fs = require('fs-extra');
|
6
|
+
|
7
|
+
const log = require('../src/utils/logger').child({ cat: 'cli' });
|
8
|
+
|
9
|
+
module.exports.command = 'rebuild-xcuitest-cache';
|
10
|
+
module.exports.desc = 'Rebuilds a cached Detox XCUITest-runner for the current environment in ~/Library/Detox. The cached runner is unique for each combination of Xcode and Detox version (MacOS only).';
|
11
|
+
|
12
|
+
module.exports.handler = async function rebuildXCUITestCache() {
|
13
|
+
if (os.platform() === 'darwin') {
|
14
|
+
const frameworkPath = path.join(os.homedir(), '/Library/Detox/ios/xcuitest-runner');
|
15
|
+
log.info(`Removing runner binaries from ${frameworkPath}`);
|
16
|
+
await fs.remove(frameworkPath);
|
17
|
+
cp.execSync(path.join(__dirname, '../scripts/build_local_xcuitest.ios.sh'), { stdio: 'inherit' });
|
18
|
+
} else {
|
19
|
+
log.info(`The command is supported only on MacOS, skipping the execution.`);
|
20
|
+
}
|
21
|
+
};
|
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": "
|
4
|
+
"version": "21.0.0-rc.0",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -76,6 +76,7 @@
|
|
76
76
|
"multi-sort-stream": "^1.0.3",
|
77
77
|
"multipipe": "^4.0.0",
|
78
78
|
"node-ipc": "9.2.1",
|
79
|
+
"node-osascript": "^2.1.0",
|
79
80
|
"proper-lockfile": "^3.0.2",
|
80
81
|
"resolve-from": "^5.0.0",
|
81
82
|
"sanitize-filename": "^1.6.1",
|
@@ -202,5 +203,5 @@
|
|
202
203
|
}
|
203
204
|
}
|
204
205
|
},
|
205
|
-
"gitHead": "
|
206
|
+
"gitHead": "1ce46f1d465acddcab5b74337ca8b0ed22be1b33"
|
206
207
|
}
|
@@ -1,62 +1,28 @@
|
|
1
1
|
#!/bin/bash -e
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
|
30
|
-
function buildFramework () {
|
31
|
-
detoxSourcePath="${1}"
|
32
|
-
echo "Building Detox.framework from ${detoxSourcePath} into ${detoxFrameworkDirPath}"
|
33
|
-
mkdir -p "${detoxFrameworkDirPath}"
|
34
|
-
logPath="${detoxFrameworkDirPath}"/detox_ios.log
|
35
|
-
echo "Build log: ${logPath}"
|
36
|
-
echo -n "" > "${logPath}"
|
37
|
-
"${detoxRootPath}"/scripts/build_universal_framework.sh "${detoxSourcePath}"/Detox.xcodeproj "${detoxFrameworkDirPath}" &> "${logPath}" || {
|
38
|
-
echo -e "#################################\nError building Detox.framework:\n----------------------------------\n"
|
39
|
-
cat "${logPath}"
|
40
|
-
echo "#################################"
|
41
|
-
exit 1
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
function main () {
|
46
|
-
if [ -d "${detoxFrameworkDirPath}" ]; then
|
47
|
-
if [ ! -d "${detoxFrameworkPath}" ]; then
|
48
|
-
echo "${detoxFrameworkDirPath} was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
|
49
|
-
deleting ${detoxFrameworkDirPath} and trying to rebuild."
|
50
|
-
rm -rf "${detoxFrameworkDirPath}"
|
51
|
-
prepareAndBuildFramework
|
52
|
-
else
|
53
|
-
echo "Detox.framework exists, skipping..."
|
54
|
-
fi
|
55
|
-
else
|
56
|
-
prepareAndBuildFramework
|
57
|
-
fi
|
58
|
-
|
59
|
-
echo "Done"
|
60
|
-
}
|
61
|
-
|
62
|
-
main
|
3
|
+
PROJECT=$1
|
4
|
+
FRAMEWORK_OUTPUT_DIR=$2
|
5
|
+
CONFIGURATION=Release
|
6
|
+
PROJECT_NAME=Detox
|
7
|
+
|
8
|
+
# Make sure the output directory exists
|
9
|
+
|
10
|
+
rm -fr "${FRAMEWORK_OUTPUT_DIR}"
|
11
|
+
mkdir -p "${FRAMEWORK_OUTPUT_DIR}"
|
12
|
+
|
13
|
+
# Step 0. Xcode version
|
14
|
+
|
15
|
+
USE_NEW_BUILD_SYSTEM="YES"
|
16
|
+
echo "Using -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM}"
|
17
|
+
|
18
|
+
# Step 1. Build Device and Simulator versions
|
19
|
+
|
20
|
+
BUILD_SIM=`xcodebuild -project "${PROJECT}" -scheme "Detox" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -configuration "${CONFIGURATION}" -sdk iphonesimulator -destination "generic/platform=iOS Simulator" build -showBuildSettings | awk -F= '/TARGET_BUILD_DIR/{x=$NF; gsub(/^[ \t]+|[ \t]+$/,"",x); print x}'`
|
21
|
+
|
22
|
+
echo ${BUILD_SIM}
|
23
|
+
|
24
|
+
xcodebuild -project "${PROJECT}" -scheme "Detox" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -configuration "${CONFIGURATION}" -sdk iphonesimulator -destination "generic/platform=iOS Simulator" build -quiet
|
25
|
+
|
26
|
+
# Step 2. Copy the framework to output folder
|
27
|
+
|
28
|
+
cp -fR "${BUILD_SIM}/${PROJECT_NAME}.framework" "${FRAMEWORK_OUTPUT_DIR}"/
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
# Ensure Xcode is installed or print a warning message and return.
|
4
|
+
xcodebuild -version &>/dev/null || { echo "WARNING: Xcode is not installed on this machine. Skipping iOS framework build phase"; exit 0; }
|
5
|
+
|
6
|
+
detoxRootPath="$(dirname "$(dirname "$0")")"
|
7
|
+
detoxVersion=`node -p "require('${detoxRootPath}/package.json').version"`
|
8
|
+
|
9
|
+
sha1=`(echo "${detoxVersion}" && xcodebuild -version) | shasum | awk '{print $1}' #"${2}"`
|
10
|
+
detoxFrameworkDirPath="$HOME/Library/Detox/ios/framework/${sha1}"
|
11
|
+
detoxFrameworkPath="${detoxFrameworkDirPath}/Detox.framework"
|
12
|
+
|
13
|
+
|
14
|
+
function prepareAndBuildFramework () {
|
15
|
+
if [ -d "$detoxRootPath"/ios ]; then
|
16
|
+
detoxSourcePath="${detoxRootPath}"/ios
|
17
|
+
echo "Dev mode, building from ${detoxSourcePath}"
|
18
|
+
buildFramework "${detoxSourcePath}"
|
19
|
+
else
|
20
|
+
extractFramework
|
21
|
+
fi
|
22
|
+
}
|
23
|
+
|
24
|
+
function extractFramework () {
|
25
|
+
echo "Extracting Detox framework..."
|
26
|
+
mkdir -p "${detoxFrameworkDirPath}"
|
27
|
+
tar -xjf "${detoxRootPath}"/Detox-ios-framework.tbz -C "${detoxFrameworkDirPath}"
|
28
|
+
}
|
29
|
+
|
30
|
+
function buildFramework () {
|
31
|
+
detoxSourcePath="${1}"
|
32
|
+
echo "Building Detox.framework from ${detoxSourcePath} into ${detoxFrameworkDirPath}"
|
33
|
+
mkdir -p "${detoxFrameworkDirPath}"
|
34
|
+
logPath="${detoxFrameworkDirPath}"/detox_ios.log
|
35
|
+
echo "Build log: ${logPath}"
|
36
|
+
echo -n "" > "${logPath}"
|
37
|
+
"${detoxRootPath}"/scripts/build_framework.ios.sh "${detoxSourcePath}"/Detox.xcodeproj "${detoxFrameworkDirPath}" &> "${logPath}" || {
|
38
|
+
echo -e "#################################\nError building Detox.framework:\n----------------------------------\n"
|
39
|
+
cat "${logPath}"
|
40
|
+
echo "#################################"
|
41
|
+
exit 1
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
function main () {
|
46
|
+
if [ -d "${detoxFrameworkDirPath}" ]; then
|
47
|
+
if [ ! -d "${detoxFrameworkPath}" ]; then
|
48
|
+
echo "${detoxFrameworkDirPath} was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
|
49
|
+
deleting ${detoxFrameworkDirPath} and trying to rebuild."
|
50
|
+
rm -rf "${detoxFrameworkDirPath}"
|
51
|
+
prepareAndBuildFramework
|
52
|
+
else
|
53
|
+
echo "Detox.framework exists, skipping..."
|
54
|
+
fi
|
55
|
+
else
|
56
|
+
prepareAndBuildFramework
|
57
|
+
fi
|
58
|
+
|
59
|
+
echo "Done"
|
60
|
+
}
|
61
|
+
|
62
|
+
main
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
# Ensure Xcode is installed or print a warning message and return.
|
4
|
+
xcodebuild -version &>/dev/null || { echo "WARNING: Xcode is not installed on this machine. Skipping iOS xctest runner build phase"; exit 0; }
|
5
|
+
|
6
|
+
detoxRootPath="$(dirname "$(dirname "$0")")"
|
7
|
+
detoxVersion=`node -p "require('${detoxRootPath}/package.json').version"`
|
8
|
+
|
9
|
+
sha1=`(echo "${detoxVersion}" && xcodebuild -version) | shasum | awk '{print $1}' #"${2}"`
|
10
|
+
detoxXctestRunnerDirPath="$HOME/Library/Detox/ios/xcuitest-runner/${sha1}"
|
11
|
+
|
12
|
+
function prepareAndBuildXctestRunner () {
|
13
|
+
if [ -d "$detoxRootPath"/ios ]; then
|
14
|
+
detoxSourcePath="${detoxRootPath}"/ios
|
15
|
+
echo "Dev mode, building XCUITest runner from ${detoxSourcePath}"
|
16
|
+
buildXctestRunner "${detoxSourcePath}"
|
17
|
+
else
|
18
|
+
extractXctestRunner
|
19
|
+
fi
|
20
|
+
}
|
21
|
+
|
22
|
+
function extractXctestRunner () {
|
23
|
+
echo "Extracting Detox XCUITest runner..."
|
24
|
+
mkdir -p "${detoxXctestRunnerDirPath}"
|
25
|
+
tar -xjf "${detoxRootPath}"/Detox-ios-xcuitest.tbz -C "${detoxXctestRunnerDirPath}"
|
26
|
+
}
|
27
|
+
|
28
|
+
function buildXctestRunner () {
|
29
|
+
detoxSourcePath="${1}"
|
30
|
+
echo "Building XCUITest runner from ${detoxSourcePath} into ${detoxXctestRunnerDirPath}"
|
31
|
+
mkdir -p "${detoxXctestRunnerDirPath}"
|
32
|
+
logPath="${detoxXctestRunnerDirPath}"/detox_ios_xcuitest.log
|
33
|
+
echo "Build log: ${logPath}"
|
34
|
+
echo -n "" > "${logPath}"
|
35
|
+
"${detoxRootPath}"/scripts/build_xcuitest.ios.sh "${detoxSourcePath}"/DetoxTester.xcworkspace "${detoxXctestRunnerDirPath}" &> "${logPath}" || {
|
36
|
+
echo -e "#################################\nError building DetoxTester.xctestrun:\n----------------------------------\n"
|
37
|
+
cat "${logPath}"
|
38
|
+
echo "#################################"
|
39
|
+
exit 1
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
function main () {
|
44
|
+
if [ ! -d "${detoxXctestRunnerDirPath}" ]; then
|
45
|
+
prepareAndBuildXctestRunner
|
46
|
+
else
|
47
|
+
echo "XCUITest-runner exists, skipping..."
|
48
|
+
fi
|
49
|
+
|
50
|
+
echo "Done"
|
51
|
+
}
|
52
|
+
|
53
|
+
main
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
WORKSPACE=$1
|
4
|
+
XCUITEST_OUTPUT_DIR=$2
|
5
|
+
CONFIGURATION=Release
|
6
|
+
PROJECT_NAME=DetoxTester
|
7
|
+
|
8
|
+
# Clean up the output directory
|
9
|
+
|
10
|
+
rm -fr "${XCUITEST_OUTPUT_DIR}"
|
11
|
+
|
12
|
+
# Make sure the output directory exists
|
13
|
+
|
14
|
+
mkdir -p "${XCUITEST_OUTPUT_DIR}"
|
15
|
+
|
16
|
+
# Xcode version
|
17
|
+
|
18
|
+
USE_NEW_BUILD_SYSTEM="YES"
|
19
|
+
echo "Using -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM}"
|
20
|
+
|
21
|
+
# Build Simulator version
|
22
|
+
|
23
|
+
xcodebuild -workspace "${WORKSPACE}" -scheme "${PROJECT_NAME}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -configuration "${CONFIGURATION}" -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath "${XCUITEST_OUTPUT_DIR}" -allowProvisioningUpdates build-for-testing -quiet
|
package/scripts/pack_ios.sh
CHANGED
@@ -1,23 +1,32 @@
|
|
1
1
|
#!/bin/bash -e
|
2
2
|
|
3
3
|
rm -rf Detox-ios-src.tbz
|
4
|
-
rm -rf Detox-ios.tbz
|
4
|
+
rm -rf Detox-ios-framework.tbz
|
5
|
+
rm -rf Detox-ios-xcuitest.tbz
|
5
6
|
rm -rf build_temp
|
6
7
|
|
7
8
|
find ./ios -name Build -type d -exec rm -rf {} \;
|
8
9
|
|
9
|
-
#Package sources
|
10
|
+
# Package sources
|
10
11
|
pushd . &> /dev/null
|
11
12
|
cd ios
|
12
13
|
tar --exclude-from=.tbzignore -cjf ../Detox-ios-src.tbz .
|
13
14
|
popd &> /dev/null
|
14
15
|
|
15
|
-
#Package prebuilt framework
|
16
|
+
# Package prebuilt framework
|
16
17
|
mkdir build_temp
|
17
|
-
scripts/
|
18
|
+
scripts/build_framework.ios.sh "ios/Detox.xcodeproj" "build_temp" &> build_temp/detox_ios.log
|
18
19
|
pushd . &> /dev/null
|
19
20
|
cd build_temp
|
20
|
-
tar --exclude-from=../ios/.tbzignore -cjf ../Detox-ios.tbz .
|
21
|
+
tar --exclude-from=../ios/.tbzignore -cjf ../Detox-ios-framework.tbz .
|
21
22
|
popd &> /dev/null
|
22
23
|
|
24
|
+
# Package prebuilt xcuitest runner
|
25
|
+
scripts/build_xcuitest.ios.sh "ios/DetoxTester.xcworkspace" "build_temp" &> build_temp/detox_ios_xcuitest.log
|
26
|
+
pushd . &> /dev/null
|
27
|
+
cd build_temp
|
28
|
+
tar --exclude-from=../ios/.tbzignore -cjf ../Detox-ios-xcuitest.tbz .
|
29
|
+
popd &> /dev/null
|
30
|
+
|
31
|
+
# Cleanup
|
23
32
|
rm -fr build_temp
|
package/scripts/postinstall.js
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
const { platform, env } = process;
|
2
|
+
|
3
|
+
const isDarwin = platform === 'darwin';
|
4
|
+
const shouldInstallDetox = !env.DETOX_DISABLE_POSTINSTALL;
|
5
|
+
|
6
|
+
if (isDarwin && shouldInstallDetox) {
|
7
|
+
const execFileSync = require('child_process').execFileSync;
|
8
|
+
|
9
|
+
execFileSync(`${__dirname}/build_local_framework.ios.sh`, { stdio: 'inherit' });
|
10
|
+
execFileSync(`${__dirname}/build_local_xcuitest.ios.sh`, { stdio: 'inherit' });
|
5
11
|
}
|
package/src/client/Client.js
CHANGED
@@ -72,6 +72,7 @@ class Client {
|
|
72
72
|
async connect() {
|
73
73
|
await this.open();
|
74
74
|
const sessionStatus = await this.sendAction(new actions.Login(this._sessionId));
|
75
|
+
console.log('sessionStatus', sessionStatus);
|
75
76
|
if (sessionStatus.appConnected) {
|
76
77
|
this._onAppConnected();
|
77
78
|
}
|
@@ -186,7 +187,9 @@ class Client {
|
|
186
187
|
this._whenAppIsConnected = new Deferred();
|
187
188
|
this._whenAppIsReady = new Deferred();
|
188
189
|
|
190
|
+
console.warn('App is not connected yet. Waiting for it to connect...');
|
189
191
|
await this._whenAppIsConnected.promise;
|
192
|
+
console.warn('App is connected. Waiting for it to be ready...');
|
190
193
|
// TODO: optimize traffic (!) - we can just listen for 'ready' event
|
191
194
|
// if app always sends it upon load completion. On iOS it works,
|
192
195
|
// but not on Android. Afterwards, this will suffice:
|
@@ -197,6 +200,7 @@ class Client {
|
|
197
200
|
// TODO: move to else branch after the optimization
|
198
201
|
if (!this._whenAppIsReady.isResolved()) {
|
199
202
|
this._whenAppIsReady = new Deferred();
|
203
|
+
console.log('Waiting for app to become ready...');
|
200
204
|
await this.sendAction(new actions.Ready());
|
201
205
|
this._whenAppIsReady.resolve();
|
202
206
|
}
|
@@ -215,6 +219,10 @@ class Client {
|
|
215
219
|
await this.sendAction(new actions.WaitForActive());
|
216
220
|
}
|
217
221
|
|
222
|
+
async sendToHome() {
|
223
|
+
await this.sendAction(new actions.SendToHome());
|
224
|
+
}
|
225
|
+
|
218
226
|
async captureViewHierarchy({ viewHierarchyURL }) {
|
219
227
|
return await this.sendAction(new actions.CaptureViewHierarchy({
|
220
228
|
viewHierarchyURL
|
@@ -233,6 +241,12 @@ class Client {
|
|
233
241
|
await this.sendAction(new actions.Shake());
|
234
242
|
}
|
235
243
|
|
244
|
+
async terminateIfNeeded() {
|
245
|
+
if (this.isConnected) {
|
246
|
+
await this.sendAction(new actions.Terminate());
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
236
250
|
async setOrientation(orientation) {
|
237
251
|
await this.sendAction(new actions.SetOrientation(orientation));
|
238
252
|
}
|
@@ -252,7 +266,7 @@ class Client {
|
|
252
266
|
}
|
253
267
|
|
254
268
|
async terminateApp() {
|
255
|
-
/* see the property injection from
|
269
|
+
/* see the property injection from DetoxWorker.js */
|
256
270
|
}
|
257
271
|
|
258
272
|
_scheduleSlowInvocationQuery() {
|
@@ -302,6 +316,7 @@ class Client {
|
|
302
316
|
}
|
303
317
|
|
304
318
|
_onAppConnected() {
|
319
|
+
console.log('App connected.');
|
305
320
|
if (this._whenAppIsConnected.isPending()) {
|
306
321
|
this._whenAppIsConnected.resolve();
|
307
322
|
} else {
|
@@ -124,6 +124,24 @@ class WaitForActive extends Action {
|
|
124
124
|
}
|
125
125
|
}
|
126
126
|
|
127
|
+
class SendToHome extends Action {
|
128
|
+
constructor() {
|
129
|
+
super('sendToHome');
|
130
|
+
}
|
131
|
+
|
132
|
+
get isAtomic() {
|
133
|
+
return true;
|
134
|
+
}
|
135
|
+
|
136
|
+
get timeout() {
|
137
|
+
return 0;
|
138
|
+
}
|
139
|
+
|
140
|
+
async handle(response) {
|
141
|
+
this.expectResponseOfType(response, 'sendToHomeDone');
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
127
145
|
class Shake extends Action {
|
128
146
|
constructor() {
|
129
147
|
super('shakeDevice');
|
@@ -142,6 +160,24 @@ class Shake extends Action {
|
|
142
160
|
}
|
143
161
|
}
|
144
162
|
|
163
|
+
class Terminate extends Action {
|
164
|
+
constructor() {
|
165
|
+
super('terminate');
|
166
|
+
}
|
167
|
+
|
168
|
+
get isAtomic() {
|
169
|
+
return true;
|
170
|
+
}
|
171
|
+
|
172
|
+
get timeout() {
|
173
|
+
return 0;
|
174
|
+
}
|
175
|
+
|
176
|
+
async handle(response) {
|
177
|
+
this.expectResponseOfType(response, 'willTerminate');
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
145
181
|
class SetOrientation extends Action {
|
146
182
|
constructor(params) {
|
147
183
|
super('setOrientation', params);
|
@@ -325,6 +361,7 @@ module.exports = {
|
|
325
361
|
Login,
|
326
362
|
WaitForBackground,
|
327
363
|
WaitForActive,
|
364
|
+
SendToHome,
|
328
365
|
Ready,
|
329
366
|
Invoke,
|
330
367
|
ReloadReactNative,
|
@@ -336,4 +373,5 @@ module.exports = {
|
|
336
373
|
SetOrientation,
|
337
374
|
SetInstrumentsRecordingState,
|
338
375
|
CaptureViewHierarchy,
|
376
|
+
Terminate,
|
339
377
|
};
|