@serenity-js/playwright-test
Advanced tools
Comparing version 3.20.0 to 3.21.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.21.0](https://github.com/serenity-js/serenity-js/compare/v3.20.0...v3.21.0) (2024-03-04) | ||
### Bug Fixes | ||
* **playwright-test:** support for reporting tags registered using the new Playwright 1.42 tags API ([9d57157](https://github.com/serenity-js/serenity-js/commit/9d571573cd9d8b52ddcb286f1160c7011dea7590)) | ||
# [3.20.0](https://github.com/serenity-js/serenity-js/compare/v3.19.0...v3.20.0) (2024-03-02) | ||
@@ -8,0 +19,0 @@ |
@@ -0,1 +1,2 @@ | ||
import type { TestDetails } from '@playwright/test'; | ||
export interface SuiteFunction { | ||
@@ -50,3 +51,13 @@ /** | ||
(callback: () => void): void; | ||
/** | ||
* Declares a group of tests. | ||
* | ||
* @param title Group title. | ||
* @param details Additional details for all tests in the group. | ||
* @param callback A callback that is run immediately when calling | ||
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Any tests added in | ||
* this callback will belong to the group. | ||
*/ | ||
(title: string, details: TestDetails, callback: () => void): void; | ||
} | ||
//# sourceMappingURL=SuiteFunction.d.ts.map |
@@ -64,6 +64,9 @@ "use strict"; | ||
this.sceneIds.set(test.id, currentSceneId); | ||
const scenario = this.scenarioDetailsFrom(test); | ||
const tags = model_1.Tags.from(`${scenario.category.toString()} ${scenario.name.toString().replace(')', '')}`); | ||
this.emit(new events_1.SceneStarts(currentSceneId, scenario, this.serenity.currentTime()), ...this.requirementsHierarchy | ||
.requirementTagsFor(scenario.location.path, scenario.category.value) | ||
const { scenarioDetails, scenarioTags } = this.scenarioDetailsFrom(test); | ||
const tags = [ | ||
...scenarioTags, | ||
...test.tags.flatMap(tag => model_1.Tags.from(tag)), | ||
]; | ||
this.emit(new events_1.SceneStarts(currentSceneId, scenarioDetails, this.serenity.currentTime()), ...this.requirementsHierarchy | ||
.requirementTagsFor(scenarioDetails.location.path, scenarioDetails.category.value) | ||
.map(tag => new events_1.SceneTagged(currentSceneId, tag, this.serenity.currentTime())), new events_1.TestRunnerDetected(currentSceneId, new model_1.Name('Playwright'), this.serenity.currentTime()), ...tags.map(tag => new events_1.SceneTagged(currentSceneId, tag, this.serenity.currentTime()))); | ||
@@ -99,3 +102,3 @@ } | ||
const scenarioOutcome = this.outcomeFrom(test, result); | ||
this.serenity.announce(new events_1.SceneFinished(currentSceneId, this.scenarioDetailsFrom(test), this.determineScenarioOutcome(worstInteractionOutcome, scenarioOutcome), this.now())); | ||
this.serenity.announce(new events_1.SceneFinished(currentSceneId, this.scenarioDetailsFrom(test).scenarioDetails, this.determineScenarioOutcome(worstInteractionOutcome, scenarioOutcome), this.now())); | ||
} | ||
@@ -135,4 +138,8 @@ onError(error) { | ||
const scenarioName = nestedTitles.join(' ').trim(); | ||
const name = scenarioName || describeOrItBlockTitle; | ||
const featureName = scenarioName ? describeOrItBlockTitle : fileName; | ||
return new model_1.ScenarioDetails(new model_1.Name(scenarioName || describeOrItBlockTitle), new model_1.Category(featureName), new io_1.FileSystemLocation(path, test.location.line, test.location.column)); | ||
return { | ||
scenarioDetails: new model_1.ScenarioDetails(new model_1.Name(model_1.Tags.stripFrom(name)), new model_1.Category(model_1.Tags.stripFrom(featureName)), new io_1.FileSystemLocation(path, test.location.line, test.location.column)), | ||
scenarioTags: model_1.Tags.from(`${featureName} ${name}`), | ||
}; | ||
} | ||
@@ -139,0 +146,0 @@ async onEnd() { |
{ | ||
"name": "@serenity-js/playwright-test", | ||
"version": "3.20.0", | ||
"version": "3.21.0", | ||
"description": "Serenity/JS reporter and test APIs for Playwright Test", | ||
@@ -49,6 +49,6 @@ "author": { | ||
"@playwright/test": "1.42.1", | ||
"@serenity-js/core": "3.20.0", | ||
"@serenity-js/playwright": "3.20.0", | ||
"@serenity-js/rest": "3.20.0", | ||
"@serenity-js/web": "3.20.0", | ||
"@serenity-js/core": "3.21.0", | ||
"@serenity-js/playwright": "3.21.0", | ||
"@serenity-js/rest": "3.21.0", | ||
"@serenity-js/web": "3.21.0", | ||
"deepmerge": "4.3.1", | ||
@@ -67,3 +67,3 @@ "tiny-types": "1.21.0" | ||
}, | ||
"gitHead": "2089afc60adb2751416fa6d800d4e7af95a99f25" | ||
"gitHead": "98621d99c073223dc40cc3dc836c4e2ee676aa9c" | ||
} |
@@ -0,2 +1,5 @@ | ||
import type { TestDetails } from '@playwright/test'; | ||
// Playwright Test doesn't export all its public APIs, hence the need for this workaround | ||
// See https://github.com/microsoft/playwright/pull/24146 | ||
@@ -52,2 +55,13 @@ export interface SuiteFunction { | ||
(callback: () => void): void; | ||
/** | ||
* Declares a group of tests. | ||
* | ||
* @param title Group title. | ||
* @param details Additional details for all tests in the group. | ||
* @param callback A callback that is run immediately when calling | ||
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Any tests added in | ||
* this callback will belong to the group. | ||
*/ | ||
(title: string, details: TestDetails, callback: () => void): void; | ||
} |
@@ -112,13 +112,14 @@ import type { FullConfig } from '@playwright/test'; | ||
const scenario = this.scenarioDetailsFrom(test); | ||
const { scenarioDetails, scenarioTags } = this.scenarioDetailsFrom(test); | ||
const tags: Tag[] = Tags.from( | ||
`${ scenario.category.toString() } ${ scenario.name.toString().replace(')', '') }`, | ||
); | ||
const tags: Tag[] = [ | ||
... scenarioTags, | ||
... test.tags.flatMap(tag => Tags.from(tag)), | ||
]; | ||
this.emit( | ||
new SceneStarts(currentSceneId, scenario, this.serenity.currentTime()), | ||
new SceneStarts(currentSceneId, scenarioDetails, this.serenity.currentTime()), | ||
...this.requirementsHierarchy | ||
.requirementTagsFor(scenario.location.path, scenario.category.value) | ||
.requirementTagsFor(scenarioDetails.location.path, scenarioDetails.category.value) | ||
.map(tag => new SceneTagged(currentSceneId, tag, this.serenity.currentTime())), | ||
@@ -179,3 +180,3 @@ | ||
currentSceneId, | ||
this.scenarioDetailsFrom(test), | ||
this.scenarioDetailsFrom(test).scenarioDetails, | ||
this.determineScenarioOutcome(worstInteractionOutcome, scenarioOutcome), | ||
@@ -232,3 +233,3 @@ this.now(), | ||
private scenarioDetailsFrom(test: TestCase) { | ||
private scenarioDetailsFrom(test: TestCase): { scenarioDetails: ScenarioDetails, scenarioTags: Tag[] } { | ||
const [ | ||
@@ -245,9 +246,13 @@ root_, | ||
const name = scenarioName || describeOrItBlockTitle; | ||
const featureName = scenarioName ? describeOrItBlockTitle : fileName; | ||
return new ScenarioDetails( | ||
new Name(scenarioName || describeOrItBlockTitle), | ||
new Category(featureName), | ||
new FileSystemLocation(path, test.location.line, test.location.column), | ||
); | ||
return { | ||
scenarioDetails: new ScenarioDetails( | ||
new Name(Tags.stripFrom(name)), | ||
new Category(Tags.stripFrom(featureName)), | ||
new FileSystemLocation(path, test.location.line, test.location.column), | ||
), | ||
scenarioTags: Tags.from(`${ featureName } ${ name }`), | ||
}; | ||
} | ||
@@ -254,0 +259,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
230302
3652
+ Added@serenity-js/assertions@3.21.0(transitive)
+ Added@serenity-js/core@3.21.0(transitive)
+ Added@serenity-js/playwright@3.21.0(transitive)
+ Added@serenity-js/rest@3.21.0(transitive)
+ Added@serenity-js/web@3.21.0(transitive)
- Removed@serenity-js/assertions@3.20.0(transitive)
- Removed@serenity-js/core@3.20.0(transitive)
- Removed@serenity-js/playwright@3.20.0(transitive)
- Removed@serenity-js/rest@3.20.0(transitive)
- Removed@serenity-js/web@3.20.0(transitive)
Updated@serenity-js/core@3.21.0
Updated@serenity-js/rest@3.21.0
Updated@serenity-js/web@3.21.0