@serenity-js/playwright-test 3.21.2 → 3.22.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 +12 -0
- package/lib/api/PerformActivitiesAsPlaywrightSteps.d.ts.map +1 -1
- package/lib/api/PerformActivitiesAsPlaywrightSteps.js +10 -10
- package/lib/api/PerformActivitiesAsPlaywrightSteps.js.map +1 -1
- package/package.json +7 -7
- package/src/api/PerformActivitiesAsPlaywrightSteps.ts +21 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.22.0](https://github.com/serenity-js/serenity-js/compare/v3.21.2...v3.22.0) (2024-04-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **deps:** update playwright dependencies to v1.43.0 ([f9a2f9d](https://github.com/serenity-js/serenity-js/commit/f9a2f9d837765843af76ade9a78f92e32e1d884f))
|
|
12
|
+
* **playwright-test:** support for Playwright Test 1.43.0 ([0162b6e](https://github.com/serenity-js/serenity-js/commit/0162b6e0b56e5cbf11ab03326181480b740f24ef))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## [3.21.2](https://github.com/serenity-js/serenity-js/compare/v3.21.1...v3.21.2) (2024-03-31)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @serenity-js/playwright-test
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerformActivitiesAsPlaywrightSteps.d.ts","sourceRoot":"","sources":["../../src/api/PerformActivitiesAsPlaywrightSteps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"PerformActivitiesAsPlaywrightSteps.d.ts","sourceRoot":"","sources":["../../src/api/PerformActivitiesAsPlaywrightSteps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,IAAI,EAAY,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAkB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE,qBAAa,kCAAmC,SAAQ,iBAAiB;IAKjE,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAFrB,KAAK,EAAE,kBAAkB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAC5C,KAAK,EAAE,iBAAiB,EACP,IAAI,EAAE,OAAO,IAAI;IAKvB,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBzD,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,UAAU;CAQrB"}
|
|
@@ -11,16 +11,16 @@ class PerformActivitiesAsPlaywrightSteps extends core_1.PerformActivities {
|
|
|
11
11
|
}
|
|
12
12
|
async perform(activity) {
|
|
13
13
|
const testInfo = this.test.info();
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
// Monkey-patch addStep to allow for passing a pre-computed location
|
|
15
|
+
// see https://github.com/microsoft/playwright/issues/30160
|
|
16
|
+
const originalAddStep = testInfo._addStep;
|
|
17
|
+
testInfo._addStep = (data) => {
|
|
18
|
+
data.location = this.locationOf(activity);
|
|
19
|
+
data.params = this.parametersOf(activity);
|
|
20
|
+
return originalAddStep.call(testInfo, data);
|
|
21
|
+
};
|
|
22
|
+
await this.test.step(this.nameOf(activity), () => super.perform(activity));
|
|
23
|
+
testInfo._addStep = originalAddStep;
|
|
24
24
|
}
|
|
25
25
|
parametersOf(activity) {
|
|
26
26
|
if (activity instanceof core_1.Interaction) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerformActivitiesAsPlaywrightSteps.js","sourceRoot":"","sources":["../../src/api/PerformActivitiesAsPlaywrightSteps.ts"],"names":[],"mappings":";;;AAEA,4CAAsE;AAEtE,oDAA6D;AAE7D,MAAa,kCAAmC,SAAQ,wBAAiB;IAKhD;IAHrB,YACI,KAA4C,EAC5C,KAAwB,EACP,IAAiB;QAElC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAFH,SAAI,GAAJ,IAAI,CAAa;IAGtC,CAAC;IAEQ,KAAK,CAAC,OAAO,CAAC,QAAkB;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"PerformActivitiesAsPlaywrightSteps.js","sourceRoot":"","sources":["../../src/api/PerformActivitiesAsPlaywrightSteps.ts"],"names":[],"mappings":";;;AAEA,4CAAsE;AAEtE,oDAA6D;AAE7D,MAAa,kCAAmC,SAAQ,wBAAiB;IAKhD;IAHrB,YACI,KAA4C,EAC5C,KAAwB,EACP,IAAiB;QAElC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAFH,SAAI,GAAJ,IAAI,CAAa;IAGtC,CAAC;IAEQ,KAAK,CAAC,OAAO,CAAC,QAAkB;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAE9B,CAAC;QAEF,oEAAoE;QACpE,2DAA2D;QAC3D,MAAM,eAAe,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAC1C,QAAQ,CAAC,QAAQ,GAAG,CAAC,IAAsB,EAAE,EAAE;YAE3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YAE1C,OAAO,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,CAAA;QAED,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAChB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EACrB,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAChC,CAAC;QAEF,QAAQ,CAAC,QAAQ,GAAG,eAAe,CAAC;IACxC,CAAC;IAEO,YAAY,CAAC,QAAkB;QACnC,IAAI,QAAQ,YAAY,kBAAW,EAAE;YACjC,OAAO,IAAA,6BAAmB,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBACvD,GAAG,CAAC,KAAK,CAAC,GAAG,IAAA,QAAC,EAAA,GAAI,QAAQ,CAAC,KAAK,CAAE,EAAE,CAAC;gBACrC,OAAO,GAAG,CAAC;YACf,CAAC,EAAE,EAAE,CAAC,CAAC;SACV;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAEO,UAAU,CAAC,QAAkB;QACjC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,qBAAqB,EAAE,CAAC;QAC/D,OAAO;YACH,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC,KAAK;YACtC,IAAI,EAAE,qBAAqB,CAAC,IAAI;YAChC,MAAM,EAAE,qBAAqB,CAAC,MAAM;SACvC,CAAC;IACN,CAAC;CACJ;AApDD,gFAoDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/playwright-test",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0",
|
|
4
4
|
"description": "Serenity/JS reporter and test APIs for Playwright Test",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"node": "^16.13 || ^18.12 || ^20"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@playwright/test": "1.
|
|
49
|
-
"@serenity-js/core": "3.
|
|
50
|
-
"@serenity-js/playwright": "3.
|
|
51
|
-
"@serenity-js/rest": "3.
|
|
52
|
-
"@serenity-js/web": "3.
|
|
48
|
+
"@playwright/test": "1.43.0",
|
|
49
|
+
"@serenity-js/core": "3.22.0",
|
|
50
|
+
"@serenity-js/playwright": "3.22.0",
|
|
51
|
+
"@serenity-js/rest": "3.22.0",
|
|
52
|
+
"@serenity-js/web": "3.22.0",
|
|
53
53
|
"deepmerge": "4.3.1",
|
|
54
54
|
"tiny-types": "1.22.0"
|
|
55
55
|
},
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"ts-node": "10.9.2",
|
|
64
64
|
"typescript": "5.2.2"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "28f90019515001a310e01aa484cbd27f533f9e89"
|
|
67
67
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { test as base } from '@playwright/test';
|
|
1
|
+
import type { test as base, TestInfo } from '@playwright/test';
|
|
2
2
|
import type { Activity, PerformsActivities } from '@serenity-js/core';
|
|
3
3
|
import { d, Interaction, PerformActivities } from '@serenity-js/core';
|
|
4
4
|
import type { EmitsDomainEvents } from '@serenity-js/core/lib/events';
|
|
@@ -15,19 +15,27 @@ export class PerformActivitiesAsPlaywrightSteps extends PerformActivities {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
override async perform(activity: Activity): Promise<void> {
|
|
18
|
-
const testInfo = this.test.info()
|
|
18
|
+
const testInfo = this.test.info() as TestInfo & {
|
|
19
|
+
_addStep: (data: TestStepInternal) => TestStepInternal
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Monkey-patch addStep to allow for passing a pre-computed location
|
|
23
|
+
// see https://github.com/microsoft/playwright/issues/30160
|
|
24
|
+
const originalAddStep = testInfo._addStep;
|
|
25
|
+
testInfo._addStep = (data: TestStepInternal) => {
|
|
26
|
+
|
|
27
|
+
data.location = this.locationOf(activity);
|
|
28
|
+
data.params = this.parametersOf(activity);
|
|
29
|
+
|
|
30
|
+
return originalAddStep.call(testInfo, data);
|
|
31
|
+
}
|
|
19
32
|
|
|
20
|
-
|
|
21
|
-
|
|
33
|
+
await this.test.step(
|
|
34
|
+
this.nameOf(activity),
|
|
35
|
+
() => super.perform(activity),
|
|
36
|
+
);
|
|
22
37
|
|
|
23
|
-
|
|
24
|
-
category: 'test.step',
|
|
25
|
-
title: this.nameOf(activity),
|
|
26
|
-
location: this.locationOf(activity),
|
|
27
|
-
params: this.parametersOf(activity),
|
|
28
|
-
}, async step_ => {
|
|
29
|
-
await super.perform(activity)
|
|
30
|
-
})
|
|
38
|
+
testInfo._addStep = originalAddStep;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
private parametersOf(activity: Activity): Record<string, any> {
|
|
@@ -50,6 +58,7 @@ export class PerformActivitiesAsPlaywrightSteps extends PerformActivities {
|
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
60
|
|
|
61
|
+
// Partial copy of https://github.com/microsoft/playwright/blob/b5e36583f67745fddf32145fa2355e5f122c2903/packages/playwright/src/worker/testInfo.ts#L32
|
|
53
62
|
interface TestStepInternal {
|
|
54
63
|
title: string;
|
|
55
64
|
category: string;
|