expect-webdriverio 3.3.0 → 3.4.0
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/addMatchers.js
CHANGED
|
@@ -8,7 +8,7 @@ const isJasmine = () => {
|
|
|
8
8
|
exports.isJasmine = isJasmine;
|
|
9
9
|
const loadExpect = () => {
|
|
10
10
|
try {
|
|
11
|
-
return expectLib = require('expect');
|
|
11
|
+
return expectLib = require('expect').expect;
|
|
12
12
|
}
|
|
13
13
|
catch (err) {
|
|
14
14
|
return console.error('Failed to load expect package. Make sure it has been installed: npm i expect');
|
|
@@ -14,18 +14,17 @@ async function condition(el, attribute, value, options) {
|
|
|
14
14
|
}
|
|
15
15
|
if (ignoreCase) {
|
|
16
16
|
attr = attr.toLowerCase();
|
|
17
|
-
value
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
result: attr.includes(value),
|
|
22
|
-
value: attr
|
|
23
|
-
};
|
|
17
|
+
if (!(value instanceof RegExp)) {
|
|
18
|
+
value = value.toLowerCase();
|
|
19
|
+
}
|
|
24
20
|
}
|
|
25
21
|
const classes = attr.split(' ');
|
|
22
|
+
const valueInClasses = classes.some((t) => {
|
|
23
|
+
return value instanceof RegExp ? !!t.match(value) : containing ? t.includes(value) : t === value;
|
|
24
|
+
});
|
|
26
25
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
value: attr,
|
|
27
|
+
result: valueInClasses
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
function toHaveElementClassFn(received, className, options = {}) {
|
|
@@ -12,7 +12,7 @@ async function condition(el, property, value, options = {}) {
|
|
|
12
12
|
if (value === null) {
|
|
13
13
|
return { result: true, value: prop };
|
|
14
14
|
}
|
|
15
|
-
if (typeof value !== 'string' || (typeof prop !== 'string' && !asString)) {
|
|
15
|
+
if (!(value instanceof RegExp) && (typeof value !== 'string' || (typeof prop !== 'string' && !asString))) {
|
|
16
16
|
return { result: prop === value, value: prop };
|
|
17
17
|
}
|
|
18
18
|
prop = prop.toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expect-webdriverio",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -42,27 +42,27 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/webdriverio/expect-webdriverio#readme",
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/jasmine": "^4.0.
|
|
46
|
-
"@types/jest": "^27.
|
|
45
|
+
"@types/jasmine": "^4.0.3",
|
|
46
|
+
"@types/jest": "^27.5.1",
|
|
47
47
|
"@types/node": "^15.14.0",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
49
|
-
"@typescript-eslint/parser": "^5.
|
|
50
|
-
"eslint": "^8.
|
|
51
|
-
"husky": "^
|
|
52
|
-
"jest": "^
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
|
49
|
+
"@typescript-eslint/parser": "^5.23.0",
|
|
50
|
+
"eslint": "^8.15.0",
|
|
51
|
+
"husky": "^8.0.1",
|
|
52
|
+
"jest": "^28.1.0",
|
|
53
53
|
"npm-run-all": "^4.1.5",
|
|
54
|
-
"release-it": "^
|
|
54
|
+
"release-it": "^15.0.0",
|
|
55
55
|
"rimraf": "^3.0.2",
|
|
56
|
-
"shelljs": "^0.8.
|
|
57
|
-
"ts-jest": "^
|
|
58
|
-
"ts-node": "^10.
|
|
59
|
-
"typescript": "^4.
|
|
60
|
-
"webdriverio": "^7.
|
|
56
|
+
"shelljs": "^0.8.5",
|
|
57
|
+
"ts-jest": "^28.0.2",
|
|
58
|
+
"ts-node": "^10.7.0",
|
|
59
|
+
"typescript": "^4.6.4",
|
|
60
|
+
"webdriverio": "^7.19.7"
|
|
61
61
|
},
|
|
62
62
|
"types": "types/jest-global.d.ts",
|
|
63
63
|
"typeScriptVersion": "3.8.3",
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"expect": "^
|
|
66
|
-
"jest-matcher-utils": "^
|
|
65
|
+
"expect": "^28.1.0",
|
|
66
|
+
"jest-matcher-utils": "^28.1.0"
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -83,11 +83,11 @@ declare namespace ExpectWebdriverIO {
|
|
|
83
83
|
/**
|
|
84
84
|
* `WebdriverIO.Element` -> `getAttribute`
|
|
85
85
|
*/
|
|
86
|
-
toHaveAttribute(attribute: string, value?: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
86
|
+
toHaveAttribute(attribute: string, value?: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
87
87
|
/**
|
|
88
88
|
* `WebdriverIO.Element` -> `getAttribute`
|
|
89
89
|
*/
|
|
90
|
-
toHaveAttr(attribute: string, value?: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
90
|
+
toHaveAttr(attribute: string, value?: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* `WebdriverIO.Element` -> `getAttribute`
|
|
@@ -95,7 +95,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
95
95
|
*/
|
|
96
96
|
toHaveAttributeContaining(
|
|
97
97
|
attribute: string,
|
|
98
|
-
contains: string,
|
|
98
|
+
contains: string | RegExp,
|
|
99
99
|
options?: ExpectWebdriverIO.StringOptions
|
|
100
100
|
): R
|
|
101
101
|
/**
|
|
@@ -104,7 +104,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
104
104
|
*/
|
|
105
105
|
toHaveAttrContaining(
|
|
106
106
|
attribute: string,
|
|
107
|
-
contains: string,
|
|
107
|
+
contains: string | RegExp,
|
|
108
108
|
options?: ExpectWebdriverIO.StringOptions
|
|
109
109
|
): R
|
|
110
110
|
|
|
@@ -112,40 +112,40 @@ declare namespace ExpectWebdriverIO {
|
|
|
112
112
|
* `WebdriverIO.Element` -> `getAttribute` class
|
|
113
113
|
* @deprecated since v1.3.1 - use `toHaveElementClass` instead.
|
|
114
114
|
*/
|
|
115
|
-
toHaveClass(className: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
115
|
+
toHaveClass(className: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* `WebdriverIO.Element` -> `getAttribute` class
|
|
119
119
|
*/
|
|
120
|
-
toHaveElementClass(className: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
120
|
+
toHaveElementClass(className: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
123
|
* `WebdriverIO.Element` -> `getAttribute` class
|
|
124
124
|
* @deprecated since v1.3.1 - use `toHaveElementClassContaining` instead.
|
|
125
125
|
* Element's class includes the className.
|
|
126
126
|
*/
|
|
127
|
-
toHaveClassContaining(className: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
127
|
+
toHaveClassContaining(className: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* `WebdriverIO.Element` -> `getAttribute` class
|
|
131
131
|
* Element's class includes the className.
|
|
132
132
|
*/
|
|
133
|
-
toHaveElementClassContaining(className: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
133
|
+
toHaveElementClassContaining(className: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* `WebdriverIO.Element` -> `getProperty`
|
|
137
137
|
*/
|
|
138
|
-
toHaveElementProperty(property: string, value?: any, options?: ExpectWebdriverIO.StringOptions): R
|
|
138
|
+
toHaveElementProperty(property: string | RegExp, value?: any, options?: ExpectWebdriverIO.StringOptions): R
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* `WebdriverIO.Element` -> `getProperty` value
|
|
142
142
|
*/
|
|
143
|
-
toHaveValue(value: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
143
|
+
toHaveValue(value: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
144
144
|
/**
|
|
145
145
|
* `WebdriverIO.Element` -> `getProperty` value
|
|
146
146
|
* Element's value includes the value.
|
|
147
147
|
*/
|
|
148
|
-
toHaveValueContaining(value: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
148
|
+
toHaveValueContaining(value: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* `WebdriverIO.Element` -> `isClickable`
|
|
@@ -194,37 +194,37 @@ declare namespace ExpectWebdriverIO {
|
|
|
194
194
|
/**
|
|
195
195
|
* `WebdriverIO.Element` -> `getAttribute` href
|
|
196
196
|
*/
|
|
197
|
-
toHaveHref(href: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
197
|
+
toHaveHref(href: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
198
198
|
/**
|
|
199
199
|
* `WebdriverIO.Element` -> `getAttribute` href
|
|
200
200
|
*/
|
|
201
|
-
toHaveLink(href: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
201
|
+
toHaveLink(href: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
202
202
|
|
|
203
203
|
/**
|
|
204
204
|
* `WebdriverIO.Element` -> `getAttribute` href
|
|
205
205
|
* Element's href includes the value provided
|
|
206
206
|
*/
|
|
207
|
-
toHaveHrefContaining(href: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
207
|
+
toHaveHrefContaining(href: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
208
208
|
/**
|
|
209
209
|
* `WebdriverIO.Element` -> `getAttribute` href
|
|
210
210
|
* Element's href includes the value provided
|
|
211
211
|
*/
|
|
212
|
-
toHaveLinkContaining(href: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
212
|
+
toHaveLinkContaining(href: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
215
|
* `WebdriverIO.Element` -> `getProperty` value
|
|
216
216
|
*/
|
|
217
|
-
toHaveId(id: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
217
|
+
toHaveId(id: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
220
|
* `WebdriverIO.Element` -> `getText`
|
|
221
221
|
*/
|
|
222
|
-
toHaveText(text: string | string
|
|
222
|
+
toHaveText(text: string | RegExp | Array<string | RegExp>, options?: ExpectWebdriverIO.StringOptions): R
|
|
223
223
|
/**
|
|
224
224
|
* `WebdriverIO.Element` -> `getText`
|
|
225
225
|
* Element's text includes the text provided
|
|
226
226
|
*/
|
|
227
|
-
toHaveTextContaining(text: string | string
|
|
227
|
+
toHaveTextContaining(text: string | RegExp | Array<string | RegExp>, options?: ExpectWebdriverIO.StringOptions): R
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
230
|
* `WebdriverIO.Element` -> `getAttribute("style")`
|
|
@@ -235,26 +235,26 @@ declare namespace ExpectWebdriverIO {
|
|
|
235
235
|
/**
|
|
236
236
|
* `WebdriverIO.Browser` -> `getUrl`
|
|
237
237
|
*/
|
|
238
|
-
toHaveUrl(url: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
238
|
+
toHaveUrl(url: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
239
239
|
|
|
240
240
|
// ===== browser only =====
|
|
241
241
|
/**
|
|
242
242
|
* `WebdriverIO.Browser` -> `getUrl`
|
|
243
243
|
* Browser's url includes the provided text
|
|
244
244
|
*/
|
|
245
|
-
toHaveUrlContaining(url: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
245
|
+
toHaveUrlContaining(url: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
248
|
* `WebdriverIO.Browser` -> `getTitle`
|
|
249
249
|
*/
|
|
250
|
-
toHaveTitle(title: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
250
|
+
toHaveTitle(title: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
251
251
|
|
|
252
252
|
// ===== browser only =====
|
|
253
253
|
/**
|
|
254
254
|
* `WebdriverIO.Browser` -> `getTitle`
|
|
255
255
|
* Browser's title includes the provided text
|
|
256
256
|
*/
|
|
257
|
-
toHaveTitleContaining(title: string, options?: ExpectWebdriverIO.StringOptions): R
|
|
257
|
+
toHaveTitleContaining(title: string | RegExp, options?: ExpectWebdriverIO.StringOptions): R
|
|
258
258
|
|
|
259
259
|
// ===== $$ only =====
|
|
260
260
|
/**
|
package/types/standalone.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="expect-webdriverio/types/expect-webdriverio"/>
|
|
2
2
|
|
|
3
3
|
declare namespace ExpectWebdriverIO {
|
|
4
|
-
interface Matchers<R, T> extends Readonly<import('expect
|
|
4
|
+
interface Matchers<R, T> extends Readonly<import('expect').Matchers<R>> {
|
|
5
5
|
not: Matchers<R, T>
|
|
6
6
|
resolves: Matchers<Promise<R>, T>
|
|
7
7
|
rejects: Matchers<Promise<R>, T>
|