expect-webdriverio 6.0.3 → 6.0.4
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/api/index.js +2 -0
- package/lib/index.js +13 -27
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/types/expect-webdriverio.d.ts +11 -6
package/lib/api/index.js
ADDED
package/lib/index.js
CHANGED
|
@@ -4,18 +4,6 @@ import { DEFAULT_OPTIONS, defaultOptionsList } from './constants.js';
|
|
|
4
4
|
import createSoftExpect from './softExpect.js';
|
|
5
5
|
import { SoftAssertService } from './softAssert.js';
|
|
6
6
|
import { oneOf } from './matchers/asymmetrics/oneOf.js';
|
|
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;
|
|
19
7
|
export const wdioCustomMatchers = {};
|
|
20
8
|
export const matchers = new Map();
|
|
21
9
|
const extend = expectLib.extend;
|
|
@@ -35,24 +23,22 @@ Object.entries(wdioMatchers).forEach(([matcher, value]) => {
|
|
|
35
23
|
filteredWdioMatchers[matcher] = value;
|
|
36
24
|
}
|
|
37
25
|
});
|
|
26
|
+
const wdioExpect = expectLib;
|
|
38
27
|
wdioExpect.extend(filteredWdioMatchers);
|
|
39
28
|
wdioExpect.oneOf = oneOf;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
}
|
|
29
|
+
Object.defineProperty(wdioExpect, 'soft', {
|
|
30
|
+
value: (actual) => createSoftExpect(actual)
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(wdioExpect, 'getSoftFailures', {
|
|
33
|
+
value: (testId) => SoftAssertService.getInstance().getFailures(testId)
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(wdioExpect, 'assertSoftFailures', {
|
|
36
|
+
value: (testId) => SoftAssertService.getInstance().assertNoFailures(testId)
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(wdioExpect, 'clearSoftFailures', {
|
|
39
|
+
value: (testId) => SoftAssertService.getInstance().clearFailures(testId)
|
|
40
|
+
});
|
|
54
41
|
export const expect = wdioExpect;
|
|
55
|
-
export const some = wdioSome;
|
|
56
42
|
export const getDefaultOptions = () => DEFAULT_OPTIONS;
|
|
57
43
|
export const setDefaultOptions = (options) => {
|
|
58
44
|
Object.entries(options).forEach(([key, value]) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/constants.ts","../src/index.ts","../src/jasmineUtils.ts","../src/matchers.ts","../src/snapshot.ts","../src/softAssert.ts","../src/softAssertService.ts","../src/softExpect.ts","../src/types.ts","../src/utils.ts","../src/matchers/snapshot.ts","../src/matchers/asymmetrics/asymmetricsUtils.ts","../src/matchers/asymmetrics/oneOf.ts","../src/matchers/browser/toHaveClipboardText.ts","../src/matchers/browser/toHaveLocalStorageItem.ts","../src/matchers/browser/toHaveTitle.ts","../src/matchers/browser/toHaveUrl.ts","../src/matchers/element/toBeClickable.ts","../src/matchers/element/toBeDisabled.ts","../src/matchers/element/toBeDisplayed.ts","../src/matchers/element/toBeDisplayedInViewport.ts","../src/matchers/element/toBeEnabled.ts","../src/matchers/element/toBeExisting.ts","../src/matchers/element/toBeFocused.ts","../src/matchers/element/toBeSelected.ts","../src/matchers/element/toHaveAttribute.ts","../src/matchers/element/toHaveChildren.ts","../src/matchers/element/toHaveComputedLabel.ts","../src/matchers/element/toHaveComputedRole.ts","../src/matchers/element/toHaveElementClass.ts","../src/matchers/element/toHaveElementProperty.ts","../src/matchers/element/toHaveHTML.ts","../src/matchers/element/toHaveHeight.ts","../src/matchers/element/toHaveHref.ts","../src/matchers/element/toHaveId.ts","../src/matchers/element/toHaveSize.ts","../src/matchers/element/toHaveStyle.ts","../src/matchers/element/toHaveText.ts","../src/matchers/element/toHaveValue.ts","../src/matchers/element/toHaveWidth.ts","../src/matchers/elements/toBeElementsArrayOfSize.ts","../src/matchers/mock/toBeRequested.ts","../src/matchers/mock/toBeRequestedTimes.ts","../src/matchers/mock/toBeRequestedWith.ts","../src/matchers/modifiers/some.ts","../src/util/commandOptionsUtils.ts","../src/util/elementsUtil.ts","../src/util/executeCommand.ts","../src/util/formatMessage.ts","../src/util/numberOptionsUtil.ts","../src/util/refetchElements.ts","../src/util/stringUtil.ts","../src/util/waitUntil.ts"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../src/constants.ts","../src/index.ts","../src/jasmineUtils.ts","../src/matchers.ts","../src/snapshot.ts","../src/softAssert.ts","../src/softAssertService.ts","../src/softExpect.ts","../src/types.ts","../src/utils.ts","../src/api/index.ts","../src/matchers/snapshot.ts","../src/matchers/asymmetrics/asymmetricsUtils.ts","../src/matchers/asymmetrics/oneOf.ts","../src/matchers/browser/toHaveClipboardText.ts","../src/matchers/browser/toHaveLocalStorageItem.ts","../src/matchers/browser/toHaveTitle.ts","../src/matchers/browser/toHaveUrl.ts","../src/matchers/element/toBeClickable.ts","../src/matchers/element/toBeDisabled.ts","../src/matchers/element/toBeDisplayed.ts","../src/matchers/element/toBeDisplayedInViewport.ts","../src/matchers/element/toBeEnabled.ts","../src/matchers/element/toBeExisting.ts","../src/matchers/element/toBeFocused.ts","../src/matchers/element/toBeSelected.ts","../src/matchers/element/toHaveAttribute.ts","../src/matchers/element/toHaveChildren.ts","../src/matchers/element/toHaveComputedLabel.ts","../src/matchers/element/toHaveComputedRole.ts","../src/matchers/element/toHaveElementClass.ts","../src/matchers/element/toHaveElementProperty.ts","../src/matchers/element/toHaveHTML.ts","../src/matchers/element/toHaveHeight.ts","../src/matchers/element/toHaveHref.ts","../src/matchers/element/toHaveId.ts","../src/matchers/element/toHaveSize.ts","../src/matchers/element/toHaveStyle.ts","../src/matchers/element/toHaveText.ts","../src/matchers/element/toHaveValue.ts","../src/matchers/element/toHaveWidth.ts","../src/matchers/elements/toBeElementsArrayOfSize.ts","../src/matchers/mock/toBeRequested.ts","../src/matchers/mock/toBeRequestedTimes.ts","../src/matchers/mock/toBeRequestedWith.ts","../src/matchers/modifiers/some.ts","../src/util/commandOptionsUtils.ts","../src/util/elementsUtil.ts","../src/util/executeCommand.ts","../src/util/formatMessage.ts","../src/util/numberOptionsUtil.ts","../src/util/refetchElements.ts","../src/util/stringUtil.ts","../src/util/waitUntil.ts"],"version":"5.9.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expect-webdriverio",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
4
4
|
"author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
|
|
5
5
|
"description": "WebdriverIO Assertion Library",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
46
|
"./types": "./types/expect-global.d.ts",
|
|
47
|
-
"./expect-global": "./types/expect-global.d.ts"
|
|
47
|
+
"./expect-global": "./types/expect-global.d.ts",
|
|
48
|
+
"./api": "./lib/api/index.js"
|
|
48
49
|
},
|
|
49
50
|
"types": "./types/expect-webdriverio.d.ts",
|
|
50
51
|
"typeScriptVersion": "3.8.3",
|
|
@@ -22,7 +22,6 @@ type ExpectLibExpectationResult = import('expect').ExpectationResult
|
|
|
22
22
|
type ExpectLibMatcherContext = import('expect').MatcherContext
|
|
23
23
|
type MatchersObject = Parameters<typeof import('expect').expect.extend>[0]
|
|
24
24
|
type ExpectLibAnything = ReturnType<typeof expect.any> | ReturnType<typeof expect.anything>
|
|
25
|
-
|
|
26
25
|
type WdioSome<T> = import('../src/matchers/modifiers/some.js').SomeElementsWrapper<T>
|
|
27
26
|
|
|
28
27
|
// Extracted from the expect library, this is the type of the matcher function used in the expect library.
|
|
@@ -1264,7 +1263,17 @@ declare namespace ExpectWebdriverIO {
|
|
|
1264
1263
|
* Allow to match one of the specified value.
|
|
1265
1264
|
*/
|
|
1266
1265
|
type OneOfPartialMatcher<T> = ExpectWebdriverIO.PartialMatcher<T[]>
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
declare module 'expect-webdriverio' {
|
|
1269
|
+
export = ExpectWebdriverIO
|
|
1270
|
+
}
|
|
1267
1271
|
|
|
1272
|
+
/**
|
|
1273
|
+
* Expose the expect-wdio API without the burden of initialization.
|
|
1274
|
+
* Required since importing from 'expect-webdriverio' can trigger double initialization.
|
|
1275
|
+
*/
|
|
1276
|
+
declare module 'expect-webdriverio/api' {
|
|
1268
1277
|
/**
|
|
1269
1278
|
* Quantifier modifier. Wraps a `$$()` result so that the matcher passes
|
|
1270
1279
|
* when at least one element satisfies the condition (∃ semantics).
|
|
@@ -1274,11 +1283,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
1274
1283
|
* await expect(some($$('.items'))).not.toBeDisplayed() // at least one is NOT displayed
|
|
1275
1284
|
* await expect(some($$('.items'))).toHaveText('foo')
|
|
1276
1285
|
*/
|
|
1277
|
-
function some<T extends ElementArrayLike>(
|
|
1286
|
+
export function some<T extends ElementArrayLike>(
|
|
1278
1287
|
elements: T
|
|
1279
1288
|
): WdioSome<T>
|
|
1280
1289
|
}
|
|
1281
|
-
|
|
1282
|
-
declare module 'expect-webdriverio' {
|
|
1283
|
-
export = ExpectWebdriverIO
|
|
1284
|
-
}
|