@badisi/wdio-harness 4.2.1 → 4.3.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/README.md +8 -7
- package/WebdriverIOHarnessEnvironment.d.ts +1 -1
- package/WebdriverIOHarnessEnvironment.js +1 -1
- package/WebdriverIOTestElement.d.ts +6 -1
- package/WebdriverIOTestElement.js +15 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
<img src="https://img.shields.io/npm/v/@badisi/wdio-harness.svg?color=blue&logo=npm" alt="npm version" /></a>
|
|
12
12
|
<a href="https://npmcharts.com/compare/@badisi/wdio-harness?minimal=true">
|
|
13
13
|
<img src="https://img.shields.io/npm/dw/@badisi/wdio-harness.svg?color=7986CB&logo=npm" alt="npm donwloads" /></a>
|
|
14
|
-
<a href="https://github.com/
|
|
14
|
+
<a href="https://github.com/Badisi/wdio-harness/blob/main/LICENSE">
|
|
15
15
|
<img src="https://img.shields.io/npm/l/@badisi/wdio-harness.svg?color=ff69b4" alt="license" /></a>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
19
19
|
<a href="https://github.com/Badisi/wdio-harness/actions/workflows/ci_tests.yml">
|
|
20
|
-
<img src="https://
|
|
21
|
-
<a href="https://github.com/
|
|
20
|
+
<img src="https://img.shields.io/github/actions/workflow/status/badisi/wdio-harness/ci_tests.yml?logo=github" alt="build status" /></a>
|
|
21
|
+
<a href="https://github.com/Badisi/wdio-harness/blob/main/CONTRIBUTING.md#-submitting-a-pull-request-pr">
|
|
22
22
|
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome" /></a>
|
|
23
23
|
</p>
|
|
24
24
|
|
|
@@ -57,6 +57,7 @@ __Methods__
|
|
|
57
57
|
__Example__
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
|
+
import '@angular/compiler'; // required since Angular v21
|
|
60
61
|
import { MatDatepickerInputHarness } from '@angular/material/datepicker/testing';
|
|
61
62
|
import { getHarness } from '@badisi/wdio-harness';
|
|
62
63
|
|
|
@@ -103,7 +104,7 @@ Please read and follow the [Code of Conduct][codeofconduct] and help me keep thi
|
|
|
103
104
|
|
|
104
105
|
|
|
105
106
|
|
|
106
|
-
[developer]: https://github.com/
|
|
107
|
-
[contributing]: https://github.com/
|
|
108
|
-
[codeofconduct]: https://github.com/
|
|
109
|
-
[examples]: https://github.com/
|
|
107
|
+
[developer]: https://github.com/Badisi/wdio-harness/blob/main/DEVELOPER.md
|
|
108
|
+
[contributing]: https://github.com/Badisi/wdio-harness/blob/main/CONTRIBUTING.md
|
|
109
|
+
[codeofconduct]: https://github.com/Badisi/wdio-harness/blob/main/CODE_OF_CONDUCT.md
|
|
110
|
+
[examples]: https://github.com/Badisi/wdio-harness/blob/main/projects/tests-e2e/harness.e2e.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentHarness, ComponentHarnessConstructor, HarnessEnvironment } from '@angular/cdk/testing';
|
|
1
|
+
import { type ComponentHarness, type ComponentHarnessConstructor, HarnessEnvironment } from '@angular/cdk/testing';
|
|
2
2
|
import { WebdriverIOTestElement } from './WebdriverIOTestElement.js';
|
|
3
3
|
/**
|
|
4
4
|
* A `HarnessEnvironment` implementation for WebdriverIO.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HarnessEnvironment } from '@angular/cdk/testing';
|
|
2
|
+
import colors from '@colors/colors/safe.js';
|
|
2
3
|
import logger from '@wdio/logger';
|
|
3
4
|
import { WebdriverIOTestElement } from './WebdriverIOTestElement.js';
|
|
4
|
-
import colors from '@colors/colors/safe.js';
|
|
5
5
|
const { magenta, green } = colors;
|
|
6
6
|
/** Registers the environment logger. */
|
|
7
7
|
const log = logger('wdio-harness');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementDimensions, EventData, ModifierKeys, TestElement, TestKey, TextOptions } from '@angular/cdk/testing';
|
|
1
|
+
import { type ElementDimensions, type EventData, type ModifierKeys, type TestElement, TestKey, type TextOptions } from '@angular/cdk/testing';
|
|
2
2
|
/** Module augmentation to expose the host element as a public api */
|
|
3
3
|
declare module '@angular/cdk/testing' {
|
|
4
4
|
interface ComponentHarness {
|
|
@@ -62,6 +62,11 @@ export declare class WebdriverIOTestElement implements TestElement {
|
|
|
62
62
|
sendKeys(modifiers: ModifierKeys, ...keys: (string | TestKey)[]): Promise<void>;
|
|
63
63
|
/** Gets the text from the element. */
|
|
64
64
|
text(options?: TextOptions): Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the value of a `contenteditable` element.
|
|
67
|
+
* @param value Value to be set on the element.
|
|
68
|
+
*/
|
|
69
|
+
setContenteditableValue(value: string): Promise<void>;
|
|
65
70
|
/** Gets the value for the given attribute from the element. */
|
|
66
71
|
getAttribute(name: string): Promise<string | null>;
|
|
67
72
|
/** Checks whether the element has the given class. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentHarness, TestKey } from '@angular/cdk/testing';
|
|
2
|
+
import colors from '@colors/colors/safe.js';
|
|
2
3
|
import { browser } from '@wdio/globals';
|
|
3
4
|
import logger from '@wdio/logger';
|
|
4
|
-
import colors from '@colors/colors/safe.js';
|
|
5
5
|
const { magenta, green } = colors;
|
|
6
6
|
var Button;
|
|
7
7
|
(function (Button) {
|
|
@@ -160,6 +160,19 @@ export class WebdriverIOTestElement {
|
|
|
160
160
|
// We don't go through WebdriverIO's `getText`, because it excludes text from hidden elements.
|
|
161
161
|
return browser.executeScript(`return (arguments[0].textContent ?? '').trim()`, [this.hostElement]);
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Sets the value of a `contenteditable` element.
|
|
165
|
+
* @param value Value to be set on the element.
|
|
166
|
+
*/
|
|
167
|
+
async setContenteditableValue(value) {
|
|
168
|
+
const contenteditableAttr = await this.getAttribute('contenteditable');
|
|
169
|
+
if (contenteditableAttr !== '' &&
|
|
170
|
+
contenteditableAttr !== 'true' &&
|
|
171
|
+
contenteditableAttr !== 'plaintext-only') {
|
|
172
|
+
throw new Error('setContenteditableValue can only be called on a `contenteditable` element.');
|
|
173
|
+
}
|
|
174
|
+
return browser.executeScript('arguments[0].textContent = arguments[1];', [this.hostElement, value]);
|
|
175
|
+
}
|
|
163
176
|
/** Gets the value for the given attribute from the element. */
|
|
164
177
|
async getAttribute(name) {
|
|
165
178
|
this.logAction('GET_ATTRIBUTE', name);
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentHarness, HarnessQuery } from '@angular/cdk/testing';
|
|
1
|
+
import type { ComponentHarness, HarnessQuery } from '@angular/cdk/testing';
|
|
2
2
|
import { WebdriverIOHarnessEnvironment } from './WebdriverIOHarnessEnvironment.js';
|
|
3
3
|
/**
|
|
4
4
|
* Searches for all instances of the component corresponding to the given harness type under the
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { browser
|
|
1
|
+
import { $, browser } from '@wdio/globals';
|
|
2
2
|
import { WebdriverIOHarnessEnvironment } from './WebdriverIOHarnessEnvironment.js';
|
|
3
3
|
/**
|
|
4
4
|
* Searches for all instances of the component corresponding to the given harness type under the
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@badisi/wdio-harness",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "WebdriverIO support for Angular component test harnesses.",
|
|
5
|
-
"homepage": "https://github.com/
|
|
5
|
+
"homepage": "https://github.com/Badisi/wdio-harness",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Badisi"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "
|
|
23
|
+
"url": "https://github.com/Badisi/wdio-harness"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"angular",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": "^16.14.0 || >=18.10.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@angular/cdk": ">= 13 <
|
|
42
|
+
"@angular/cdk": ">= 13 < 22",
|
|
43
43
|
"@wdio/logger": ">= 9 < 10",
|
|
44
44
|
"webdriverio": ">= 9 < 10"
|
|
45
45
|
},
|