expect-webdriverio 5.3.1 → 5.3.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/{matchers → src/matchers}/snapshot.js +1 -1
- package/lib/test/__fixtures__/utils.js +19 -0
- package/lib/test/index.test.js +8 -0
- package/lib/test/matchers/beMatchers.test.js +109 -0
- package/lib/test/matchers/browser/toHaveClipboardText.test.js +21 -0
- package/lib/test/matchers/browserMatchers.test.js +102 -0
- package/lib/test/matchers/element/toBeDisabled.test.js +121 -0
- package/lib/test/matchers/element/toHaveAttribute.test.js +131 -0
- package/lib/test/matchers/element/toHaveChildren.test.js +62 -0
- package/lib/test/matchers/element/toHaveComputedLabel.test.js +284 -0
- package/lib/test/matchers/element/toHaveComputedRole.test.js +284 -0
- package/lib/test/matchers/element/toHaveElementClass.test.js +125 -0
- package/lib/test/matchers/element/toHaveElementProperty.test.js +111 -0
- package/lib/test/matchers/element/toHaveHTML.test.js +291 -0
- package/lib/test/matchers/element/toHaveHeight.test.js +171 -0
- package/lib/test/matchers/element/toHaveHref.test.js +54 -0
- package/lib/test/matchers/element/toHaveId.test.js +54 -0
- package/lib/test/matchers/element/toHaveSize.test.js +109 -0
- package/lib/test/matchers/element/toHaveStyle.test.js +199 -0
- package/lib/test/matchers/element/toHaveText.test.js +333 -0
- package/lib/test/matchers/element/toHaveValue.test.js +81 -0
- package/lib/test/matchers/element/toHaveWidth.test.js +171 -0
- package/lib/test/matchers/elements/toBeElementsArrayOfSize.test.js +141 -0
- package/lib/test/matchers/mock/toBeRequested.test.js +73 -0
- package/lib/test/matchers/mock/toBeRequestedTimes.test.js +108 -0
- package/lib/test/matchers/mock/toBeRequestedWith.test.js +343 -0
- package/lib/test/matchers.test.js +54 -0
- package/lib/test/snapshot.test.js +53 -0
- package/lib/test/softAssertions.test.js +332 -0
- package/lib/test/util/elementsUtil.test.js +18 -0
- package/lib/test/util/formatMessage.test.js +96 -0
- package/lib/test/util/refetchElements.test.js +19 -0
- package/lib/test/utils.test.js +117 -0
- package/lib/{tsconfig.build.tsbuildinfo → tsconfig.tsbuildinfo} +1 -1
- package/package.json +2 -2
- package/types/expect-webdriverio.d.ts +39 -28
- package/types/standalone.d.ts +2 -0
- /package/lib/{constants.js → src/constants.js} +0 -0
- /package/lib/{index.js → src/index.js} +0 -0
- /package/lib/{jasmineUtils.js → src/jasmineUtils.js} +0 -0
- /package/lib/{matchers → src/matchers}/browser/toHaveClipboardText.js +0 -0
- /package/lib/{matchers → src/matchers}/browser/toHaveTitle.js +0 -0
- /package/lib/{matchers → src/matchers}/browser/toHaveUrl.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toBeClickable.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toBeDisabled.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toBeDisplayed.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toBeDisplayedInViewport.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toBeEnabled.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toBeExisting.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toBeFocused.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toBeSelected.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveAttribute.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveChildren.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveClass.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveComputedLabel.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveComputedRole.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveElementProperty.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveHTML.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveHeight.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveHref.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveId.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveSize.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveStyle.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveText.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveValue.js +0 -0
- /package/lib/{matchers → src/matchers}/element/toHaveWidth.js +0 -0
- /package/lib/{matchers → src/matchers}/elements/toBeElementsArrayOfSize.js +0 -0
- /package/lib/{matchers → src/matchers}/mock/toBeRequested.js +0 -0
- /package/lib/{matchers → src/matchers}/mock/toBeRequestedTimes.js +0 -0
- /package/lib/{matchers → src/matchers}/mock/toBeRequestedWith.js +0 -0
- /package/lib/{matchers.js → src/matchers.js} +0 -0
- /package/lib/{snapshot.js → src/snapshot.js} +0 -0
- /package/lib/{softAssert.js → src/softAssert.js} +0 -0
- /package/lib/{softAssertService.js → src/softAssertService.js} +0 -0
- /package/lib/{softExpect.js → src/softExpect.js} +0 -0
- /package/lib/{types.js → src/types.js} +0 -0
- /package/lib/{util → src/util}/elementsUtil.js +0 -0
- /package/lib/{util → src/util}/executeCommand.js +0 -0
- /package/lib/{util → src/util}/formatMessage.js +0 -0
- /package/lib/{util → src/util}/refetchElements.js +0 -0
- /package/lib/{utils.js → src/utils.js} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { describe, test, expect } from 'vitest';
|
|
2
|
+
import { compareNumbers, compareText, compareTextWithArray } from '../src/utils.js';
|
|
3
|
+
describe('utils', () => {
|
|
4
|
+
describe('compareText', () => {
|
|
5
|
+
test('should pass when strings match', () => {
|
|
6
|
+
expect(compareText('foo', 'foo', {}).result).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
test('should fail when strings do not match', () => {
|
|
9
|
+
expect(compareText('foo', 'bar', {}).result).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
test('should pass when trims away white space', () => {
|
|
12
|
+
expect(compareText(' foo ', 'foo', {}).result).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
test('should fail without trimming away white space', () => {
|
|
15
|
+
expect(compareText(' foo ', 'foo ', { trim: false }).result).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
test('should pass if same word but wrong case and using ignoreCase', () => {
|
|
18
|
+
expect(compareText(' FOO ', 'foo', { ignoreCase: true }).result).toBe(true);
|
|
19
|
+
expect(compareText(' foo ', 'FOO', { ignoreCase: true }).result).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
test('should pass if string contains expected and using containing', () => {
|
|
22
|
+
expect(compareText('qwe_AsD_zxc', 'asd', { ignoreCase: true, containing: true }).result).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
test('should support asymmetric matchers', () => {
|
|
25
|
+
expect(compareText('foo', expect.stringContaining('oo'), {}).result).toBe(true);
|
|
26
|
+
expect(compareText('foo', expect.not.stringContaining('oo'), {}).result).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
test('should support asymmetric matchers and using ignoreCase', () => {
|
|
29
|
+
expect(compareText(' FOO ', expect.stringContaining('foo'), { ignoreCase: true }).result).toBe(true);
|
|
30
|
+
expect(compareText(' FOO ', expect.not.stringContaining('foo'), { ignoreCase: true }).result).toBe(false);
|
|
31
|
+
expect(compareText(' Foo ', expect.stringContaining('FOO'), { ignoreCase: true }).result).toBe(true);
|
|
32
|
+
expect(compareText(' Foo ', expect.not.stringContaining('FOO'), { ignoreCase: true }).result).toBe(false);
|
|
33
|
+
expect(compareText(' foo ', expect.stringContaining('foo'), { ignoreCase: true }).result).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe('compareTextWithArray', () => {
|
|
37
|
+
test('should pass if strings match in array', () => {
|
|
38
|
+
expect(compareTextWithArray('foo', ['foo', 'bar'], {}).result).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
test('should fail if string does not match in array', () => {
|
|
41
|
+
expect(compareTextWithArray('foo', ['foot', 'bar'], {}).result).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
test('should pass if white space and using trim', () => {
|
|
44
|
+
expect(compareTextWithArray(' foo ', ['foo', 'bar'], { trim: true }).result).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
test('should pass if wrong case and using ignoreCase', () => {
|
|
47
|
+
expect(compareTextWithArray(' FOO ', ['foO', 'bar'], { trim: true, ignoreCase: true }).result).toBe(true);
|
|
48
|
+
expect(compareTextWithArray(' foo ', ['foO', 'BAR'], { trim: true, ignoreCase: true }).result).toBe(true);
|
|
49
|
+
expect(compareTextWithArray(' foo ', ['foOo', 'BAR'], { trim: true, ignoreCase: true }).result).toBe(false);
|
|
50
|
+
expect(compareTextWithArray(' FOO ', ['foOO', 'bar'], { trim: true, ignoreCase: true }).result).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
test('should pass if string contains and using containing', () => {
|
|
53
|
+
expect(compareTextWithArray('qwe_AsD_zxc', ['foo', 'ZXC'], { ignoreCase: true, containing: true }).result).toBe(true);
|
|
54
|
+
expect(compareTextWithArray('qwe_AsD_ZXC', ['foo', 'zxc'], { ignoreCase: true, containing: true }).result).toBe(true);
|
|
55
|
+
expect(compareTextWithArray('qwe_AsD_ZXC', ['foo', 'zxcc'], { ignoreCase: true, containing: true }).result).toBe(false);
|
|
56
|
+
expect(compareTextWithArray('qwe_AsD_ZXC', ['foo', 'zxcc'], { ignoreCase: true, containing: false }).result).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
test('should support asymmetric matchers', () => {
|
|
59
|
+
expect(compareTextWithArray('foo', [expect.stringContaining('oo'), expect.stringContaining('oobb')], {}).result).toBe(true);
|
|
60
|
+
expect(compareTextWithArray('foo', [expect.stringContaining('oobb'), expect.stringContaining('oo')], {}).result).toBe(true);
|
|
61
|
+
expect(compareTextWithArray('foo', [expect.not.stringContaining('oo'), expect.stringContaining('oobb')], {}).result).toBe(false);
|
|
62
|
+
expect(compareTextWithArray('foo', [expect.stringContaining('oobb'), expect.not.stringContaining('oo')], {}).result).toBe(false);
|
|
63
|
+
expect(compareTextWithArray('foo', [expect.stringContaining('oo'), expect.not.stringContaining('oobb')], {}).result).toBe(true);
|
|
64
|
+
expect(compareTextWithArray('foo', [expect.not.stringContaining('oobb'), expect.not.stringContaining('oo')], {}).result).toBe(true);
|
|
65
|
+
expect(compareTextWithArray('foo', [expect.not.stringContaining('oof'), expect.not.stringContaining('oobb')], {}).result).toBe(true);
|
|
66
|
+
expect(compareTextWithArray('foo', [expect.not.stringContaining('oo'), expect.not.stringContaining('foo')], {}).result).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
test('should support asymmetric matchers and using ignoreCase', () => {
|
|
69
|
+
expect(compareTextWithArray(' FOO ', [expect.stringContaining('foo'), expect.stringContaining('oobb')], { ignoreCase: true }).result).toBe(true);
|
|
70
|
+
expect(compareTextWithArray(' FOO ', [expect.not.stringContaining('foo'), expect.stringContaining('oobb')], { ignoreCase: true }).result).toBe(false);
|
|
71
|
+
expect(compareTextWithArray(' foo ', [expect.stringContaining('FOO'), expect.stringContaining('oobb')], { ignoreCase: true }).result).toBe(true);
|
|
72
|
+
expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOO'), expect.stringContaining('oobb')], { ignoreCase: true }).result).toBe(false);
|
|
73
|
+
expect(compareTextWithArray(' foo ', [expect.stringContaining('FOO'), 'oobb'], { ignoreCase: true }).result).toBe(true);
|
|
74
|
+
expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOO'), 'oobb'], { ignoreCase: true }).result).toBe(false);
|
|
75
|
+
expect(compareTextWithArray('foo', [expect.stringContaining('FOOO'), 'FOO'], { ignoreCase: true }).result).toBe(true);
|
|
76
|
+
expect(compareTextWithArray(' foo ', [expect.not.stringContaining('OO'), expect.not.stringContaining('FOOO')], { ignoreCase: true }).result).toBe(true);
|
|
77
|
+
expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOOO'), expect.not.stringContaining('OO')], { ignoreCase: true }).result).toBe(true);
|
|
78
|
+
expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOOO'), expect.not.stringContaining('OOO')], { ignoreCase: true }).result).toBe(true);
|
|
79
|
+
expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOO'), expect.not.stringContaining('OO')], { ignoreCase: true }).result).toBe(false);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('compareNumbers', () => {
|
|
83
|
+
test('should work when equal', () => {
|
|
84
|
+
const actual = 10;
|
|
85
|
+
const eq = 10;
|
|
86
|
+
expect(compareNumbers(actual, { eq })).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
test('should pass when using gte and number is greater', () => {
|
|
89
|
+
const actual = 10;
|
|
90
|
+
const gte = 5;
|
|
91
|
+
expect(compareNumbers(actual, { gte })).toBe(true);
|
|
92
|
+
});
|
|
93
|
+
test('should pass when using lte and number is lower', () => {
|
|
94
|
+
const actual = 10;
|
|
95
|
+
const lte = 20;
|
|
96
|
+
expect(compareNumbers(actual, { lte })).toBe(true);
|
|
97
|
+
});
|
|
98
|
+
test('should pass when usin lte and gte and number is in between', () => {
|
|
99
|
+
const actual = 10;
|
|
100
|
+
const lte = 20;
|
|
101
|
+
const gte = 1;
|
|
102
|
+
expect(compareNumbers(actual, { lte, gte })).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
test('should fail when using lte and gte and is lte but not gte', () => {
|
|
105
|
+
const actual = 10;
|
|
106
|
+
const lte = 20;
|
|
107
|
+
const gte = 15;
|
|
108
|
+
expect(compareNumbers(actual, { lte, gte })).toBe(false);
|
|
109
|
+
});
|
|
110
|
+
test('should fail when using lte and gte and is gte but not lte', () => {
|
|
111
|
+
const actual = 10;
|
|
112
|
+
const lte = 9;
|
|
113
|
+
const gte = 1;
|
|
114
|
+
expect(compareNumbers(actual, { lte, gte })).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
});
|
|
@@ -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/browser/toHaveClipboardText.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/toHaveClass.ts","../src/matchers/element/toHaveComputedLabel.ts","../src/matchers/element/toHaveComputedRole.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/util/elementsUtil.ts","../src/util/executeCommand.ts","../src/util/formatMessage.ts","../src/util/refetchElements.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["../test/index.test.ts","../test/matchers.test.ts","../test/snapshot.test.ts","../test/softAssertions.test.ts","../test/utils.test.ts","../test/__fixtures__/utils.ts","../test/matchers/beMatchers.test.ts","../test/matchers/browserMatchers.test.ts","../test/matchers/browser/toHaveClipboardText.test.ts","../test/matchers/element/toBeDisabled.test.ts","../test/matchers/element/toHaveAttribute.test.ts","../test/matchers/element/toHaveChildren.test.ts","../test/matchers/element/toHaveComputedLabel.test.ts","../test/matchers/element/toHaveComputedRole.test.ts","../test/matchers/element/toHaveElementClass.test.ts","../test/matchers/element/toHaveElementProperty.test.ts","../test/matchers/element/toHaveHTML.test.ts","../test/matchers/element/toHaveHeight.test.ts","../test/matchers/element/toHaveHref.test.ts","../test/matchers/element/toHaveId.test.ts","../test/matchers/element/toHaveSize.test.ts","../test/matchers/element/toHaveStyle.test.ts","../test/matchers/element/toHaveText.test.ts","../test/matchers/element/toHaveValue.test.ts","../test/matchers/element/toHaveWidth.test.ts","../test/matchers/elements/toBeElementsArrayOfSize.test.ts","../test/matchers/mock/toBeRequested.test.ts","../test/matchers/mock/toBeRequestedTimes.test.ts","../test/matchers/mock/toBeRequestedWith.test.ts","../test/util/elementsUtil.test.ts","../test/util/formatMessage.test.ts","../test/util/refetchElements.test.ts","../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/browser/toHaveClipboardText.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/toHaveClass.ts","../src/matchers/element/toHaveComputedLabel.ts","../src/matchers/element/toHaveComputedRole.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/util/elementsUtil.ts","../src/util/executeCommand.ts","../src/util/formatMessage.ts","../src/util/refetchElements.ts"],"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expect-webdriverio",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
|
|
5
5
|
"description": "WebdriverIO Assertion Library",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"clean": "run-p clean:*",
|
|
46
46
|
"clean:build": "rimraf ./lib",
|
|
47
47
|
"clean:tests": "rimraf test-types/**/node_modules && rimraf test-types/**/dist",
|
|
48
|
-
"compile": "tsc --build tsconfig.
|
|
48
|
+
"compile": "tsc --build tsconfig.json",
|
|
49
49
|
"test": "run-s test:*",
|
|
50
50
|
"test:lint": "eslint .",
|
|
51
51
|
"test:unit": "vitest --run",
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
type
|
|
3
|
-
type
|
|
4
|
-
type
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
1
|
+
/* eslint-disable @typescript-eslint/consistent-type-imports*/
|
|
2
|
+
type ServiceInstance = import('@wdio/types').Services.ServiceInstance
|
|
3
|
+
type Test = import('@wdio/types').Frameworks.Test
|
|
4
|
+
type TestResult = import('@wdio/types').Frameworks.TestResult
|
|
5
|
+
type PickleStep = import('@wdio/types').Frameworks.PickleStep
|
|
6
|
+
type Scenario = import('@wdio/types').Frameworks.Scenario
|
|
7
|
+
type SnapshotResult = import('@vitest/snapshot').SnapshotResult
|
|
8
|
+
type SnapshotUpdateState = import('@vitest/snapshot').SnapshotUpdateState
|
|
8
9
|
|
|
9
10
|
declare namespace ExpectWebdriverIO {
|
|
10
11
|
const expect: ExpectWebdriverIO.Expect
|
|
11
12
|
function setOptions(options: DefaultOptions): void
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
14
|
function getConfig(): any
|
|
13
15
|
|
|
14
16
|
interface SnapshotServiceArgs {
|
|
@@ -23,32 +25,34 @@ declare namespace ExpectWebdriverIO {
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
interface SoftFailure {
|
|
26
|
-
error: Error
|
|
27
|
-
matcherName: string
|
|
28
|
-
location?: string
|
|
28
|
+
error: Error
|
|
29
|
+
matcherName: string
|
|
30
|
+
location?: string
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
class SoftAssertService {
|
|
32
|
-
static getInstance(): SoftAssertService
|
|
33
|
-
setCurrentTest(testId: string, testName?: string, testFile?: string): void
|
|
34
|
-
clearCurrentTest(): void
|
|
35
|
-
getCurrentTestId(): string | null
|
|
36
|
-
addFailure(error: Error, matcherName: string): void
|
|
37
|
-
getFailures(testId?: string): SoftFailure[]
|
|
38
|
-
clearFailures(testId?: string): void
|
|
39
|
-
assertNoFailures(testId?: string): void
|
|
34
|
+
static getInstance(): SoftAssertService
|
|
35
|
+
setCurrentTest(testId: string, testName?: string, testFile?: string): void
|
|
36
|
+
clearCurrentTest(): void
|
|
37
|
+
getCurrentTestId(): string | null
|
|
38
|
+
addFailure(error: Error, matcherName: string): void
|
|
39
|
+
getFailures(testId?: string): SoftFailure[]
|
|
40
|
+
clearFailures(testId?: string): void
|
|
41
|
+
assertNoFailures(testId?: string): void
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
interface SoftAssertionServiceOptions {
|
|
43
|
-
autoAssertOnTestEnd?: boolean
|
|
45
|
+
autoAssertOnTestEnd?: boolean
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
class SoftAssertionService implements ServiceInstance {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
constructor(serviceOptions?: SoftAssertionServiceOptions, capabilities?: any, config?: any)
|
|
51
|
+
beforeTest(test: Test): void
|
|
52
|
+
beforeStep(step: PickleStep, scenario: Scenario): void
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
afterTest(test: Test, context: any, result: TestResult): void
|
|
55
|
+
afterStep(step: PickleStep, scenario: Scenario, result: { passed: boolean, error?: Error }): void
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
interface AssertionResult {
|
|
@@ -59,7 +63,9 @@ declare namespace ExpectWebdriverIO {
|
|
|
59
63
|
const matchers: Map<
|
|
60
64
|
string,
|
|
61
65
|
(
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
67
|
actual: any,
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
69
|
...expected: any[]
|
|
64
70
|
) => Promise<AssertionResult>
|
|
65
71
|
>
|
|
@@ -79,6 +85,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
79
85
|
* expect(el).toHaveAttribute('attr', 'value', { ... }) // expectedValue is `['attr', 'value]`
|
|
80
86
|
* ```
|
|
81
87
|
*/
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
89
|
expectedValue?: any,
|
|
83
90
|
/**
|
|
84
91
|
* Options that the user has passed in, e.g. `expect(el).toHaveText('foo', { ignoreCase: true })` -> `{ ignoreCase: true }`
|
|
@@ -238,10 +245,10 @@ declare namespace ExpectWebdriverIO {
|
|
|
238
245
|
* **Usage**
|
|
239
246
|
* ```js
|
|
240
247
|
* // Check if an element has the class 'btn'
|
|
241
|
-
* await expect(element).toHaveElementClass('btn')
|
|
248
|
+
* await expect(element).toHaveElementClass('btn')
|
|
242
249
|
*
|
|
243
250
|
* // Check if an element has any of the specified classes
|
|
244
|
-
* await expect(element).toHaveElementClass(['btn', 'btn-large'])
|
|
251
|
+
* await expect(element).toHaveElementClass(['btn', 'btn-large'])
|
|
245
252
|
* ```
|
|
246
253
|
*/
|
|
247
254
|
toHaveElementClass(className: string | RegExp | Array<string | RegExp> | ExpectWebdriverIO.PartialMatcher, options?: ExpectWebdriverIO.StringOptions): R
|
|
@@ -251,6 +258,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
251
258
|
*/
|
|
252
259
|
toHaveElementProperty(
|
|
253
260
|
property: string | RegExp | ExpectWebdriverIO.PartialMatcher,
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
254
262
|
value?: any,
|
|
255
263
|
options?: ExpectWebdriverIO.StringOptions
|
|
256
264
|
): R
|
|
@@ -343,7 +351,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
343
351
|
* ```
|
|
344
352
|
*/
|
|
345
353
|
toHaveText(
|
|
346
|
-
text: string | RegExp | ExpectWebdriverIO.PartialMatcher | Array<string | RegExp>,
|
|
354
|
+
text: string | RegExp | ExpectWebdriverIO.PartialMatcher | Array<string | RegExp | ExpectWebdriverIO.PartialMatcher>,
|
|
347
355
|
options?: ExpectWebdriverIO.StringOptions
|
|
348
356
|
): R
|
|
349
357
|
|
|
@@ -418,7 +426,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
418
426
|
toBeElementsArrayOfSize(
|
|
419
427
|
size: number | ExpectWebdriverIO.NumberOptions,
|
|
420
428
|
options?: ExpectWebdriverIO.NumberOptions
|
|
421
|
-
): R & Promise<WebdriverIO.ElementArray
|
|
429
|
+
): R & Promise<WebdriverIO.ElementArray>
|
|
422
430
|
|
|
423
431
|
// ==== network mock ====
|
|
424
432
|
/**
|
|
@@ -479,8 +487,10 @@ declare namespace ExpectWebdriverIO {
|
|
|
479
487
|
type JsonCompatible = jsonObject | jsonArray
|
|
480
488
|
|
|
481
489
|
interface PartialMatcher {
|
|
490
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
482
491
|
sample?: any
|
|
483
492
|
$$typeof: symbol
|
|
493
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
484
494
|
asymmetricMatch(...args: any[]): boolean
|
|
485
495
|
toString(): string
|
|
486
496
|
}
|
|
@@ -527,6 +537,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
527
537
|
}
|
|
528
538
|
|
|
529
539
|
interface AsymmetricMatchers {
|
|
540
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
530
541
|
any(expectedObject: any): PartialMatcher
|
|
531
542
|
anything(): PartialMatcher
|
|
532
543
|
arrayContaining(sample: Array<unknown>): PartialMatcher
|
package/types/standalone.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/consistent-type-imports*/
|
|
1
2
|
/// <reference types="./expect-webdriverio.js"/>
|
|
2
3
|
|
|
3
4
|
type ChainablePromiseElement = import('webdriverio').ChainablePromiseElement<WebdriverIO.Element>
|
|
@@ -21,6 +22,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
21
22
|
} & AsymmetricMatchers
|
|
22
23
|
|
|
23
24
|
interface AsymmetricMatchers {
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
26
|
any(expectedObject: any): PartialMatcher
|
|
25
27
|
anything(): PartialMatcher
|
|
26
28
|
arrayContaining(sample: Array<unknown>): PartialMatcher
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|