detox 20.1.2 → 20.1.3
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{20.1.2/detox-20.1.2-javadoc.jar → 20.1.3/detox-20.1.3-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.2/detox-20.1.2-sources.jar → 20.1.3/detox-20.1.3-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.2/detox-20.1.2.aar → 20.1.3/detox-20.1.3.aar} +0 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.2/detox-20.1.2.pom → 20.1.3/detox-20.1.3.pom} +13 -1
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.3/detox-20.1.3.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-src.tbz +0 -0
- package/Detox-ios.tbz +0 -0
- package/android/detox/build.gradle +4 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +31 -0
- package/index.d.ts +8 -5
- package/local-cli/cli.js +4 -3
- package/local-cli/testCommand/TestRunnerCommand.js +2 -1
- package/local-cli/testCommand/TestRunnerError.js +0 -4
- package/local-cli/utils/cliErrorHandling.js +15 -0
- package/package.json +2 -2
- package/src/android/actions/native.js +8 -0
- package/src/android/core/NativeElement.js +11 -0
- package/src/android/espressoapi/DetoxAction.js +25 -0
- package/src/artifacts/utils/temporaryPath.js +2 -4
- package/src/ios/expectTwo.js +4 -0
- package/src/logger/utils/BunyanLogger.js +5 -16
- package/src/logger/utils/streams/DetoxJSONLParser.js +1 -1
- package/src/utils/dateUtils.js +5 -0
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.2/detox-20.1.2.pom.sha512 +0 -1
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
bcf8a491652a4587af90f7471d86c918
|
@@ -0,0 +1 @@
|
|
1
|
+
a27e1b0ebba8a78c1fead39cc3ae78992d9be122
|
@@ -0,0 +1 @@
|
|
1
|
+
1cc7be1fda6c79689fbb5b043b1d0c023898fd3b933071d13db07c601ece44ef
|
@@ -0,0 +1 @@
|
|
1
|
+
7a98b2e5b12d42bfa71727308a37a25e5721f7273c8038c6fd5bd36aa5cdfab370817a1b36b390a6de41c5e5ebf56c40cfe2a4719c2e4010396a93cf6ff4c3e7
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
ad033a32333341b1555fe0e8869518df
|
@@ -0,0 +1 @@
|
|
1
|
+
a314cb2a58f10e7db15e3594bedde463ed5e3865
|
@@ -0,0 +1 @@
|
|
1
|
+
de0f783ca207a9dc24bf260ddcb98ceee0a6cc4489750bcf21b19afaa6bd249e
|
@@ -0,0 +1 @@
|
|
1
|
+
34a1d86b11dee32eceea0da6ff6111109eee96fd2bd5cfdd860097c11903f0572d41da89c5d73439d3e5d59899e7805ad147b492a51338b3ebd28a5a90ec7c7b
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
ba6d4893fdbe2b778912202e1e13fbf1
|
@@ -0,0 +1 @@
|
|
1
|
+
1e12993e69f3154d474125bf35a501a244c9df08
|
@@ -0,0 +1 @@
|
|
1
|
+
070e2120af3c6b260c0ad77e930104edc1c984446da1d91286da8737a18f6bac
|
@@ -0,0 +1 @@
|
|
1
|
+
a8568b2a41c53d5b8a0397f464f0f13bd6d32f1ec167e74f913dd344c6c80476d85e7d6b3e0e9dc4dace448c6e10d0d730453220d6734b9b34aab921094bd7df
|
@@ -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.1.
|
6
|
+
<version>20.1.3</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>
|
@@ -42,6 +42,18 @@
|
|
42
42
|
<version>3.4.0</version>
|
43
43
|
<scope>compile</scope>
|
44
44
|
</dependency>
|
45
|
+
<dependency>
|
46
|
+
<groupId>androidx.test.espresso</groupId>
|
47
|
+
<artifactId>espresso-contrib</artifactId>
|
48
|
+
<version>3.4.0</version>
|
49
|
+
<scope>compile</scope>
|
50
|
+
<exclusions>
|
51
|
+
<exclusion>
|
52
|
+
<groupId>org.checkerframework</groupId>
|
53
|
+
<artifactId>checker</artifactId>
|
54
|
+
</exclusion>
|
55
|
+
</exclusions>
|
56
|
+
</dependency>
|
45
57
|
<dependency>
|
46
58
|
<groupId>androidx.test</groupId>
|
47
59
|
<artifactId>rules</artifactId>
|
@@ -0,0 +1 @@
|
|
1
|
+
318848aa7138ca5330521a52db2b69bd
|
@@ -0,0 +1 @@
|
|
1
|
+
d6523b809463e2468a7d12851e5387cb8f9a430c
|
@@ -0,0 +1 @@
|
|
1
|
+
084afed6380b3e7347c6c05c2b3bbde823fb3a580e3a6839eec7812c84db3580
|
@@ -0,0 +1 @@
|
|
1
|
+
75a14a28b6e3126413d43c1671e62c25c5ec8f5561b996905352c98b7a5894100ea8aedeb59d482c13891c1db04dea06ac7ea430d43e009f2db94dc18876e269
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<groupId>com.wix</groupId>
|
4
4
|
<artifactId>detox</artifactId>
|
5
5
|
<versioning>
|
6
|
-
<latest>20.1.
|
7
|
-
<release>20.1.
|
6
|
+
<latest>20.1.3</latest>
|
7
|
+
<release>20.1.3</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.1.
|
9
|
+
<version>20.1.3</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20230206130801</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
a1e7d970132edefe41aeb49170f25299
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
c36b92f3c55239f1b6d668ebe795a56638b88d6d
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3589033525d4c9f7d3b11b91f1ea0e0dad52e607dc5a2dce01125e7bd2be0f75
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5d4ad093f145fa2837ea260905b5ab10eb7617141611d16a5847d874b5654a519b8b967733c7e1c68ad4979bf864918fd28752d41619e2dea08f60a23d0c653c
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
package/Detox-ios.tbz
CHANGED
Binary file
|
@@ -95,6 +95,10 @@ dependencies {
|
|
95
95
|
api('androidx.test.espresso:espresso-web:3.4.0') {
|
96
96
|
because 'Web-View testing'
|
97
97
|
}
|
98
|
+
api('androidx.test.espresso:espresso-contrib:3.4.0') {
|
99
|
+
because 'Android datepicker support'
|
100
|
+
exclude group: "org.checkerframework", module: "checker"
|
101
|
+
}
|
98
102
|
api('androidx.test:rules:1.4.0') {
|
99
103
|
because 'of ActivityTestRule. Needed by users *and* internally used by Detox.'
|
100
104
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
package com.wix.detox.espresso;
|
2
2
|
|
3
3
|
import android.view.View;
|
4
|
+
import android.os.Build;
|
4
5
|
|
5
6
|
import com.wix.detox.common.DetoxErrors.DetoxRuntimeException;
|
6
7
|
import com.wix.detox.common.DetoxErrors.StaleActionException;
|
@@ -19,6 +20,11 @@ import com.wix.detox.espresso.scroll.ScrollHelper;
|
|
19
20
|
import com.wix.detox.espresso.scroll.SwipeHelper;
|
20
21
|
|
21
22
|
import org.hamcrest.Matcher;
|
23
|
+
import java.text.ParseException;
|
24
|
+
import java.text.SimpleDateFormat;
|
25
|
+
import java.time.ZonedDateTime;
|
26
|
+
import java.util.Calendar;
|
27
|
+
import java.util.Date;
|
22
28
|
|
23
29
|
import androidx.test.espresso.UiController;
|
24
30
|
import androidx.test.espresso.ViewAction;
|
@@ -26,10 +32,12 @@ import androidx.test.espresso.action.CoordinatesProvider;
|
|
26
32
|
import androidx.test.espresso.action.GeneralClickAction;
|
27
33
|
import androidx.test.espresso.action.GeneralLocation;
|
28
34
|
import androidx.test.espresso.action.Press;
|
35
|
+
import androidx.test.espresso.contrib.PickerActions;
|
29
36
|
|
30
37
|
import static androidx.test.espresso.action.ViewActions.actionWithAssertions;
|
31
38
|
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
32
39
|
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
40
|
+
|
33
41
|
import static org.hamcrest.Matchers.allOf;
|
34
42
|
|
35
43
|
|
@@ -39,6 +47,8 @@ import static org.hamcrest.Matchers.allOf;
|
|
39
47
|
|
40
48
|
public class DetoxAction {
|
41
49
|
private static final String LOG_TAG = "detox";
|
50
|
+
private static final String ISO8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
|
51
|
+
private static final String ISO8601_FORMAT_NO_TZ = "yyyy-MM-dd'T'HH:mm:ss";
|
42
52
|
|
43
53
|
private DetoxAction() {
|
44
54
|
// static class
|
@@ -149,6 +159,19 @@ public class DetoxAction {
|
|
149
159
|
return new ScrollToIndexAction(index);
|
150
160
|
}
|
151
161
|
|
162
|
+
public static ViewAction setDatePickerDate(String dateString, String formatString) throws ParseException {
|
163
|
+
Date date;
|
164
|
+
if (formatString.equals("ISO8601")) {
|
165
|
+
date = parseDateISO8601(dateString);
|
166
|
+
} else {
|
167
|
+
date = new SimpleDateFormat(formatString).parse(dateString);
|
168
|
+
}
|
169
|
+
|
170
|
+
Calendar cal = Calendar.getInstance();
|
171
|
+
cal.setTime(date);
|
172
|
+
return PickerActions.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
|
173
|
+
}
|
174
|
+
|
152
175
|
public static ViewAction adjustSliderToPosition(final double newPosition) {
|
153
176
|
return new AdjustSliderToPositionAction(newPosition);
|
154
177
|
}
|
@@ -179,4 +202,12 @@ public class DetoxAction {
|
|
179
202
|
}
|
180
203
|
};
|
181
204
|
}
|
205
|
+
|
206
|
+
private static Date parseDateISO8601(String dateString) throws ParseException {
|
207
|
+
try {
|
208
|
+
return new SimpleDateFormat(ISO8601_FORMAT).parse(dateString);
|
209
|
+
} catch (ParseException e) {
|
210
|
+
return new SimpleDateFormat(ISO8601_FORMAT_NO_TZ).parse(dateString);
|
211
|
+
}
|
212
|
+
}
|
182
213
|
}
|
package/index.d.ts
CHANGED
@@ -1365,12 +1365,15 @@ declare global {
|
|
1365
1365
|
setColumnToValue(column: number, value: string): Promise<void>;
|
1366
1366
|
|
1367
1367
|
/**
|
1368
|
-
* Sets the date of a date
|
1369
|
-
* @param dateString
|
1370
|
-
* @param dateFormat
|
1368
|
+
* Sets the date of a date-picker according to the specified date-string and format.
|
1369
|
+
* @param dateString Textual representation of a date (e.g. '2023/01/01'). Should be in coherence with the format specified by `dateFormat`.
|
1370
|
+
* @param dateFormat Format of `dateString`: Generally either 'ISO8601' or an explicitly specified format (e.g. 'yyyy/MM/dd'); It should
|
1371
|
+
* follow the rules of NSDateFormatter for iOS and DateTimeFormatter for Android.
|
1372
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
1371
1373
|
* @example
|
1372
|
-
* await
|
1373
|
-
* await element(by.id('datePicker')).setDatePickerDate(
|
1374
|
+
* await element(by.id('datePicker')).setDatePickerDate('2023-01-01T00:00:00Z', 'ISO8601');
|
1375
|
+
* await element(by.id('datePicker')).setDatePickerDate(new Date().toISOString(), 'ISO8601');
|
1376
|
+
* await element(by.id('datePicker')).setDatePickerDate('2023/01/01', 'yyyy/MM/dd');
|
1374
1377
|
*/
|
1375
1378
|
setDatePickerDate(dateString: string, dateFormat: string): Promise<void>;
|
1376
1379
|
|
package/local-cli/cli.js
CHANGED
@@ -7,6 +7,8 @@ const yargs = require('yargs');
|
|
7
7
|
const logger = require('../internals').log.child({ cat: 'cli' });
|
8
8
|
const DetoxError = require('../src/errors/DetoxError');
|
9
9
|
|
10
|
+
const { isErrorAlreadyLogged } = require('./utils/cliErrorHandling');
|
11
|
+
|
10
12
|
yargs
|
11
13
|
.scriptName('detox')
|
12
14
|
.parserConfiguration({
|
@@ -28,9 +30,8 @@ yargs
|
|
28
30
|
.wrap(yargs.terminalWidth() * 0.9)
|
29
31
|
.fail(function(msg, err, program) {
|
30
32
|
if (err) {
|
31
|
-
|
32
|
-
|
33
|
-
logger.error(message);
|
33
|
+
if (!isErrorAlreadyLogged(err)) {
|
34
|
+
logger.error(DetoxError.format(err));
|
34
35
|
process.stderr.write('\n');
|
35
36
|
}
|
36
37
|
|
@@ -9,6 +9,7 @@ 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 { markErrorAsLogged } = require('../utils/cliErrorHandling');
|
12
13
|
|
13
14
|
const TestRunnerError = require('./TestRunnerError');
|
14
15
|
|
@@ -142,7 +143,7 @@ class TestRunnerCommand {
|
|
142
143
|
signal,
|
143
144
|
});
|
144
145
|
log.error.end({ success: false, code, signal }, error.message);
|
145
|
-
reject(error);
|
146
|
+
reject(markErrorAsLogged(error));
|
146
147
|
}
|
147
148
|
});
|
148
149
|
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
const loggedErrors = new WeakSet();
|
2
|
+
|
3
|
+
function markErrorAsLogged(error) {
|
4
|
+
loggedErrors.add(error);
|
5
|
+
return error;
|
6
|
+
}
|
7
|
+
|
8
|
+
function isErrorAlreadyLogged(error) {
|
9
|
+
return loggedErrors.has(error);
|
10
|
+
}
|
11
|
+
|
12
|
+
module.exports = {
|
13
|
+
markErrorAsLogged,
|
14
|
+
isErrorAlreadyLogged,
|
15
|
+
};
|
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.1.
|
4
|
+
"version": "20.1.3",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -199,5 +199,5 @@
|
|
199
199
|
}
|
200
200
|
}
|
201
201
|
},
|
202
|
-
"gitHead": "
|
202
|
+
"gitHead": "95f2f82f4b8cd5b1b8ba935a2898d76a20a7a9b9"
|
203
203
|
}
|
@@ -124,6 +124,13 @@ class ScrollToIndex extends Action {
|
|
124
124
|
}
|
125
125
|
}
|
126
126
|
|
127
|
+
class SetDatePickerDateAction extends Action {
|
128
|
+
constructor(dateString, formatString) {
|
129
|
+
super();
|
130
|
+
this._call = invoke.callDirectly(DetoxActionApi.setDatePickerDate(dateString, formatString));
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
127
134
|
class AdjustSliderToPosition extends Action {
|
128
135
|
constructor(newPosition) {
|
129
136
|
super();
|
@@ -155,5 +162,6 @@ module.exports = {
|
|
155
162
|
SwipeAction,
|
156
163
|
TakeElementScreenshot,
|
157
164
|
ScrollToIndex,
|
165
|
+
SetDatePickerDateAction,
|
158
166
|
AdjustSliderToPosition,
|
159
167
|
};
|
@@ -5,6 +5,7 @@ const tempfile = require('tempfile');
|
|
5
5
|
|
6
6
|
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
7
7
|
const invoke = require('../../invoke');
|
8
|
+
const { removeMilliseconds } = require('../../utils/dateUtils');
|
8
9
|
const { actionDescription } = require('../../utils/invocationTraceDescriptions');
|
9
10
|
const actions = require('../actions/native');
|
10
11
|
const DetoxMatcherApi = require('../espressoapi/DetoxMatcher');
|
@@ -112,6 +113,16 @@ class NativeElement {
|
|
112
113
|
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
113
114
|
}
|
114
115
|
|
116
|
+
async setDatePickerDate(rawDateString, formatString) {
|
117
|
+
const dateString = formatString === 'ISO8601'
|
118
|
+
? removeMilliseconds(rawDateString)
|
119
|
+
: rawDateString;
|
120
|
+
|
121
|
+
const action = new actions.SetDatePickerDateAction(dateString, formatString);
|
122
|
+
const traceDescription = actionDescription.setDatePickerDate(dateString, formatString);
|
123
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
124
|
+
}
|
125
|
+
|
115
126
|
/**
|
116
127
|
* @param {'up' | 'right' | 'down' | 'left'} direction
|
117
128
|
* @param {'slow' | 'fast'} [speed]
|
@@ -194,6 +194,19 @@ class DetoxAction {
|
|
194
194
|
};
|
195
195
|
}
|
196
196
|
|
197
|
+
static setDatePickerDate(dateString, formatString) {
|
198
|
+
if (typeof dateString !== "string") throw new Error("dateString should be a string, but got " + (dateString + (" (" + (typeof dateString + ")"))));
|
199
|
+
if (typeof formatString !== "string") throw new Error("formatString should be a string, but got " + (formatString + (" (" + (typeof formatString + ")"))));
|
200
|
+
return {
|
201
|
+
target: {
|
202
|
+
type: "Class",
|
203
|
+
value: "com.wix.detox.espresso.DetoxAction"
|
204
|
+
},
|
205
|
+
method: "setDatePickerDate",
|
206
|
+
args: [dateString, formatString]
|
207
|
+
};
|
208
|
+
}
|
209
|
+
|
197
210
|
static adjustSliderToPosition(newPosition) {
|
198
211
|
if (typeof newPosition !== "number") throw new Error("newPosition should be a number, but got " + (newPosition + (" (" + (typeof newPosition + ")"))));
|
199
212
|
return {
|
@@ -220,6 +233,18 @@ class DetoxAction {
|
|
220
233
|
};
|
221
234
|
}
|
222
235
|
|
236
|
+
static parseDateISO8601(dateString) {
|
237
|
+
if (typeof dateString !== "string") throw new Error("dateString should be a string, but got " + (dateString + (" (" + (typeof dateString + ")"))));
|
238
|
+
return {
|
239
|
+
target: {
|
240
|
+
type: "Class",
|
241
|
+
value: "com.wix.detox.espresso.DetoxAction"
|
242
|
+
},
|
243
|
+
method: "parseDateISO8601",
|
244
|
+
args: [dateString]
|
245
|
+
};
|
246
|
+
}
|
247
|
+
|
223
248
|
}
|
224
249
|
|
225
250
|
module.exports = DetoxAction;
|
@@ -2,16 +2,14 @@ const path = require('path');
|
|
2
2
|
const { promisify } = require('util');
|
3
3
|
|
4
4
|
const glob = require('glob');
|
5
|
+
const _ = require('lodash');
|
5
6
|
const tempfile = require('tempfile');
|
6
7
|
|
7
8
|
const { useForwardSlashes } = require('../../utils/shellUtils');
|
8
9
|
|
9
10
|
const globSync = glob.sync;
|
10
11
|
const globAsync = promisify(glob);
|
11
|
-
|
12
|
-
function getRoot() {
|
13
|
-
return path.dirname(tempfile());
|
14
|
-
}
|
12
|
+
const getRoot = _.once(() => path.dirname(tempfile()));
|
15
13
|
|
16
14
|
function createGlobber(ext) {
|
17
15
|
const fullExt = `.detox.${ext}`;
|
package/src/ios/expectTwo.js
CHANGED
@@ -7,6 +7,7 @@ const _ = require('lodash');
|
|
7
7
|
const tempfile = require('tempfile');
|
8
8
|
|
9
9
|
const { assertEnum, assertNormalized } = require('../utils/assertArgument');
|
10
|
+
const { removeMilliseconds } = require('../utils/dateUtils');
|
10
11
|
const { actionDescription, expectDescription } = require('../utils/invocationTraceDescriptions');
|
11
12
|
const log = require('../utils/logger').child({ cat: 'ws-client, ws' });
|
12
13
|
const traceInvocationCall = require('../utils/traceInvocationCall').bind(null, log);
|
@@ -275,6 +276,9 @@ class Element {
|
|
275
276
|
setDatePickerDate(dateString, dateFormat) {
|
276
277
|
if (typeof dateString !== 'string') throw new Error('dateString should be a string, but got ' + (dateString + (' (' + (typeof dateString + ')'))));
|
277
278
|
if (typeof dateFormat !== 'string') throw new Error('dateFormat should be a string, but got ' + (dateFormat + (' (' + (typeof dateFormat + ')'))));
|
279
|
+
if (dateFormat === 'ISO8601') {
|
280
|
+
dateString = removeMilliseconds(dateString);
|
281
|
+
}
|
278
282
|
|
279
283
|
const traceDescription = actionDescription.setDatePickerDate(dateString, dateFormat);
|
280
284
|
return this.withAction('setDatePickerDate', traceDescription, dateString, dateFormat);
|
@@ -1,4 +1,5 @@
|
|
1
1
|
const { PassThrough } = require('stream');
|
2
|
+
const { promisify } = require('util');
|
2
3
|
|
3
4
|
const bunyan = require('bunyan');
|
4
5
|
const bds = require('bunyan-debug-stream');
|
@@ -74,12 +75,14 @@ class BunyanLogger {
|
|
74
75
|
}
|
75
76
|
|
76
77
|
async closeFileStreams() {
|
77
|
-
const { _closeStream } = BunyanLogger;
|
78
78
|
const internalBunyanStreams = this._bunyan['streams'];
|
79
79
|
const openFileStreams = _.filter(internalBunyanStreams, this._isOpenFileStream);
|
80
80
|
_.remove(internalBunyanStreams, openFileStreams);
|
81
81
|
|
82
|
-
await Promise.all(openFileStreams.map(
|
82
|
+
await Promise.all(openFileStreams.map(bunyanStream => {
|
83
|
+
const stream = bunyanStream.stream;
|
84
|
+
return promisify(stream.end.bind(stream))();
|
85
|
+
}));
|
83
86
|
}
|
84
87
|
|
85
88
|
/** @private */
|
@@ -97,20 +100,6 @@ class BunyanLogger {
|
|
97
100
|
return stream.fd > 2 && !stream.closed;
|
98
101
|
}
|
99
102
|
};
|
100
|
-
|
101
|
-
/** @private */
|
102
|
-
static _closeStream(bunyanStream) {
|
103
|
-
return new Promise((resolve, reject) => {
|
104
|
-
bunyanStream.stream.end((err) => {
|
105
|
-
/* istanbul ignore next */
|
106
|
-
if (err) {
|
107
|
-
reject(err);
|
108
|
-
} else {
|
109
|
-
resolve();
|
110
|
-
}
|
111
|
-
});
|
112
|
-
});
|
113
|
-
}
|
114
103
|
}
|
115
104
|
|
116
105
|
module.exports = BunyanLogger;
|
package/src/utils/dateUtils.js
CHANGED
@@ -10,6 +10,11 @@ function shortFormat(date) {
|
|
10
10
|
return `${HH}:${MM}:${ss}.${milli}`;
|
11
11
|
}
|
12
12
|
|
13
|
+
function removeMilliseconds(isoDate) {
|
14
|
+
return isoDate.replace(/(T\d\d:\d\d:\d\d)(\.\d\d\d)/, '$1');
|
15
|
+
}
|
16
|
+
|
13
17
|
module.exports = {
|
14
18
|
shortFormat,
|
19
|
+
removeMilliseconds,
|
15
20
|
};
|
@@ -1 +0,0 @@
|
|
1
|
-
66a12b51d39c0dc37d8237459002fa80
|
@@ -1 +0,0 @@
|
|
1
|
-
a6ce0a5378be7d5f0bd050e4ee918d9b63e9fc6f
|
@@ -1 +0,0 @@
|
|
1
|
-
aead1f291b379b31f6bea79a173d54e8c7f4e2765989a3f40e7aa6246370c01c
|
@@ -1 +0,0 @@
|
|
1
|
-
fddf79d6f4258ffd96cd24ec6eac9323df38fbcfe72aed5aeb9ea5c21982bfa96e732c2c8a9e2c6b6d11e6b1d9b2fa379978344829b04f46ebd42afb91d6973f
|
@@ -1 +0,0 @@
|
|
1
|
-
2bf2d6bb4211ecd29fe92218f374356d
|
@@ -1 +0,0 @@
|
|
1
|
-
ab2f58d97f18c07fda612358a4acd0c55559b54c
|
@@ -1 +0,0 @@
|
|
1
|
-
269663213a371ff333345cc4a2042eacf18a3f8955003b45feb10484df48cc95
|
@@ -1 +0,0 @@
|
|
1
|
-
34b61213d9da6f33dcc73892d2a07d8e02ceb2addcc07dfa2c396e30723faa24c804df26f465d7900f1e4afcf8a182bf00fe46be99065b7241cbfff6998268ae
|
@@ -1 +0,0 @@
|
|
1
|
-
c7eb63b23e9fec3154e5402cc0f65283
|
@@ -1 +0,0 @@
|
|
1
|
-
16bed62cec4774262c71a7daad13efcdac3c7942
|
@@ -1 +0,0 @@
|
|
1
|
-
c12164b0a26a6db45c65d984af4c2a880e2bf5d516ceb582361576eff713e378
|
@@ -1 +0,0 @@
|
|
1
|
-
d50db96253552903c6acf2328ff2baa9788aac5846622bc01c4c9e6026738991f6eea1ea2723afe21ffdec692a3caeadb39b6ac5cfb31bf40c7d184e058701bb
|
@@ -1 +0,0 @@
|
|
1
|
-
588ca5b917e41b9b0532532c77717020
|
@@ -1 +0,0 @@
|
|
1
|
-
84c09fdf4cc86ae4116c92f13a72e848d47d689d
|
@@ -1 +0,0 @@
|
|
1
|
-
0a7cd18ab62c4e460a174fb3a74729597a1876c04939cd3c72e7828133690ee9
|
@@ -1 +0,0 @@
|
|
1
|
-
b7df21adb125e0fa524dad24daf37dcc53dd88a52d5bddf5e1720c13683965d7d7ca9d7d89eb6e82e181a665400ad0a23f47b2366ad05e0f85e93c9e7786f586
|