@serenity-js/playwright-test 3.0.0-rc.38 → 3.0.0-rc.40
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 +32 -0
- package/lib/api/PlaywrightTestConfig.d.ts +41 -0
- package/lib/api/PlaywrightTestConfig.d.ts.map +1 -0
- package/lib/{PlaywrightTestConfig.js → api/PlaywrightTestConfig.js} +0 -0
- package/lib/api/PlaywrightTestConfig.js.map +1 -0
- package/lib/api/SerenityFixtures.d.ts +128 -0
- package/lib/api/SerenityFixtures.d.ts.map +1 -0
- package/lib/api/SerenityFixtures.js +3 -0
- package/lib/api/SerenityFixtures.js.map +1 -0
- package/lib/api/SerenityOptions.d.ts +256 -0
- package/lib/api/SerenityOptions.d.ts.map +1 -0
- package/lib/api/SerenityOptions.js +3 -0
- package/lib/api/SerenityOptions.js.map +1 -0
- package/lib/api/SerenityTestType.d.ts +5 -0
- package/lib/api/SerenityTestType.d.ts.map +1 -0
- package/lib/api/SerenityTestType.js +4 -0
- package/lib/api/SerenityTestType.js.map +1 -0
- package/lib/api/index.d.ts +6 -0
- package/lib/api/index.d.ts.map +1 -0
- package/lib/api/index.js +22 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/test-api.d.ts +115 -0
- package/lib/api/test-api.d.ts.map +1 -0
- package/lib/{api.js → api/test-api.js} +43 -16
- package/lib/api/test-api.js.map +1 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/reporter/PlaywrightStepReporter.d.ts +3 -0
- package/lib/reporter/PlaywrightStepReporter.d.ts.map +1 -1
- package/lib/reporter/PlaywrightStepReporter.js +55 -12
- package/lib/reporter/PlaywrightStepReporter.js.map +1 -1
- package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts +20 -7
- package/lib/reporter/SerenityReporterForPlaywrightTest.d.ts.map +1 -1
- package/lib/reporter/SerenityReporterForPlaywrightTest.js +4 -8
- package/lib/reporter/SerenityReporterForPlaywrightTest.js.map +1 -1
- package/package.json +6 -5
- package/src/api/PlaywrightTestConfig.ts +42 -0
- package/src/api/SerenityFixtures.ts +130 -0
- package/src/api/SerenityOptions.ts +261 -0
- package/src/api/SerenityTestType.ts +12 -0
- package/src/api/index.ts +5 -0
- package/src/{api.ts → api/test-api.ts} +63 -128
- package/src/index.ts +1 -2
- package/src/reporter/PlaywrightStepReporter.ts +90 -18
- package/src/reporter/SerenityReporterForPlaywrightTest.ts +21 -8
- package/lib/PlaywrightTestConfig.d.ts +0 -8
- package/lib/PlaywrightTestConfig.d.ts.map +0 -1
- package/lib/PlaywrightTestConfig.js.map +0 -1
- package/lib/api.d.ts +0 -213
- package/lib/api.d.ts.map +0 -1
- package/lib/api.js.map +0 -1
- package/src/PlaywrightTestConfig.ts +0 -6
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { TestError, TestInfo } from '@playwright/test';
|
|
2
2
|
import { Stage, StageCrewMember } from '@serenity-js/core';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
ActivityFinished,
|
|
5
|
+
ActivityRelatedArtifactGenerated,
|
|
6
|
+
AsyncOperationAborted,
|
|
7
|
+
AsyncOperationAttempted,
|
|
8
|
+
AsyncOperationCompleted,
|
|
9
|
+
AsyncOperationFailed,
|
|
10
|
+
DomainEvent,
|
|
11
|
+
InteractionStarts,
|
|
12
|
+
SceneTagged,
|
|
13
|
+
TaskStarts,
|
|
14
|
+
} from '@serenity-js/core/lib/events';
|
|
15
|
+
import { FileSystemLocation, Path } from '@serenity-js/core/lib/io';
|
|
16
|
+
import { ActivityDetails, BrowserTag, CorrelationId, Description, Name, Photo, PlatformTag, ProblemIndication } from '@serenity-js/core/lib/model';
|
|
17
|
+
import { Photographer } from '@serenity-js/web';
|
|
18
|
+
import { match } from 'tiny-types';
|
|
19
|
+
|
|
20
|
+
const genericPathToPhotographer = Path.from(require.resolve('@serenity-js/web'))
|
|
5
21
|
|
|
6
22
|
// https://github.com/microsoft/playwright/blob/04f77f231981780704a3a5e2cea93e3c420809a0/packages/playwright-test/types/testReporter.d.ts#L524
|
|
7
23
|
interface Location {
|
|
@@ -51,24 +67,80 @@ export class PlaywrightStepReporter implements StageCrewMember {
|
|
|
51
67
|
|
|
52
68
|
notifyOf(event: DomainEvent): void {
|
|
53
69
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
match<DomainEvent, void>(event)
|
|
71
|
+
.when(TaskStarts, (e: TaskStarts) => {
|
|
72
|
+
this.steps.set(e.activityId.value, this.createStep(e.details, 'task'))
|
|
73
|
+
})
|
|
74
|
+
.when(InteractionStarts, (e: InteractionStarts) => {
|
|
75
|
+
this.steps.set(e.activityId.value, this.createStep(e.details, 'interaction'));
|
|
76
|
+
})
|
|
77
|
+
.when(AsyncOperationAttempted, (e: AsyncOperationAttempted) => {
|
|
78
|
+
if (this.isAPhotoAttempt(e)) {
|
|
79
|
+
this.steps.set(e.correlationId.value, this.createStep(new ActivityDetails(
|
|
80
|
+
new Name(`${ Photographer.name }: ${ e.description.value }`),
|
|
81
|
+
new FileSystemLocation(genericPathToPhotographer)
|
|
82
|
+
), 'crew'));
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
.when(ActivityFinished, (e: ActivityFinished) => {
|
|
86
|
+
const error = e.outcome instanceof ProblemIndication
|
|
87
|
+
? e.outcome.error
|
|
88
|
+
: undefined;
|
|
89
|
+
|
|
90
|
+
this.steps.get(e.activityId.value).complete({ error });
|
|
91
|
+
})
|
|
92
|
+
.when(ActivityRelatedArtifactGenerated, (e: ActivityRelatedArtifactGenerated) => {
|
|
93
|
+
if (e.artifact instanceof Photo) {
|
|
94
|
+
this.attachPhotoFrom(e);
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
.when(SceneTagged, (e: SceneTagged) => {
|
|
98
|
+
// don't include platform and browser tags as Playwright already includes them
|
|
99
|
+
if (! (e.tag instanceof PlatformTag || e.tag instanceof BrowserTag)) {
|
|
100
|
+
this.testInfo.annotations.push({ type: e.tag.type, description: e.tag.name });
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
.else(e => {
|
|
104
|
+
if (this.indicatesCompletionOfAnAsyncOperation(e) && this.steps.has(e.correlationId.value)) {
|
|
105
|
+
const error = event instanceof AsyncOperationFailed
|
|
106
|
+
? event.error
|
|
107
|
+
: undefined;
|
|
108
|
+
|
|
109
|
+
this.steps.get(e.correlationId.value).complete({ error })
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private isAPhotoAttempt(event: AsyncOperationAttempted): event is AsyncOperationAttempted {
|
|
115
|
+
return event.name.value.startsWith(Photographer.name);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private indicatesCompletionOfAnAsyncOperation(event: DomainEvent): event is AsyncOperationCompleted | AsyncOperationAborted | AsyncOperationFailed {
|
|
119
|
+
return event instanceof AsyncOperationCompleted
|
|
120
|
+
|| event instanceof AsyncOperationAborted
|
|
121
|
+
|| event instanceof AsyncOperationFailed
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private attachPhotoFrom(event: ActivityRelatedArtifactGenerated) {
|
|
125
|
+
const id = CorrelationId.create();
|
|
126
|
+
|
|
127
|
+
this.stage.announce(new AsyncOperationAttempted(
|
|
128
|
+
new Name(this.constructor.name),
|
|
129
|
+
new Description(`Attaching screenshot of '${ event.name.value }'...`),
|
|
130
|
+
id,
|
|
131
|
+
this.stage.currentTime(),
|
|
132
|
+
));
|
|
133
|
+
|
|
134
|
+
this.testInfo.attach(event.name.value, { body: Buffer.from(event.artifact.base64EncodedValue, 'base64'), contentType: 'image/png' })
|
|
135
|
+
.then(() => {
|
|
136
|
+
this.stage.announce(new AsyncOperationCompleted(
|
|
137
|
+
id,
|
|
138
|
+
this.stage.currentTime()
|
|
139
|
+
));
|
|
140
|
+
});
|
|
69
141
|
}
|
|
70
142
|
|
|
71
|
-
private createStep(activityDetails: ActivityDetails, type: 'task' | 'interaction'): TestStepInternal {
|
|
143
|
+
private createStep(activityDetails: ActivityDetails, type: 'task' | 'interaction' | 'crew'): TestStepInternal {
|
|
72
144
|
// https://github.com/microsoft/playwright/blob/04f77f231981780704a3a5e2cea93e3c420809a0/packages/playwright-test/src/expect.ts#L200-L206
|
|
73
145
|
return (this.testInfo as any)._addStep({
|
|
74
146
|
location: activityDetails.location
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FullConfig, TestError } from '@playwright/test';
|
|
2
2
|
import type { Reporter, Suite, TestCase, TestResult } from '@playwright/test/reporter';
|
|
3
|
-
import { LogicError, Serenity, serenity as reporterSerenityInstance, StageCrewMember, StageCrewMemberBuilder, Timestamp } from '@serenity-js/core';
|
|
3
|
+
import { ClassDescription, LogicError, Serenity, serenity as reporterSerenityInstance, StageCrewMember, StageCrewMemberBuilder, Timestamp } from '@serenity-js/core';
|
|
4
4
|
import { OutputStream } from '@serenity-js/core/lib/adapter';
|
|
5
5
|
import * as events from '@serenity-js/core/lib/events';
|
|
6
6
|
import {
|
|
@@ -34,25 +34,39 @@ import {
|
|
|
34
34
|
|
|
35
35
|
import { SERENITY_JS_DOMAIN_EVENTS_ATTACHMENT_CONTENT_TYPE } from './PlaywrightAttachments';
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Configuration object accepted by `@serenity-js/playwright-test` reporter.
|
|
39
|
+
*
|
|
40
|
+
* See {@apilink SerenityOptions} for usage examples.
|
|
41
|
+
*/
|
|
42
|
+
export interface SerenityReporterForPlaywrightTestConfig {
|
|
43
|
+
|
|
39
44
|
/**
|
|
40
45
|
* A list of {@apilink StageCrewMemberBuilder|StageCrewMemberBuilders} or {@apilink StageCrewMember|StageCrewMembers}
|
|
41
|
-
* to be notified of {@apilink DomainEvent|DomainEvents} that occur during the scenario execution.
|
|
46
|
+
* to be instantiated in Playwright Test reporter process and notified of {@apilink DomainEvent|DomainEvents} that occur during the scenario execution.
|
|
47
|
+
* Note that the `crew` can also be configured using {@apilink ClassDescription|ClassDescriptions}.
|
|
48
|
+
*
|
|
49
|
+
* #### Learn more
|
|
50
|
+
* - {@apilink SerenityOptions}
|
|
51
|
+
* - {@apilink SerenityConfig.crew}
|
|
42
52
|
*/
|
|
43
|
-
crew?: Array<StageCrewMember | StageCrewMemberBuilder>;
|
|
53
|
+
crew?: Array<StageCrewMember | StageCrewMemberBuilder | ClassDescription>;
|
|
44
54
|
|
|
45
55
|
/**
|
|
46
56
|
* An output stream to be injected into {@apilink StageCrewMemberBuilder|StageCrewMemberBuilders}
|
|
47
57
|
*
|
|
48
58
|
* Defaults to [`process.stdout`](https://nodejs.org/api/process.html#process_process_stdout).
|
|
59
|
+
*
|
|
60
|
+
* #### Learn more
|
|
61
|
+
* - {@apilink SerenityConfig.outputStream}
|
|
49
62
|
*/
|
|
50
63
|
outputStream?: OutputStream;
|
|
51
64
|
}
|
|
52
65
|
|
|
53
66
|
/**
|
|
54
|
-
*
|
|
55
|
-
* {@apilink DomainEvent|domain events}
|
|
67
|
+
* Serenity/JS reporter that receives notifications from Playwright Test and emits them as
|
|
68
|
+
* Serenity/JS {@apilink DomainEvent|domain events} which can be used by
|
|
69
|
+
* Serenity/JS {@apilink StageCrewMember|stage crew members}.
|
|
56
70
|
*/
|
|
57
71
|
export class SerenityReporterForPlaywrightTest implements Reporter {
|
|
58
72
|
|
|
@@ -60,7 +74,6 @@ export class SerenityReporterForPlaywrightTest implements Reporter {
|
|
|
60
74
|
private sceneIds: Map<string, CorrelationId> = new Map();
|
|
61
75
|
|
|
62
76
|
/**
|
|
63
|
-
*
|
|
64
77
|
* @param config
|
|
65
78
|
* @param serenity
|
|
66
79
|
* Instance of {@apilink Serenity}, specific to the Node process running this Serenity reporter.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { PlaywrightTestConfig as BasePlaywrightTestConfig } from '@playwright/test';
|
|
2
|
-
import { ClassDescription } from '@serenity-js/core';
|
|
3
|
-
export type PlaywrightTestConfig<BaseConfig extends BasePlaywrightTestConfig = BasePlaywrightTestConfig> = Omit<BaseConfig, 'use' | 'reporter'> & {
|
|
4
|
-
use?: BaseConfig['use'] & {
|
|
5
|
-
crew: Array<ClassDescription>;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=PlaywrightTestConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightTestConfig.d.ts","sourceRoot":"","sources":["../src/PlaywrightTestConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,oBAAoB,CAAC,UAAU,SAAS,wBAAwB,GAAG,wBAAwB,IAAI,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,UAAU,CAAC,GAAG;IAC9I,GAAG,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG;QAAE,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAA;KAAE,CAAA;CAC9D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightTestConfig.js","sourceRoot":"","sources":["../src/PlaywrightTestConfig.ts"],"names":[],"mappings":""}
|
package/lib/api.d.ts
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestType } from '@playwright/test';
|
|
2
|
-
import { Actor, Cast, Duration, Serenity, StageCrewMember } from '@serenity-js/core';
|
|
3
|
-
/**
|
|
4
|
-
* Serenity/JS-specific [Playwright Test fixtures](https://playwright.dev/docs/test-fixtures).
|
|
5
|
-
*
|
|
6
|
-
* ## Example test scenario
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
10
|
-
* import { describe, it, test } from '@serenity-js/playwright-test'
|
|
11
|
-
* import { Photographer, TakePhotosOfFailures } from '@serenity-js/web'
|
|
12
|
-
*
|
|
13
|
-
* describe(`Recording items`, () => {
|
|
14
|
-
*
|
|
15
|
-
* test.use({
|
|
16
|
-
* defaultActorName: 'Serena',
|
|
17
|
-
* crew: [
|
|
18
|
-
* Photographer.whoWill(TakePhotosOfFailures),
|
|
19
|
-
* ],
|
|
20
|
-
* })
|
|
21
|
-
*
|
|
22
|
-
* describe(`Todo List App`, () => {
|
|
23
|
-
*
|
|
24
|
-
* it(`should allow me to add a todo item`, async ({ actor }) => {
|
|
25
|
-
* await actor.attemptsTo(
|
|
26
|
-
* startWithAnEmptyList(),
|
|
27
|
-
*
|
|
28
|
-
* recordItem('Buy some milk'),
|
|
29
|
-
*
|
|
30
|
-
* Ensure.that(itemNames(), equals([
|
|
31
|
-
* 'Buy some milk',
|
|
32
|
-
* ])),
|
|
33
|
-
* )
|
|
34
|
-
* })
|
|
35
|
-
* })
|
|
36
|
-
* })
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* ## Learn more
|
|
40
|
-
* - Declaring a test scenario using {@apilink it}
|
|
41
|
-
* - Grouping test scenarios using {@apilink describe}
|
|
42
|
-
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
43
|
-
*/
|
|
44
|
-
export interface SerenityFixtures {
|
|
45
|
-
/**
|
|
46
|
-
* Configures the {@apilink Cast} of {@apilink SerenityConfig.actors|actors} to be used when injecting an {@apilink SerenityFixtures.actor|actor}
|
|
47
|
-
* or invoking {@apilink SerenityFixtures.actorCalled|actorCalled} in a {@apilink it|test scenario}.
|
|
48
|
-
*
|
|
49
|
-
* #### Learn more
|
|
50
|
-
* - Declaring a test scenario using {@apilink it}
|
|
51
|
-
*/
|
|
52
|
-
actors: Cast;
|
|
53
|
-
/**
|
|
54
|
-
* Configures the {@apilink SerenityConfig.crew|stage crew}
|
|
55
|
-
*/
|
|
56
|
-
crew: StageCrewMember[];
|
|
57
|
-
/**
|
|
58
|
-
* Configures the {@apilink SerenityConfig.cueTimeout|cueTimeout}
|
|
59
|
-
*/
|
|
60
|
-
cueTimeout: Duration;
|
|
61
|
-
/**
|
|
62
|
-
* Retrieves the root object of the Serenity/JS framework.
|
|
63
|
-
*/
|
|
64
|
-
serenity: Serenity;
|
|
65
|
-
/**
|
|
66
|
-
* Name and version of the operating system the Playwright Test runs on.
|
|
67
|
-
*/
|
|
68
|
-
platform: {
|
|
69
|
-
name: string;
|
|
70
|
-
version: string;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Uses the provided {@apilink Cast} of {@apilink SerenityFixtures.actors|actors} to instantiate an {@apilink Actor} called `name`
|
|
74
|
-
* and inject it into a {@apilink it|test scenario}.
|
|
75
|
-
* Retrieves an existing actor if one has already been instantiated.
|
|
76
|
-
*
|
|
77
|
-
* #### Learn more
|
|
78
|
-
* - Declaring a test scenario using {@apilink it}
|
|
79
|
-
*
|
|
80
|
-
* @param name
|
|
81
|
-
*/
|
|
82
|
-
actorCalled: (name: string) => Actor;
|
|
83
|
-
/**
|
|
84
|
-
* Configures the name given to the default {@apilink SerenityFixtures.actor|actor} injected into the {@apilink it|test scenario}.
|
|
85
|
-
*
|
|
86
|
-
* #### Learn more
|
|
87
|
-
* - Declaring a test scenario using {@apilink it}
|
|
88
|
-
*/
|
|
89
|
-
defaultActorName: string;
|
|
90
|
-
/**
|
|
91
|
-
* Default {@apilink SerenityFixtures.actor|actor} injected into a {@apilink it|test scenario}.
|
|
92
|
-
*
|
|
93
|
-
* #### Learn more
|
|
94
|
-
* - {@apilink SerenityFixtures.actorCalled|actorCalled}
|
|
95
|
-
* - Declaring a test scenario using {@apilink it}
|
|
96
|
-
*/
|
|
97
|
-
actor: Actor;
|
|
98
|
-
}
|
|
99
|
-
export type SerenityTestType = TestType<PlaywrightTestArgs & PlaywrightTestOptions & SerenityFixtures, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
100
|
-
/**
|
|
101
|
-
* Declares a single test scenario.
|
|
102
|
-
*
|
|
103
|
-
* ## Example
|
|
104
|
-
*
|
|
105
|
-
* ```typescript
|
|
106
|
-
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
107
|
-
* import { describe, it } from '@serenity-js/playwright-test'
|
|
108
|
-
*
|
|
109
|
-
* describe(`Todo List App`, () => {
|
|
110
|
-
*
|
|
111
|
-
* it(`should allow me to add a todo item`, async ({ actor }) => {
|
|
112
|
-
* await actor.attemptsTo(
|
|
113
|
-
* startWithAnEmptyList(),
|
|
114
|
-
*
|
|
115
|
-
* recordItem('Buy some milk'),
|
|
116
|
-
*
|
|
117
|
-
* Ensure.that(itemNames(), equals([
|
|
118
|
-
* 'Buy some milk',
|
|
119
|
-
* ])),
|
|
120
|
-
* )
|
|
121
|
-
* })
|
|
122
|
-
*
|
|
123
|
-
* it('supports multiple actors using separate browsers', async ({ actorCalled }) => {
|
|
124
|
-
* await actorCalled('Alice').attemptsTo(
|
|
125
|
-
* startWithAListContaining(
|
|
126
|
-
* 'Feed the cat'
|
|
127
|
-
* ),
|
|
128
|
-
* )
|
|
129
|
-
*
|
|
130
|
-
* await actorCalled('Bob').attemptsTo(
|
|
131
|
-
* startWithAListContaining(
|
|
132
|
-
* 'Walk the dog'
|
|
133
|
-
* ),
|
|
134
|
-
* )
|
|
135
|
-
*
|
|
136
|
-
* await actorCalled('Alice').attemptsTo(
|
|
137
|
-
* Ensure.that(itemNames(), equals([
|
|
138
|
-
* 'Feed the cat'
|
|
139
|
-
* ])),
|
|
140
|
-
* )
|
|
141
|
-
*
|
|
142
|
-
* await actorCalled('Bob').attemptsTo(
|
|
143
|
-
* Ensure.that(itemNames(), equals([
|
|
144
|
-
* 'Walk the dog'
|
|
145
|
-
* ])),
|
|
146
|
-
* )
|
|
147
|
-
* })
|
|
148
|
-
* })
|
|
149
|
-
* ```
|
|
150
|
-
*
|
|
151
|
-
* ## Learn more
|
|
152
|
-
* - Grouping test scenarios using {@apilink describe}
|
|
153
|
-
* - {@apilink SerenityFixtures}
|
|
154
|
-
* - [Playwright Test `test` function](https://playwright.dev/docs/api/class-test#test-call)
|
|
155
|
-
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
156
|
-
*/
|
|
157
|
-
export declare const it: SerenityTestType;
|
|
158
|
-
export declare const test: SerenityTestType;
|
|
159
|
-
/**
|
|
160
|
-
* Declares a group of test scenarios.
|
|
161
|
-
*
|
|
162
|
-
* ## Example
|
|
163
|
-
*
|
|
164
|
-
* ```typescript
|
|
165
|
-
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
166
|
-
* import { describe, it, test } from '@serenity-js/playwright-test'
|
|
167
|
-
* import { Photographer, TakePhotosOfFailures, Value } from '@serenity-js/web'
|
|
168
|
-
*
|
|
169
|
-
* describe(`Todo List App`, () => {
|
|
170
|
-
*
|
|
171
|
-
* test.use({
|
|
172
|
-
* defaultActorName: 'Serena',
|
|
173
|
-
* crew: [
|
|
174
|
-
* Photographer.whoWill(TakePhotosOfFailures),
|
|
175
|
-
* ],
|
|
176
|
-
* })
|
|
177
|
-
*
|
|
178
|
-
* it(`should allow me to add a todo item`, async ({ actor }) => {
|
|
179
|
-
* await actor.attemptsTo(
|
|
180
|
-
* startWithAnEmptyList(),
|
|
181
|
-
*
|
|
182
|
-
* recordItem('Buy some milk'),
|
|
183
|
-
*
|
|
184
|
-
* Ensure.that(itemNames(), equals([
|
|
185
|
-
* 'Buy some milk',
|
|
186
|
-
* ])),
|
|
187
|
-
* )
|
|
188
|
-
* })
|
|
189
|
-
*
|
|
190
|
-
* it('should clear text input field when an item is added', async ({ actor }) => {
|
|
191
|
-
* await actor.attemptsTo(
|
|
192
|
-
* startWithAnEmptyList(),
|
|
193
|
-
*
|
|
194
|
-
* recordItem('Buy some milk'),
|
|
195
|
-
*
|
|
196
|
-
* Ensure.that(Value.of(newTodoInput()), equals('')),
|
|
197
|
-
* )
|
|
198
|
-
* })
|
|
199
|
-
* })
|
|
200
|
-
* ```
|
|
201
|
-
*
|
|
202
|
-
* ## Learn more
|
|
203
|
-
* - Declaring a test scenario using {@apilink it}
|
|
204
|
-
* - [Playwright Test `describe` function](https://playwright.dev/docs/api/class-test#test-describe-1)
|
|
205
|
-
* - [Serenity/JS + Playwright Test project template](https://github.com/serenity-js/serenity-js-playwright-test-template/)
|
|
206
|
-
*/
|
|
207
|
-
export declare const describe: SerenityTestType['describe'];
|
|
208
|
-
export declare const beforeAll: SerenityTestType['beforeAll'];
|
|
209
|
-
export declare const beforeEach: SerenityTestType['beforeEach'];
|
|
210
|
-
export declare const afterEach: SerenityTestType['afterEach'];
|
|
211
|
-
export declare const afterAll: SerenityTestType['afterAll'];
|
|
212
|
-
export declare const expect: SerenityTestType['expect'];
|
|
213
|
-
//# sourceMappingURL=api.d.ts.map
|
package/lib/api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAA0B,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9J,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAgC,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASnH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,WAAW,gBAAgB;IAE7B;;;;;;OAMG;IACH,MAAM,EAAE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} from '@serenity-js/core';
|
|
3
|
-
|
|
4
|
-
export type PlaywrightTestConfig<BaseConfig extends BasePlaywrightTestConfig = BasePlaywrightTestConfig> = Omit<BaseConfig, 'use' | 'reporter'> & {
|
|
5
|
-
use?: BaseConfig['use'] & { crew: Array<ClassDescription> }
|
|
6
|
-
};
|