@serenity-js/web 3.38.0 → 3.40.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/CHANGELOG.md +24 -0
- package/lib/screenplay/interactions/Drag.d.ts +95 -0
- package/lib/screenplay/interactions/Drag.d.ts.map +1 -0
- package/lib/screenplay/interactions/Drag.js +123 -0
- package/lib/screenplay/interactions/Drag.js.map +1 -0
- package/lib/screenplay/interactions/ExecuteScript.d.ts +1 -2
- package/lib/screenplay/interactions/ExecuteScript.d.ts.map +1 -1
- package/lib/screenplay/interactions/ExecuteScript.js +1 -2
- package/lib/screenplay/interactions/ExecuteScript.js.map +1 -1
- package/lib/screenplay/interactions/index.d.ts +1 -0
- package/lib/screenplay/interactions/index.d.ts.map +1 -1
- package/lib/screenplay/interactions/index.js +1 -0
- package/lib/screenplay/interactions/index.js.map +1 -1
- package/lib/screenplay/models/PageElement.d.ts +7 -0
- package/lib/screenplay/models/PageElement.d.ts.map +1 -1
- package/lib/screenplay/models/PageElement.js.map +1 -1
- package/lib/scripts/dragAndDrop.d.ts +13 -0
- package/lib/scripts/dragAndDrop.d.ts.map +1 -0
- package/lib/scripts/dragAndDrop.js +75 -0
- package/lib/scripts/dragAndDrop.js.map +1 -0
- package/lib/scripts/index.d.ts +1 -0
- package/lib/scripts/index.d.ts.map +1 -1
- package/lib/scripts/index.js +1 -0
- package/lib/scripts/index.js.map +1 -1
- package/lib/scripts/isVisible.js +0 -1
- package/lib/scripts/isVisible.js.map +1 -1
- package/lib/scripts/rehydrate.js +0 -1
- package/lib/scripts/rehydrate.js.map +1 -1
- package/package.json +4 -4
- package/src/screenplay/interactions/Drag.ts +125 -0
- package/src/screenplay/interactions/ExecuteScript.ts +3 -3
- package/src/screenplay/interactions/index.ts +1 -0
- package/src/screenplay/models/ArgumentDehydrator.ts +1 -1
- package/src/screenplay/models/PageElement.ts +8 -0
- package/src/scripts/dragAndDrop.ts +79 -0
- package/src/scripts/index.ts +1 -0
- package/src/scripts/isVisible.ts +1 -1
- package/src/scripts/rehydrate.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.40.0](https://github.com/serenity-js/serenity-js/compare/v3.39.0...v3.40.0) (2026-02-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **protractor:** use JavaScript-based drag and drop for HTML5 events ([c5fdfca](https://github.com/serenity-js/serenity-js/commit/c5fdfca1788136fb8f69c9dbe5829072181a061f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **web:** introduce Drag interaction to drag and drop page elements ([fdde2c3](https://github.com/serenity-js/serenity-js/commit/fdde2c317074f93527bf67f86bf56dcbf1b6647e)), closes [#2663](https://github.com/serenity-js/serenity-js/issues/2663)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [3.39.0](https://github.com/serenity-js/serenity-js/compare/v3.38.0...v3.39.0) (2026-01-30)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @serenity-js/web
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [3.38.0](https://github.com/serenity-js/serenity-js/compare/v3.37.2...v3.38.0) (2026-01-29)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @serenity-js/web
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Answerable } from '@serenity-js/core';
|
|
2
|
+
import { Interaction } from '@serenity-js/core';
|
|
3
|
+
import type { PageElement } from '../models';
|
|
4
|
+
/**
|
|
5
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
6
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
7
|
+
*
|
|
8
|
+
* ## Example HTML with draggable element and drop zone
|
|
9
|
+
*
|
|
10
|
+
* ```html
|
|
11
|
+
* <p id="draggable" draggable="true">
|
|
12
|
+
* This element is draggable.
|
|
13
|
+
* </p>
|
|
14
|
+
* <div id="droppable">
|
|
15
|
+
* Drop Zone
|
|
16
|
+
* </div>
|
|
17
|
+
*
|
|
18
|
+
* <script>
|
|
19
|
+
* const draggable = document.getElementById('draggable');
|
|
20
|
+
* const droppable = document.getElementById('droppable');
|
|
21
|
+
*
|
|
22
|
+
* draggable.addEventListener('dragstart', (event) => {
|
|
23
|
+
* event.dataTransfer.setData('text/plain', event.target.id);
|
|
24
|
+
* event.dataTransfer.effectAllowed = 'move';
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* droppable.addEventListener('dragover', (event) => {
|
|
28
|
+
* event.preventDefault();
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* droppable.addEventListener('drop', (event) => {
|
|
32
|
+
* event.preventDefault();
|
|
33
|
+
* const id = event.dataTransfer.getData('text/plain');
|
|
34
|
+
* event.target.appendChild(document.getElementById(id));
|
|
35
|
+
* });
|
|
36
|
+
* </script>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* ## Page Elements for draggable and drop zone
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { By, PageElement } from '@serenity-js/web';
|
|
43
|
+
*
|
|
44
|
+
* const draggable = () =>
|
|
45
|
+
* PageElement.located(By.id('draggable')).describedAs('draggable element');
|
|
46
|
+
*
|
|
47
|
+
* const dropZone = () =>
|
|
48
|
+
* PageElement.located(By.id('droppable')).describedAs('drop zone');
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* ## Dragging and dropping the element
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
55
|
+
* import { Ensure, isPresent } from '@serenity-js/assertions'
|
|
56
|
+
* import { Drag, Navigate } from '@serenity-js/web'
|
|
57
|
+
*
|
|
58
|
+
* await actorCalled('Doug')
|
|
59
|
+
* .attemptsTo(
|
|
60
|
+
* Navigate.to('/drag-and-drop-example.html'),
|
|
61
|
+
* Drag.the(draggable()).to(dropZone()),
|
|
62
|
+
* Ensure.that(draggable().of(dropZone()), isPresent()),
|
|
63
|
+
* )
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* ## Learn more
|
|
67
|
+
*
|
|
68
|
+
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
69
|
+
* - [HTML Drag and Drop API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API) on MDN
|
|
70
|
+
*
|
|
71
|
+
* @group Activities
|
|
72
|
+
*/
|
|
73
|
+
export declare class Drag {
|
|
74
|
+
private readonly draggable;
|
|
75
|
+
/**
|
|
76
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
77
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
78
|
+
*
|
|
79
|
+
* Call [`.to(...)`](https://serenity-js.org/api/web/class/Drag/#to) to specify the destination.
|
|
80
|
+
*
|
|
81
|
+
* @param draggable
|
|
82
|
+
* The element that will be dragged
|
|
83
|
+
*/
|
|
84
|
+
static the(draggable: Answerable<PageElement>): Drag;
|
|
85
|
+
private constructor();
|
|
86
|
+
/**
|
|
87
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
88
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
89
|
+
*
|
|
90
|
+
* @param destination
|
|
91
|
+
* The element to drop it on
|
|
92
|
+
*/
|
|
93
|
+
to(destination: Answerable<PageElement>): Interaction;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=Drag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drag.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/Drag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAO,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,IAAI;IAeO,OAAO,CAAC,QAAQ,CAAC,SAAS;IAb9C;;;;;;;;OAQG;IACH,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI;IAIpD,OAAO;IAGP;;;;;;OAMG;IACH,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW;CAGxD"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Drag = void 0;
|
|
4
|
+
const core_1 = require("@serenity-js/core");
|
|
5
|
+
/**
|
|
6
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
7
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
8
|
+
*
|
|
9
|
+
* ## Example HTML with draggable element and drop zone
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <p id="draggable" draggable="true">
|
|
13
|
+
* This element is draggable.
|
|
14
|
+
* </p>
|
|
15
|
+
* <div id="droppable">
|
|
16
|
+
* Drop Zone
|
|
17
|
+
* </div>
|
|
18
|
+
*
|
|
19
|
+
* <script>
|
|
20
|
+
* const draggable = document.getElementById('draggable');
|
|
21
|
+
* const droppable = document.getElementById('droppable');
|
|
22
|
+
*
|
|
23
|
+
* draggable.addEventListener('dragstart', (event) => {
|
|
24
|
+
* event.dataTransfer.setData('text/plain', event.target.id);
|
|
25
|
+
* event.dataTransfer.effectAllowed = 'move';
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* droppable.addEventListener('dragover', (event) => {
|
|
29
|
+
* event.preventDefault();
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* droppable.addEventListener('drop', (event) => {
|
|
33
|
+
* event.preventDefault();
|
|
34
|
+
* const id = event.dataTransfer.getData('text/plain');
|
|
35
|
+
* event.target.appendChild(document.getElementById(id));
|
|
36
|
+
* });
|
|
37
|
+
* </script>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* ## Page Elements for draggable and drop zone
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { By, PageElement } from '@serenity-js/web';
|
|
44
|
+
*
|
|
45
|
+
* const draggable = () =>
|
|
46
|
+
* PageElement.located(By.id('draggable')).describedAs('draggable element');
|
|
47
|
+
*
|
|
48
|
+
* const dropZone = () =>
|
|
49
|
+
* PageElement.located(By.id('droppable')).describedAs('drop zone');
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* ## Dragging and dropping the element
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
56
|
+
* import { Ensure, isPresent } from '@serenity-js/assertions'
|
|
57
|
+
* import { Drag, Navigate } from '@serenity-js/web'
|
|
58
|
+
*
|
|
59
|
+
* await actorCalled('Doug')
|
|
60
|
+
* .attemptsTo(
|
|
61
|
+
* Navigate.to('/drag-and-drop-example.html'),
|
|
62
|
+
* Drag.the(draggable()).to(dropZone()),
|
|
63
|
+
* Ensure.that(draggable().of(dropZone()), isPresent()),
|
|
64
|
+
* )
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* ## Learn more
|
|
68
|
+
*
|
|
69
|
+
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
70
|
+
* - [HTML Drag and Drop API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API) on MDN
|
|
71
|
+
*
|
|
72
|
+
* @group Activities
|
|
73
|
+
*/
|
|
74
|
+
class Drag {
|
|
75
|
+
draggable;
|
|
76
|
+
/**
|
|
77
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
78
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
79
|
+
*
|
|
80
|
+
* Call [`.to(...)`](https://serenity-js.org/api/web/class/Drag/#to) to specify the destination.
|
|
81
|
+
*
|
|
82
|
+
* @param draggable
|
|
83
|
+
* The element that will be dragged
|
|
84
|
+
*/
|
|
85
|
+
static the(draggable) {
|
|
86
|
+
return new Drag(draggable);
|
|
87
|
+
}
|
|
88
|
+
constructor(draggable) {
|
|
89
|
+
this.draggable = draggable;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
93
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
94
|
+
*
|
|
95
|
+
* @param destination
|
|
96
|
+
* The element to drop it on
|
|
97
|
+
*/
|
|
98
|
+
to(destination) {
|
|
99
|
+
return new DragAndDrop(this.draggable, destination);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.Drag = Drag;
|
|
103
|
+
/**
|
|
104
|
+
* @package
|
|
105
|
+
*/
|
|
106
|
+
class DragAndDrop extends core_1.Interaction {
|
|
107
|
+
draggable;
|
|
108
|
+
destination;
|
|
109
|
+
constructor(draggable, destination) {
|
|
110
|
+
super((0, core_1.the) `#actor drags ${draggable} and drops it on ${destination}`);
|
|
111
|
+
this.draggable = draggable;
|
|
112
|
+
this.destination = destination;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @inheritDoc
|
|
116
|
+
*/
|
|
117
|
+
async performAs(actor) {
|
|
118
|
+
const draggable = await actor.answer(this.draggable);
|
|
119
|
+
const destination = await actor.answer(this.destination);
|
|
120
|
+
await draggable.dragTo(destination);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=Drag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drag.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Drag.ts"],"names":[],"mappings":";;;AACA,4CAAqD;AAIrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,MAAa,IAAI;IAewB;IAbrC;;;;;;;;OAQG;IACH,MAAM,CAAC,GAAG,CAAC,SAAkC;QACzC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,YAAqC,SAAkC;QAAlC,cAAS,GAAT,SAAS,CAAyB;IACvE,CAAC;IAED;;;;;;OAMG;IACH,EAAE,CAAC,WAAoC;QACnC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;CACJ;AA5BD,oBA4BC;AAED;;GAEG;AACH,MAAM,WAAY,SAAQ,kBAAW;IAEZ;IACA;IAFrB,YACqB,SAAkC,EAClC,WAAoC;QAErD,KAAK,CAAC,IAAA,UAAG,EAAA,gBAAiB,SAAU,oBAAqB,WAAY,EAAE,CAAC,CAAC;QAHxD,cAAS,GAAT,SAAS,CAAyB;QAClC,gBAAW,GAAX,WAAW,CAAyB;IAGzD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,KAAY;QACxB,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEzD,MAAM,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;CACJ"}
|
|
@@ -280,8 +280,7 @@ export declare class ExecuteScript {
|
|
|
280
280
|
export declare abstract class ExecuteScriptWithArguments extends Interaction {
|
|
281
281
|
protected readonly script: string | Function;
|
|
282
282
|
protected readonly args: Array<Answerable<any>>;
|
|
283
|
-
constructor(description: Answerable<string>, script: string | Function,
|
|
284
|
-
args?: Array<Answerable<any>>);
|
|
283
|
+
constructor(description: Answerable<string>, script: string | Function, args?: Array<Answerable<any>>);
|
|
285
284
|
/**
|
|
286
285
|
* Instantiates this [`Interaction`](https://serenity-js.org/api/core/class/Interaction/)
|
|
287
286
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecuteScript.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxG,OAAO,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAC;AAMjE;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,WAAW;IAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4IG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,0BAA0B;IAOnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwGG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,0BAA0B;CAMrE;AAED;;;;;;;GAOG;AACH,8BAAsB,0BAA2B,SAAQ,WAAW;IAI5D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;IAC5C,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;gBAF/C,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,EACZ,MAAM,EAAE,MAAM,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"ExecuteScript.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,g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G,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc3F,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;CACnG"}
|
|
@@ -292,8 +292,7 @@ exports.ExecuteScript = ExecuteScript;
|
|
|
292
292
|
class ExecuteScriptWithArguments extends core_1.Interaction {
|
|
293
293
|
script;
|
|
294
294
|
args;
|
|
295
|
-
constructor(description, script,
|
|
296
|
-
args = []) {
|
|
295
|
+
constructor(description, script, args = []) {
|
|
297
296
|
super(description, core_1.Interaction.callerLocation(5));
|
|
298
297
|
this.script = script;
|
|
299
298
|
this.args = args;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecuteScript.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":";;;AACA,4CAAiE;AACjE,iDAAoD;AACpD,uDAA6D;AAE7D,4CAA4C;AAE5C;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAA6B;QACrC,OAAO,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4IG;IACH,MAAM,CAAC,KAAK,CAAC,MAAyB;QAClC,OAAO,IAAI,yBAAyB,CAChC,wCAAwC,EACxC,MAAM,CACT,CAAC;IACN,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwGG;IACH,MAAM,CAAC,IAAI,CAAC,MAAyB;QACjC,OAAO,IAAI,wBAAwB,CAC/B,sCAAsC,EACtC,MAAM,CACT,CAAC;IACN,CAAC;CACJ;AAhRD,sCAgRC;AAED;;;;;;;GAOG;AACH,MAAsB,0BAA2B,SAAQ,kBAAW;IAIzC;IACA;IAHvB,YACI,WAA+B,EACZ,MAAyB,
|
|
1
|
+
{"version":3,"file":"ExecuteScript.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":";;;AACA,4CAAiE;AACjE,iDAAoD;AACpD,uDAA6D;AAE7D,4CAA4C;AAE5C;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAA6B;QACrC,OAAO,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4IG;IACH,MAAM,CAAC,KAAK,CAAC,MAAyB;QAClC,OAAO,IAAI,yBAAyB,CAChC,wCAAwC,EACxC,MAAM,CACT,CAAC;IACN,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwGG;IACH,MAAM,CAAC,IAAI,CAAC,MAAyB;QACjC,OAAO,IAAI,wBAAwB,CAC/B,sCAAsC,EACtC,MAAM,CACT,CAAC;IACN,CAAC;CACJ;AAhRD,sCAgRC;AAED;;;;;;;GAOG;AACH,MAAsB,0BAA2B,SAAQ,kBAAW;IAIzC;IACA;IAHvB,YACI,WAA+B,EACZ,MAAyB,EACzB,OAA+B,EAAE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AU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./Clear"), exports);
|
|
18
18
|
__exportStar(require("./Click"), exports);
|
|
19
19
|
__exportStar(require("./DoubleClick"), exports);
|
|
20
|
+
__exportStar(require("./Drag"), exports);
|
|
20
21
|
__exportStar(require("./Enter"), exports);
|
|
21
22
|
__exportStar(require("./ExecuteScript"), exports);
|
|
22
23
|
__exportStar(require("./Hover"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,gDAA8B;AAC9B,0CAAwB;AACxB,kDAAgC;AAChC,0CAAwB;AACxB,6CAA2B;AAC3B,2DAAyC;AACzC,0CAAwB;AACxB,+CAA6B;AAC7B,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,gDAA8B;AAC9B,yCAAuB;AACvB,0CAAwB;AACxB,kDAAgC;AAChC,0CAAwB;AACxB,6CAA2B;AAC3B,2DAAyC;AACzC,0CAAwB;AACxB,+CAA6B;AAC7B,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,mDAAiC"}
|
|
@@ -115,6 +115,13 @@ export declare abstract class PageElement<Native_Element_Type = any> implements
|
|
|
115
115
|
abstract rightClick(): Promise<void>;
|
|
116
116
|
abstract selectOptions(...options: Array<SelectOption>): Promise<void>;
|
|
117
117
|
abstract selectedOptions(): Promise<Array<SelectOption>>;
|
|
118
|
+
/**
|
|
119
|
+
* Drags this element and drops it on the `destination` element.
|
|
120
|
+
*
|
|
121
|
+
* @param destination
|
|
122
|
+
* The element to drop this element on
|
|
123
|
+
*/
|
|
124
|
+
abstract dragTo(destination: PageElement<Native_Element_Type>): Promise<void>;
|
|
118
125
|
abstract attribute(name: string): Promise<string>;
|
|
119
126
|
abstract text(): Promise<string>;
|
|
120
127
|
abstract value(): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageElement.d.ts","sourceRoot":"","sources":["../../../src/screenplay/models/PageElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAG,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAKlH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,8BAAsB,WAAW,CAAC,mBAAmB,G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BAAS,GAAE,CAAC,CAAC;IAC3D,CAAC;IA6DD;;OAEG;IACH,KAAK,CAAC,aAAa;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC;IAED,QAAQ;QACJ,OAAO,uBAAwB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAG,EAAE,CAAC;IAC9D,CAAC;IAoFD;;;;OAIG;IACH,KAAK,CAAC,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IACpC,CAAC;CAoBJ;AAtPD,kCAsPC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulates HTML5 drag and drop events.
|
|
3
|
+
*
|
|
4
|
+
* This script is a workaround for Selenium WebDriver's inability to properly
|
|
5
|
+
* trigger HTML5 drag events using the Actions API. It manually dispatches
|
|
6
|
+
* the required drag events (dragstart, dragenter, dragover, drop, dragend)
|
|
7
|
+
* to simulate a complete drag and drop operation.
|
|
8
|
+
*
|
|
9
|
+
* @param source - The element to drag
|
|
10
|
+
* @param target - The element to drop onto
|
|
11
|
+
*/
|
|
12
|
+
export declare function dragAndDrop(source: HTMLElement, target: HTMLElement): void;
|
|
13
|
+
//# sourceMappingURL=dragAndDrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../src/scripts/dragAndDrop.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAgE1E"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dragAndDrop = dragAndDrop;
|
|
4
|
+
/* c8 ignore start */
|
|
5
|
+
/**
|
|
6
|
+
* Simulates HTML5 drag and drop events.
|
|
7
|
+
*
|
|
8
|
+
* This script is a workaround for Selenium WebDriver's inability to properly
|
|
9
|
+
* trigger HTML5 drag events using the Actions API. It manually dispatches
|
|
10
|
+
* the required drag events (dragstart, dragenter, dragover, drop, dragend)
|
|
11
|
+
* to simulate a complete drag and drop operation.
|
|
12
|
+
*
|
|
13
|
+
* @param source - The element to drag
|
|
14
|
+
* @param target - The element to drop onto
|
|
15
|
+
*/
|
|
16
|
+
function dragAndDrop(source, target) {
|
|
17
|
+
function createDragEvent(type, dataTransfer) {
|
|
18
|
+
return new DragEvent(type, {
|
|
19
|
+
bubbles: true,
|
|
20
|
+
cancelable: true,
|
|
21
|
+
dataTransfer,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function createDataTransfer() {
|
|
25
|
+
try {
|
|
26
|
+
return new DataTransfer();
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Fallback for older browsers
|
|
30
|
+
const event = document.createEvent('CustomEvent');
|
|
31
|
+
event.initCustomEvent('', false, false, null);
|
|
32
|
+
event.dataTransfer = {
|
|
33
|
+
data: {},
|
|
34
|
+
setData(format, data) {
|
|
35
|
+
this.data[format] = data;
|
|
36
|
+
},
|
|
37
|
+
getData(format) {
|
|
38
|
+
return this.data[format];
|
|
39
|
+
},
|
|
40
|
+
clearData(format) {
|
|
41
|
+
if (format) {
|
|
42
|
+
delete this.data[format];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.data = {};
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
setDragImage() {
|
|
49
|
+
// no-op
|
|
50
|
+
},
|
|
51
|
+
dropEffect: 'none',
|
|
52
|
+
effectAllowed: 'all',
|
|
53
|
+
files: [],
|
|
54
|
+
items: [],
|
|
55
|
+
types: [],
|
|
56
|
+
};
|
|
57
|
+
return event.dataTransfer;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Create a DataTransfer object to share between events
|
|
61
|
+
const dataTransfer = createDataTransfer();
|
|
62
|
+
// Dispatch dragstart on source
|
|
63
|
+
source.dispatchEvent(createDragEvent('dragstart', dataTransfer));
|
|
64
|
+
// Dispatch dragenter on target
|
|
65
|
+
target.dispatchEvent(createDragEvent('dragenter', dataTransfer));
|
|
66
|
+
// Dispatch dragover on target (required for drop to work)
|
|
67
|
+
const dragOverEvent = createDragEvent('dragover', dataTransfer);
|
|
68
|
+
target.dispatchEvent(dragOverEvent);
|
|
69
|
+
// Dispatch drop on target
|
|
70
|
+
target.dispatchEvent(createDragEvent('drop', dataTransfer));
|
|
71
|
+
// Dispatch dragend on source
|
|
72
|
+
source.dispatchEvent(createDragEvent('dragend', dataTransfer));
|
|
73
|
+
}
|
|
74
|
+
/* c8 ignore stop */
|
|
75
|
+
//# sourceMappingURL=dragAndDrop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dragAndDrop.js","sourceRoot":"","sources":["../../src/scripts/dragAndDrop.ts"],"names":[],"mappings":";;AAaA,kCAgEC;AA5ED,qBAAqB;AACrB;;;;;;;;;;GAUG;AACH,SAAgB,WAAW,CAAC,MAAmB,EAAE,MAAmB;IAEhE,SAAS,eAAe,CAAC,IAAY,EAAE,YAA0B;QAC7D,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE;YACvB,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI;YAChB,YAAY;SACf,CAAC,CAAC;IACP,CAAC;IAED,SAAS,kBAAkB;QACvB,IAAI,CAAC;YACD,OAAO,IAAI,YAAY,EAAE,CAAC;QAC9B,CAAC;QACD,MAAM,CAAC;YACH,8BAA8B;YAC9B,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAQ,CAAC;YACzD,KAAK,CAAC,eAAe,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;YAC9C,KAAK,CAAC,YAAY,GAAG;gBACjB,IAAI,EAAE,EAA4B;gBAClC,OAAO,CAAC,MAAc,EA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ripts/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
package/lib/scripts/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./dragAndDrop"), exports);
|
|
17
18
|
__exportStar(require("./isVisible"), exports);
|
|
18
19
|
__exportStar(require("./rehydrate"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/lib/scripts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,8CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,8CAA4B"}
|
package/lib/scripts/isVisible.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isVisible = isVisible;
|
|
4
|
-
/* eslint-disable unicorn/no-for-loop,unicorn/consistent-function-scoping */
|
|
5
4
|
/* c8 ignore start */
|
|
6
5
|
function isVisible(domNode) {
|
|
7
6
|
const style = window.getComputedStyle(domNode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isVisible.js","sourceRoot":"","sources":["../../src/scripts/isVisible.ts"],"names":[],"mappings":";;AAEA,8BA8GC;
|
|
1
|
+
{"version":3,"file":"isVisible.js","sourceRoot":"","sources":["../../src/scripts/isVisible.ts"],"names":[],"mappings":";;AAEA,8BA8GC;AA/GD,qBAAqB;AACrB,SAAgB,SAAS,CAAC,OAAoB;IAE1C,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE/C,IAAI,KAAK,CAAC,OAAO,KAAK,GAAG,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,qBAAqB,IAAI,CAAC,OAAO,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,cAAc,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QAC1I,OAAO,KAAK,CAAA;IAChB,CAAC;IAED,oCAAoC;IACpC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;IAExC,0BAA0B;IAC1B,SAAS,qBAAqB,CAAE,OAAoB,EAAE,OAAkB;QACpE,OAAO,GAAG,OAAO,IAAI,QAAQ,CAAA;QAC7B,MAAM,UAAU,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;QAClD,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;QACrD,MAAM,CAAC,GAAG,UAA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U,CAAC;YAC3E,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;QAEF,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvC,OAAO,KAAK,CAAA;QAChB,CAAC;QAED,OAAO,yBAAyB,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;IAED,OAAO,yBAAyB,CAAC,sBAAsB,CAAC,OAAO,CAAyB,EAAE,OAAO,CAAC,CAAA;AACtG,CAAC;AACD,oBAAoB"}
|
package/lib/scripts/rehydrate.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rehydrate = rehydrate;
|
|
4
|
-
/* eslint-disable unicorn/consistent-function-scoping */
|
|
5
4
|
// todo: instead of manually including isPlainObject, each script from web/lib/scripts should be pre-built and included in the global browser scope
|
|
6
5
|
function rehydrate(...result) {
|
|
7
6
|
function isPlainObject(v) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rehydrate.js","sourceRoot":"","sources":["../../src/scripts/rehydrate.ts"],"names":[],"mappings":";;AAEA,8BAmCC;
|
|
1
|
+
{"version":3,"file":"rehydrate.js","sourceRoot":"","sources":["../../src/scripts/rehydrate.ts"],"names":[],"mappings":";;AAEA,8BAmCC;AApCD,mJAAmJ;AACnJ,SAAgB,SAAS,CAAC,GAAG,MAA8D;IACvF,SAAS,aAAa,CAAC,CAAU;QAC7B,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACtC,IAAI,OAAO,MAAM,CAAC,cAAc,KAAK,UAAU,EAAE,CAAC;gBAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;gBACvC,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KA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AC,oBAAoB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/web",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.40.0",
|
|
4
4
|
"description": "Serenity/JS Screenplay Pattern library offering a flexible, web driver-agnostic approach for interacting with web-based user interfaces and components, suitable for various testing contexts",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"node": "^20 || ^22 || ^24"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@serenity-js/assertions": "3.
|
|
57
|
-
"@serenity-js/core": "3.
|
|
56
|
+
"@serenity-js/assertions": "3.40.0",
|
|
57
|
+
"@serenity-js/core": "3.40.0",
|
|
58
58
|
"tiny-types": "1.24.3"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"ts-node": "10.9.2",
|
|
68
68
|
"typescript": "5.9.3"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "185b8435cf6e87b8a54f10944da3e652227ecb6e"
|
|
71
71
|
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { Actor, Answerable } from '@serenity-js/core';
|
|
2
|
+
import { Interaction, the } from '@serenity-js/core';
|
|
3
|
+
|
|
4
|
+
import type { PageElement } from '../models';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
8
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
9
|
+
*
|
|
10
|
+
* ## Example HTML with draggable element and drop zone
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <p id="draggable" draggable="true">
|
|
14
|
+
* This element is draggable.
|
|
15
|
+
* </p>
|
|
16
|
+
* <div id="droppable">
|
|
17
|
+
* Drop Zone
|
|
18
|
+
* </div>
|
|
19
|
+
*
|
|
20
|
+
* <script>
|
|
21
|
+
* const draggable = document.getElementById('draggable');
|
|
22
|
+
* const droppable = document.getElementById('droppable');
|
|
23
|
+
*
|
|
24
|
+
* draggable.addEventListener('dragstart', (event) => {
|
|
25
|
+
* event.dataTransfer.setData('text/plain', event.target.id);
|
|
26
|
+
* event.dataTransfer.effectAllowed = 'move';
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* droppable.addEventListener('dragover', (event) => {
|
|
30
|
+
* event.preventDefault();
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* droppable.addEventListener('drop', (event) => {
|
|
34
|
+
* event.preventDefault();
|
|
35
|
+
* const id = event.dataTransfer.getData('text/plain');
|
|
36
|
+
* event.target.appendChild(document.getElementById(id));
|
|
37
|
+
* });
|
|
38
|
+
* </script>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* ## Page Elements for draggable and drop zone
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { By, PageElement } from '@serenity-js/web';
|
|
45
|
+
*
|
|
46
|
+
* const draggable = () =>
|
|
47
|
+
* PageElement.located(By.id('draggable')).describedAs('draggable element');
|
|
48
|
+
*
|
|
49
|
+
* const dropZone = () =>
|
|
50
|
+
* PageElement.located(By.id('droppable')).describedAs('drop zone');
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* ## Dragging and dropping the element
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
57
|
+
* import { Ensure, isPresent } from '@serenity-js/assertions'
|
|
58
|
+
* import { Drag, Navigate } from '@serenity-js/web'
|
|
59
|
+
*
|
|
60
|
+
* await actorCalled('Doug')
|
|
61
|
+
* .attemptsTo(
|
|
62
|
+
* Navigate.to('/drag-and-drop-example.html'),
|
|
63
|
+
* Drag.the(draggable()).to(dropZone()),
|
|
64
|
+
* Ensure.that(draggable().of(dropZone()), isPresent()),
|
|
65
|
+
* )
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* ## Learn more
|
|
69
|
+
*
|
|
70
|
+
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
71
|
+
* - [HTML Drag and Drop API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API) on MDN
|
|
72
|
+
*
|
|
73
|
+
* @group Activities
|
|
74
|
+
*/
|
|
75
|
+
export class Drag {
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
79
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
80
|
+
*
|
|
81
|
+
* Call [`.to(...)`](https://serenity-js.org/api/web/class/Drag/#to) to specify the destination.
|
|
82
|
+
*
|
|
83
|
+
* @param draggable
|
|
84
|
+
* The element that will be dragged
|
|
85
|
+
*/
|
|
86
|
+
static the(draggable: Answerable<PageElement>): Drag {
|
|
87
|
+
return new Drag(draggable);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private constructor(private readonly draggable: Answerable<PageElement>) {
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
95
|
+
* to drag a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) and drop it on another [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
96
|
+
*
|
|
97
|
+
* @param destination
|
|
98
|
+
* The element to drop it on
|
|
99
|
+
*/
|
|
100
|
+
to(destination: Answerable<PageElement>): Interaction {
|
|
101
|
+
return new DragAndDrop(this.draggable, destination);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @package
|
|
107
|
+
*/
|
|
108
|
+
class DragAndDrop extends Interaction {
|
|
109
|
+
constructor(
|
|
110
|
+
private readonly draggable: Answerable<PageElement>,
|
|
111
|
+
private readonly destination: Answerable<PageElement>,
|
|
112
|
+
) {
|
|
113
|
+
super(the`#actor drags ${ draggable } and drops it on ${ destination }`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @inheritDoc
|
|
118
|
+
*/
|
|
119
|
+
async performAs(actor: Actor): Promise<void> {
|
|
120
|
+
const draggable = await actor.answer(this.draggable);
|
|
121
|
+
const destination = await actor.answer(this.destination);
|
|
122
|
+
|
|
123
|
+
await draggable.dragTo(destination);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -170,7 +170,7 @@ export class ExecuteScript {
|
|
|
170
170
|
* @param script
|
|
171
171
|
* The script to be executed
|
|
172
172
|
*/
|
|
173
|
-
static async(script: string | Function): ExecuteScriptWithArguments {
|
|
173
|
+
static async(script: string | Function): ExecuteScriptWithArguments {
|
|
174
174
|
return new ExecuteAsynchronousScript(
|
|
175
175
|
`#actor executes an asynchronous script`,
|
|
176
176
|
script,
|
|
@@ -282,7 +282,7 @@ export class ExecuteScript {
|
|
|
282
282
|
* @param script
|
|
283
283
|
* The script to be executed
|
|
284
284
|
*/
|
|
285
|
-
static sync(script: string | Function): ExecuteScriptWithArguments {
|
|
285
|
+
static sync(script: string | Function): ExecuteScriptWithArguments {
|
|
286
286
|
return new ExecuteSynchronousScript(
|
|
287
287
|
`#actor executes a synchronous script`,
|
|
288
288
|
script,
|
|
@@ -302,7 +302,7 @@ export abstract class ExecuteScriptWithArguments extends Interaction {
|
|
|
302
302
|
|
|
303
303
|
constructor(
|
|
304
304
|
description: Answerable<string>,
|
|
305
|
-
protected readonly script: string | Function,
|
|
305
|
+
protected readonly script: string | Function,
|
|
306
306
|
protected readonly args: Array<Answerable<any>> = [],
|
|
307
307
|
) {
|
|
308
308
|
super(description, Interaction.callerLocation(5));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValueInspector } from '@serenity-js/core/lib/io';
|
|
2
2
|
|
|
3
|
-
/* eslint-disable @
|
|
3
|
+
/* eslint-disable @stylistic/indent */
|
|
4
4
|
type TransformedArgument<T, U> =
|
|
5
5
|
T extends Array<infer E> ? Array<TransformedArgument<E, U>> :
|
|
6
6
|
T extends object ? { [K in keyof T]: TransformedArgument<T[K], U> }
|
|
@@ -167,6 +167,14 @@ export abstract class PageElement<Native_Element_Type = any> implements Optional
|
|
|
167
167
|
abstract selectOptions(...options: Array<SelectOption>): Promise<void>;
|
|
168
168
|
abstract selectedOptions(): Promise<Array<SelectOption>>;
|
|
169
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Drags this element and drops it on the `destination` element.
|
|
172
|
+
*
|
|
173
|
+
* @param destination
|
|
174
|
+
* The element to drop this element on
|
|
175
|
+
*/
|
|
176
|
+
abstract dragTo(destination: PageElement<Native_Element_Type>): Promise<void>;
|
|
177
|
+
|
|
170
178
|
abstract attribute(name: string): Promise<string>;
|
|
171
179
|
abstract text(): Promise<string>;
|
|
172
180
|
abstract value(): Promise<string>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
/* c8 ignore start */
|
|
3
|
+
/**
|
|
4
|
+
* Simulates HTML5 drag and drop events.
|
|
5
|
+
*
|
|
6
|
+
* This script is a workaround for Selenium WebDriver's inability to properly
|
|
7
|
+
* trigger HTML5 drag events using the Actions API. It manually dispatches
|
|
8
|
+
* the required drag events (dragstart, dragenter, dragover, drop, dragend)
|
|
9
|
+
* to simulate a complete drag and drop operation.
|
|
10
|
+
*
|
|
11
|
+
* @param source - The element to drag
|
|
12
|
+
* @param target - The element to drop onto
|
|
13
|
+
*/
|
|
14
|
+
export function dragAndDrop(source: HTMLElement, target: HTMLElement): void {
|
|
15
|
+
|
|
16
|
+
function createDragEvent(type: string, dataTransfer: DataTransfer): DragEvent {
|
|
17
|
+
return new DragEvent(type, {
|
|
18
|
+
bubbles: true,
|
|
19
|
+
cancelable: true,
|
|
20
|
+
dataTransfer,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function createDataTransfer(): DataTransfer {
|
|
25
|
+
try {
|
|
26
|
+
return new DataTransfer();
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Fallback for older browsers
|
|
30
|
+
const event = document.createEvent('CustomEvent') as any;
|
|
31
|
+
event.initCustomEvent('', false, false, null);
|
|
32
|
+
event.dataTransfer = {
|
|
33
|
+
data: {} as Record<string, string>,
|
|
34
|
+
setData(format: string, data: string) {
|
|
35
|
+
this.data[format] = data;
|
|
36
|
+
},
|
|
37
|
+
getData(format: string) {
|
|
38
|
+
return this.data[format];
|
|
39
|
+
},
|
|
40
|
+
clearData(format?: string) {
|
|
41
|
+
if (format) {
|
|
42
|
+
delete this.data[format];
|
|
43
|
+
} else {
|
|
44
|
+
this.data = {};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
setDragImage() {
|
|
48
|
+
// no-op
|
|
49
|
+
},
|
|
50
|
+
dropEffect: 'none' as DataTransfer['dropEffect'],
|
|
51
|
+
effectAllowed: 'all' as DataTransfer['effectAllowed'],
|
|
52
|
+
files: [] as unknown as FileList,
|
|
53
|
+
items: [] as unknown as DataTransferItemList,
|
|
54
|
+
types: [] as string[],
|
|
55
|
+
};
|
|
56
|
+
return event.dataTransfer;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Create a DataTransfer object to share between events
|
|
61
|
+
const dataTransfer = createDataTransfer();
|
|
62
|
+
|
|
63
|
+
// Dispatch dragstart on source
|
|
64
|
+
source.dispatchEvent(createDragEvent('dragstart', dataTransfer));
|
|
65
|
+
|
|
66
|
+
// Dispatch dragenter on target
|
|
67
|
+
target.dispatchEvent(createDragEvent('dragenter', dataTransfer));
|
|
68
|
+
|
|
69
|
+
// Dispatch dragover on target (required for drop to work)
|
|
70
|
+
const dragOverEvent = createDragEvent('dragover', dataTransfer);
|
|
71
|
+
target.dispatchEvent(dragOverEvent);
|
|
72
|
+
|
|
73
|
+
// Dispatch drop on target
|
|
74
|
+
target.dispatchEvent(createDragEvent('drop', dataTransfer));
|
|
75
|
+
|
|
76
|
+
// Dispatch dragend on source
|
|
77
|
+
source.dispatchEvent(createDragEvent('dragend', dataTransfer));
|
|
78
|
+
}
|
|
79
|
+
/* c8 ignore stop */
|
package/src/scripts/index.ts
CHANGED
package/src/scripts/isVisible.ts
CHANGED
package/src/scripts/rehydrate.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
// todo: instead of manually including isPlainObject, each script from web/lib/scripts should be pre-built and included in the global browser scope
|
|
3
3
|
export function rehydrate(...result: [ { argsCount: number; refsCount: number }, ...any[] ]): Array<any> {
|
|
4
|
-
function isPlainObject(v: unknown): v is object {
|
|
4
|
+
function isPlainObject(v: unknown): v is object {
|
|
5
5
|
if (typeof v === 'object' && v !== null) {
|
|
6
6
|
if (typeof Object.getPrototypeOf === 'function') {
|
|
7
7
|
const proto = Object.getPrototypeOf(v);
|