expect-webdriverio 5.2.0 → 5.2.1
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 +8 -2
- package/lib/matchers.js +31 -62
- package/lib/snapshot.js +6 -3
- package/lib/softAssertService.js +1 -1
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { expect as expectLib } from 'expect';
|
|
2
|
-
import wdioMatchers from './matchers.js';
|
|
2
|
+
import * as wdioMatchers from './matchers.js';
|
|
3
3
|
import { DEFAULT_OPTIONS } from './constants.js';
|
|
4
4
|
import createSoftExpect from './softExpect.js';
|
|
5
5
|
import { SoftAssertService } from './softAssert.js';
|
|
6
6
|
export const matchers = new Map();
|
|
7
|
+
const filteredMatchers = {};
|
|
7
8
|
const extend = expectLib.extend;
|
|
9
|
+
Object.keys(wdioMatchers).forEach(matcher => {
|
|
10
|
+
if (typeof wdioMatchers[matcher] === 'function') {
|
|
11
|
+
filteredMatchers[matcher] = wdioMatchers[matcher];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
expectLib.extend = (m) => {
|
|
9
15
|
if (!m || typeof m !== 'object') {
|
|
10
16
|
return;
|
|
@@ -12,7 +18,7 @@ expectLib.extend = (m) => {
|
|
|
12
18
|
Object.entries(m).forEach(([name, matcher]) => matchers.set(name, matcher));
|
|
13
19
|
return extend(m);
|
|
14
20
|
};
|
|
15
|
-
expectLib.extend(
|
|
21
|
+
expectLib.extend(filteredMatchers);
|
|
16
22
|
const expectWithSoft = expectLib;
|
|
17
23
|
Object.defineProperty(expectWithSoft, 'soft', {
|
|
18
24
|
value: (actual) => createSoftExpect(actual)
|
package/lib/matchers.js
CHANGED
|
@@ -1,62 +1,31 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
...toBeElementsArrayOfSize,
|
|
33
|
-
...toBeClickable,
|
|
34
|
-
...toBeDisabled,
|
|
35
|
-
...toBeDisplayed,
|
|
36
|
-
...toBeDisplayedInViewport,
|
|
37
|
-
...toBeEnabled,
|
|
38
|
-
...toBeExisting,
|
|
39
|
-
...toBeFocused,
|
|
40
|
-
...toBeSelected,
|
|
41
|
-
...toHaveAttribute,
|
|
42
|
-
...toHaveChildren,
|
|
43
|
-
...toHaveClass,
|
|
44
|
-
...toHaveHref,
|
|
45
|
-
...toHaveHTML,
|
|
46
|
-
...toHaveId,
|
|
47
|
-
...toHaveSize,
|
|
48
|
-
...toHaveElementProperty,
|
|
49
|
-
...toHaveText,
|
|
50
|
-
...toHaveValue,
|
|
51
|
-
...toHaveStyle,
|
|
52
|
-
...toBeRequested,
|
|
53
|
-
...toBeRequestedTimes,
|
|
54
|
-
...toBeRequestedWith,
|
|
55
|
-
...snapshotMatchers
|
|
56
|
-
};
|
|
57
|
-
Object.keys(matchers).forEach((key) => {
|
|
58
|
-
if (key.endsWith('Fn')) {
|
|
59
|
-
delete matchers[key];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
export default matchers;
|
|
1
|
+
export * from './matchers/browser/toHaveClipboardText.js';
|
|
2
|
+
export * from './matchers/browser/toHaveTitle.js';
|
|
3
|
+
export * from './matchers/browser/toHaveUrl.js';
|
|
4
|
+
export * from './matchers/element/toBeClickable.js';
|
|
5
|
+
export * from './matchers/element/toBeDisabled.js';
|
|
6
|
+
export * from './matchers/element/toBeDisplayed.js';
|
|
7
|
+
export * from './matchers/element/toBeDisplayedInViewport.js';
|
|
8
|
+
export * from './matchers/element/toBeEnabled.js';
|
|
9
|
+
export * from './matchers/element/toBeExisting.js';
|
|
10
|
+
export * from './matchers/element/toBeFocused.js';
|
|
11
|
+
export * from './matchers/element/toBeSelected.js';
|
|
12
|
+
export * from './matchers/element/toHaveAttribute.js';
|
|
13
|
+
export * from './matchers/element/toHaveChildren.js';
|
|
14
|
+
export * from './matchers/element/toHaveClass.js';
|
|
15
|
+
export * from './matchers/element/toHaveComputedLabel.js';
|
|
16
|
+
export * from './matchers/element/toHaveComputedRole.js';
|
|
17
|
+
export * from './matchers/element/toHaveElementProperty.js';
|
|
18
|
+
export * from './matchers/element/toHaveHeight.js';
|
|
19
|
+
export * from './matchers/element/toHaveHref.js';
|
|
20
|
+
export * from './matchers/element/toHaveHTML.js';
|
|
21
|
+
export * from './matchers/element/toHaveId.js';
|
|
22
|
+
export * from './matchers/element/toHaveSize.js';
|
|
23
|
+
export * from './matchers/element/toHaveStyle.js';
|
|
24
|
+
export * from './matchers/element/toHaveText.js';
|
|
25
|
+
export * from './matchers/element/toHaveValue.js';
|
|
26
|
+
export * from './matchers/element/toHaveWidth.js';
|
|
27
|
+
export * from './matchers/elements/toBeElementsArrayOfSize.js';
|
|
28
|
+
export * from './matchers/mock/toBeRequested.js';
|
|
29
|
+
export * from './matchers/mock/toBeRequestedTimes.js';
|
|
30
|
+
export * from './matchers/mock/toBeRequestedWith.js';
|
|
31
|
+
export * from './matchers/snapshot.js';
|
package/lib/snapshot.js
CHANGED
|
@@ -63,17 +63,20 @@ export class SnapshotService {
|
|
|
63
63
|
async beforeTest(test) {
|
|
64
64
|
__classPrivateFieldSet(this, _SnapshotService_currentFilePath, test.file, "f");
|
|
65
65
|
__classPrivateFieldSet(this, _SnapshotService_currentTestName, `${test.parent} > ${test.title}`, "f");
|
|
66
|
-
await __classPrivateFieldGet(this, _SnapshotService_snapshotClient, "f").
|
|
66
|
+
await __classPrivateFieldGet(this, _SnapshotService_snapshotClient, "f").setup(test.file, __classPrivateFieldGet(this, _SnapshotService_options, "f"));
|
|
67
67
|
}
|
|
68
68
|
async beforeStep(step, scenario) {
|
|
69
69
|
const file = scenario.uri;
|
|
70
70
|
const testName = `${scenario.name} > ${step.text}`;
|
|
71
71
|
__classPrivateFieldSet(this, _SnapshotService_currentFilePath, file, "f");
|
|
72
72
|
__classPrivateFieldSet(this, _SnapshotService_currentTestName, testName, "f");
|
|
73
|
-
await __classPrivateFieldGet(this, _SnapshotService_snapshotClient, "f").
|
|
73
|
+
await __classPrivateFieldGet(this, _SnapshotService_snapshotClient, "f").setup(file, __classPrivateFieldGet(this, _SnapshotService_options, "f"));
|
|
74
74
|
}
|
|
75
75
|
async after() {
|
|
76
|
-
|
|
76
|
+
if (!__classPrivateFieldGet(this, _SnapshotService_currentFilePath, "f")) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const result = await __classPrivateFieldGet(this, _SnapshotService_snapshotClient, "f").finish(__classPrivateFieldGet(this, _SnapshotService_currentFilePath, "f"));
|
|
77
80
|
if (!result) {
|
|
78
81
|
return;
|
|
79
82
|
}
|
package/lib/softAssertService.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expect-webdriverio",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
|
|
5
5
|
"description": "WebdriverIO Assertion Library",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"prepare": "husky install"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@vitest/snapshot": "^2.0
|
|
61
|
+
"@vitest/snapshot": "^3.2.0",
|
|
62
62
|
"expect": "^29.7.0",
|
|
63
63
|
"jest-matcher-utils": "^29.7.0",
|
|
64
64
|
"lodash.isequal": "^4.5.0"
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"@types/jest": "^29.5.12",
|
|
69
69
|
"@types/lodash.isequal": "^4.5.8",
|
|
70
70
|
"@types/node": "^22.9.0",
|
|
71
|
-
"@wdio/types": "^9.9.0",
|
|
72
71
|
"@vitest/coverage-v8": "^3.0.5",
|
|
73
72
|
"@wdio/eslint": "^0.1.0",
|
|
73
|
+
"@wdio/types": "^9.9.0",
|
|
74
74
|
"c8": "^10.1.2",
|
|
75
75
|
"eslint": "^9.15.0",
|
|
76
76
|
"husky": "^9.1.5",
|