@serenity-js/web 3.0.0-rc.30 → 3.0.0-rc.32
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 +19 -0
- package/lib/screenplay/interactions/ExecuteScript.d.ts +1 -1
- package/lib/screenplay/interactions/ExecuteScript.d.ts.map +1 -1
- package/lib/screenplay/interactions/ExecuteScript.js +3 -2
- package/lib/screenplay/interactions/ExecuteScript.js.map +1 -1
- package/package.json +4 -4
- package/src/screenplay/interactions/ExecuteScript.ts +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.0.0-rc.32](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.31...v3.0.0-rc.32) (2022-10-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @serenity-js/web
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.0.0-rc.31](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.30...v3.0.0-rc.31) (2022-10-07)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **web:** accept Answerable as argument of ExecuteScript.from(sourceUrl) ([0b06703](https://github.com/serenity-js/serenity-js/commit/0b06703cd832bf64dbb2636ef955ecba7b8b430c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [3.0.0-rc.30](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.29...v3.0.0-rc.30) (2022-10-05)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -18,7 +18,7 @@ export declare class ExecuteScript {
|
|
|
18
18
|
* @param sourceUrl
|
|
19
19
|
* The URL to load the script from
|
|
20
20
|
*/
|
|
21
|
-
static from(sourceUrl: string): Interaction;
|
|
21
|
+
static from(sourceUrl: Answerable<string>): Interaction;
|
|
22
22
|
/**
|
|
23
23
|
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
24
24
|
* to execute an asynchronous script within the context of the current browser tab.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecuteScript.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAK,WAAW,EAAc,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAM/H;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW;
|
|
1
|
+
{"version":3,"file":"ExecuteScript.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAK,WAAW,EAAc,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAM/H;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,WAAW;IAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,0BAA0B;IAOnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;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,MAAM,EACA,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAY,mDAAmD;IACxF,IAAI,GAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAM;IAKxD;;;;;OAKG;aACa,aAAa,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW;IAE3E;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,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"}
|
|
@@ -236,7 +236,7 @@ class ExecuteAsynchronousScript extends ExecuteScriptWithArguments {
|
|
|
236
236
|
*/
|
|
237
237
|
class ExecuteScriptFromUrl extends core_1.Interaction {
|
|
238
238
|
constructor(sourceUrl) {
|
|
239
|
-
super(`#actor executes a script from ${sourceUrl}`);
|
|
239
|
+
super((0, core_1.d) `#actor executes a script from ${sourceUrl}`);
|
|
240
240
|
this.sourceUrl = sourceUrl;
|
|
241
241
|
}
|
|
242
242
|
/**
|
|
@@ -244,6 +244,7 @@ class ExecuteScriptFromUrl extends core_1.Interaction {
|
|
|
244
244
|
*/
|
|
245
245
|
async performAs(actor) {
|
|
246
246
|
const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
|
|
247
|
+
const sourceUrl = await actor.answer(this.sourceUrl);
|
|
247
248
|
return page.executeAsyncScript(
|
|
248
249
|
/* istanbul ignore next */
|
|
249
250
|
function executeScriptFromUrl(sourceUrl, callback) {
|
|
@@ -263,7 +264,7 @@ class ExecuteScriptFromUrl extends core_1.Interaction {
|
|
|
263
264
|
script.src = sourceUrl;
|
|
264
265
|
script.async = true;
|
|
265
266
|
document.head.append(script);
|
|
266
|
-
},
|
|
267
|
+
}, sourceUrl)
|
|
267
268
|
.then(errorMessage => {
|
|
268
269
|
if (errorMessage) {
|
|
269
270
|
throw new core_1.LogicError(errorMessage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecuteScript.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":";;;AAAA,4CAA+H;AAC/H,iDAAoD;AACpD,uDAA6D;AAE7D,4CAA4C;AAE5C;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"ExecuteScript.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":";;;AAAA,4CAA+H;AAC/H,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAyB;QAClC,OAAO,IAAI,yBAAyB,CAChC,wCAAwC,EACxC,MAAM,CACT,CAAC;IACN,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAq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AC;YACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE;gBAC7B,OAAO,QAAQ,CAAC,6BAA8B,SAAU,EAAE,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC;YACvB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;YACpB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC,EACD,SAAS,CACZ;aACA,IAAI,CAAC,YAAY,CAAC,EAAE;YACjB,IAAI,YAAY,EAAE;gBACd,MAAM,IAAI,iBAAU,CAAC,YAAY,CAAC,CAAC;aACtC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,wBAAyB,SAAQ,0BAA0B;IAE7D,aAAa,CAAC,GAAG,IAA4B;QACzC,OAAO,IAAI,wBAAwB,CAC/B,IAAI,CAAC,MAAM,GAAG,CAAC;YACX,CAAC,CAAC,IAAA,QAAC,EAAC,wDAAyD,IAAK,EAAE;YACpE,CAAC,CAAC,IAAI,CAAC,WAAW,EACtB,IAAI,CAAC,MAAM,EACX,IAAI,CACP,CAAC;IACN,CAAC;IAES,KAAK,CAAC,SAAS,CAAC,KAAuC,EAAE,IAAW;QAC1E,MAAM,IAAI,GAAG,MAAM,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,CAAI,gBAAgB;IAC1F,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/web",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.32",
|
|
4
4
|
"description": "Serenity/JS Screenplay Pattern APIs for the Web",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"npm": "^6 || ^7 || ^8"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@serenity-js/assertions": "3.0.0-rc.
|
|
48
|
-
"@serenity-js/core": "3.0.0-rc.
|
|
47
|
+
"@serenity-js/assertions": "3.0.0-rc.32",
|
|
48
|
+
"@serenity-js/core": "3.0.0-rc.32",
|
|
49
49
|
"tiny-types": "^1.19.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"ts-node": "^10.9.1",
|
|
58
58
|
"typescript": "^4.8.4"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "3480ba44d83ff663a6a7c3e51ab1f977776cc9d0"
|
|
61
61
|
}
|
|
@@ -24,7 +24,7 @@ export class ExecuteScript {
|
|
|
24
24
|
* @param sourceUrl
|
|
25
25
|
* The URL to load the script from
|
|
26
26
|
*/
|
|
27
|
-
static from(sourceUrl: string): Interaction {
|
|
27
|
+
static from(sourceUrl: Answerable<string>): Interaction {
|
|
28
28
|
return new ExecuteScriptFromUrl(sourceUrl);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -267,15 +267,16 @@ class ExecuteAsynchronousScript extends ExecuteScriptWithArguments {
|
|
|
267
267
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement
|
|
268
268
|
*/
|
|
269
269
|
class ExecuteScriptFromUrl extends Interaction {
|
|
270
|
-
constructor(private readonly sourceUrl: string) {
|
|
271
|
-
super(`#actor executes a script from ${ sourceUrl }`);
|
|
270
|
+
constructor(private readonly sourceUrl: Answerable<string>) {
|
|
271
|
+
super(d`#actor executes a script from ${ sourceUrl }`);
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
/**
|
|
275
275
|
* @inheritDoc
|
|
276
276
|
*/
|
|
277
277
|
async performAs(actor: UsesAbilities & AnswersQuestions): Promise<any> {
|
|
278
|
-
const page
|
|
278
|
+
const page = await BrowseTheWeb.as(actor).currentPage();
|
|
279
|
+
const sourceUrl = await actor.answer(this.sourceUrl);
|
|
279
280
|
|
|
280
281
|
return page.executeAsyncScript(
|
|
281
282
|
/* istanbul ignore next */
|
|
@@ -300,7 +301,7 @@ class ExecuteScriptFromUrl extends Interaction {
|
|
|
300
301
|
script.async = true;
|
|
301
302
|
document.head.append(script);
|
|
302
303
|
},
|
|
303
|
-
|
|
304
|
+
sourceUrl
|
|
304
305
|
)
|
|
305
306
|
.then(errorMessage => {
|
|
306
307
|
if (errorMessage) {
|