expect-webdriverio 6.0.2 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +25 -13
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -5,6 +5,17 @@ import createSoftExpect from './softExpect.js';
|
|
|
5
5
|
import { SoftAssertService } from './softAssert.js';
|
|
6
6
|
import { oneOf } from './matchers/asymmetrics/oneOf.js';
|
|
7
7
|
import { some as wdioSome } from './matchers/modifiers/some.js';
|
|
8
|
+
const wdioExpect = expectLib;
|
|
9
|
+
const MATCHERS_VERSION = '6.0.3';
|
|
10
|
+
if ((wdioExpect.__wdio_version && wdioExpect.__wdio_version !== MATCHERS_VERSION) || (!wdioExpect.__wdio_version && wdioExpect.soft !== undefined)) {
|
|
11
|
+
if (wdioExpect.__wdio_version) {
|
|
12
|
+
console.warn(`[expect-webdriverio] Conflict: Initializing v${MATCHERS_VERSION}, but v${wdioExpect.__wdio_version} is already loaded.`);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
console.warn(`[expect-webdriverio] Conflict: Initializing v${MATCHERS_VERSION}, but an older version of expect-webdriverio is already loaded.`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
wdioExpect.__wdio_version = MATCHERS_VERSION;
|
|
8
19
|
export const wdioCustomMatchers = {};
|
|
9
20
|
export const matchers = new Map();
|
|
10
21
|
const extend = expectLib.extend;
|
|
@@ -24,21 +35,22 @@ Object.entries(wdioMatchers).forEach(([matcher, value]) => {
|
|
|
24
35
|
filteredWdioMatchers[matcher] = value;
|
|
25
36
|
}
|
|
26
37
|
});
|
|
27
|
-
const wdioExpect = expectLib;
|
|
28
38
|
wdioExpect.extend(filteredWdioMatchers);
|
|
29
39
|
wdioExpect.oneOf = oneOf;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
if (wdioExpect.soft === undefined) {
|
|
41
|
+
Object.defineProperty(wdioExpect, 'soft', {
|
|
42
|
+
value: (actual) => createSoftExpect(actual)
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(wdioExpect, 'getSoftFailures', {
|
|
45
|
+
value: (testId) => SoftAssertService.getInstance().getFailures(testId)
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(wdioExpect, 'assertSoftFailures', {
|
|
48
|
+
value: (testId) => SoftAssertService.getInstance().assertNoFailures(testId)
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(wdioExpect, 'clearSoftFailures', {
|
|
51
|
+
value: (testId) => SoftAssertService.getInstance().clearFailures(testId)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
42
54
|
export const expect = wdioExpect;
|
|
43
55
|
export const some = wdioSome;
|
|
44
56
|
export const getDefaultOptions = () => DEFAULT_OPTIONS;
|