New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

allure-playwright

Package Overview
Dependencies
Maintainers
3
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

allure-playwright - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

dist/utils.d.ts

2

dist/index.d.ts
import { FullConfig } from "@playwright/test";
import { Reporter, Suite, TestCase, TestResult, TestStep } from "@playwright/test/reporter";
import { Category } from "allure-js-commons";
declare type AllureReporterOptions = {
export declare type AllureReporterOptions = {
detail?: boolean;

@@ -6,0 +6,0 @@ outputFolder?: string;

@@ -22,6 +22,7 @@ "use strict";

const internal_1 = require("allure-js-commons/internal");
const utils_1 = require("./utils");
class AllureReporter {
constructor(options = { suiteTitle: true, detail: true }) {
this.allureWriter = process_1.default.env.PW_ALLURE_POST_PROCESSOR_FOR_TEST
? new allure_js_commons_1.InMemoryAllureWriter()
? new allure_js_commons_1.MessageAllureWriter()
: undefined;

@@ -37,3 +38,2 @@ this.allureGroupCache = new Map();

onBegin(config, suite) {
var _a, _b;
this.config = config;

@@ -46,4 +46,2 @@ this.suite = suite;

});
this.allureRuntime.writeEnvironmentInfo(((_a = this.options) === null || _a === void 0 ? void 0 : _a.environmentInfo) || {});
this.allureRuntime.writeCategoriesDefinitions(((_b = this.options) === null || _b === void 0 ? void 0 : _b.categories) || []);
}

@@ -56,3 +54,6 @@ onTestBegin(test) {

allureTest.addLabel(allure_js_commons_1.LabelName.FRAMEWORK, "Playwright");
const titleMetadata = (0, utils_1.extractMetadataFromString)(test.title);
titleMetadata.labels.forEach((label) => allureTest.addLabel(label.name, label.value));
const [, projectSuiteTitle, fileSuiteTitle, ...suiteTitles] = suite.titlePath();
allureTest.addLabel("titlePath", suite.titlePath().join(" > "));
if (projectSuiteTitle) {

@@ -68,5 +69,8 @@ allureTest.addLabel(allure_js_commons_1.LabelName.PARENT_SUITE, projectSuiteTitle);

const project = suite.project();
if (project === null || project === void 0 ? void 0 : project.name) {
if (project.name) {
allureTest.addParameter("Project", project.name);
}
if (project.repeatEach > 1) {
allureTest.addParameter("Repetition", `${test.repeatEachIndex + 1}`);
}
const relativeFile = path_1.default

@@ -81,3 +85,2 @@ .relative(project === null || project === void 0 ? void 0 : project.testDir, test.location.file)

allureTest.testCaseId = (0, allure_js_commons_1.md5)(testCaseIdSource);
allureTest.historyId = (0, allure_js_commons_1.md5)(`${fullName}${project.name || ""}`);
this.allureTestCache.set(test, allureTest);

@@ -105,2 +108,5 @@ }

allureStep.status = step.error ? allure_js_commons_1.Status.FAILED : allure_js_commons_1.Status.PASSED;
if (step.error) {
allureStep.statusDetails = getStatusDetails(step.error);
}
}

@@ -120,12 +126,5 @@ async onTestEnd(test, result) {

allureTest.status = statusToAllureStats(result.status, test.expectedStatus);
if (result.error) {
const message = result.error.message && (0, allure_js_commons_1.stripAscii)(result.error.message);
let trace = result.error.stack && (0, allure_js_commons_1.stripAscii)(result.error.stack);
if (trace && message && trace.startsWith(`Error: ${message}`)) {
trace = trace.substr(message.length + "Error: ".length);
}
allureTest.statusDetails = {
message,
trace,
};
const error = result.error;
if (error) {
allureTest.statusDetails = getStatusDetails(error);
}

@@ -182,5 +181,2 @@ for (const attachment of result.attachments) {

}
if (attachment.name === "diff" || attachment.name.endsWith("-diff.png")) {
allureTest.addLabel("testType", "screenshotDiff");
}
}

@@ -193,2 +189,3 @@ if (result.stdout.length > 0) {

}
allureTest.calculateHistoryId();
allureTest.endTest();

@@ -224,2 +221,3 @@ }

onEnd() {
var _a, _b, _c;
this.addSkippedResults();

@@ -229,13 +227,8 @@ for (const group of this.allureGroupCache.values()) {

}
if (process_1.default.env.PW_ALLURE_POST_PROCESSOR_FOR_TEST) {
try {
const writer = this.allureWriter;
void writer;
const postProcess = eval(process_1.default.env.PW_ALLURE_POST_PROCESSOR_FOR_TEST);
console.log(JSON.stringify(postProcess(this.allureWriter)));
}
catch (e) {
console.log(JSON.stringify({ error: e.stack || String(e) }));
}
if (this.options.environmentInfo) {
(_a = this.allureRuntime) === null || _a === void 0 ? void 0 : _a.writeEnvironmentInfo((_b = this.options) === null || _b === void 0 ? void 0 : _b.environmentInfo);
}
if (this.options.categories) {
(_c = this.allureRuntime) === null || _c === void 0 ? void 0 : _c.writeCategoriesDefinitions(this.options.categories);
}
}

@@ -292,3 +285,14 @@ getAllureRuntime() {

};
const getStatusDetails = (error) => {
const message = error.message && (0, allure_js_commons_1.stripAscii)(error.message);
let trace = error.stack && (0, allure_js_commons_1.stripAscii)(error.stack);
if (trace && message && trace.startsWith(`Error: ${message}`)) {
trace = trace.substr(message.length + "Error: ".length);
}
return {
message,
trace,
};
};
__exportStar(require("./helpers"), exports);
//# sourceMappingURL=index.js.map
{
"name": "allure-playwright",
"version": "2.2.1",
"version": "2.3.0",
"description": "Allure Playwright integration",

@@ -27,2 +27,3 @@ "license": "Apache-2.0",

"allure-report": "allure serve ./out/allure-results",
"pretest": "run compile",
"test": "playwright test -c test",

@@ -34,2 +35,3 @@ "lint": "eslint ./src --ext .ts",

"@playwright/test": "^1.30.0",
"properties": "^1.2.1",
"rimraf": "^3.0.2",

@@ -39,3 +41,3 @@ "typescript": "^4.4.2"

"dependencies": {
"allure-js-commons": "2.2.1"
"allure-js-commons": "2.3.0"
},

@@ -42,0 +44,0 @@ "files": [

@@ -340,1 +340,14 @@ # allure-playwright

![screendiff-preview](./docs/screendiff.jpg)
### Passing metadata from test title
You also can pass allure metadata from test title.
This is useful when you need to set allureId for the tests with failing before hooks. Just add `@allure.id={idValue}` for the allureId or `@allure.label.{labelName}={labelValue}` for other types of labels.
```ts
import { test, expect } from "@playwright/test";
test("test with allureId @allure.id=256", async ({}) => {});
test("tst with severity @allure.label.severity=critical", async ({}) => {});
test("test with epic @allure.label.epic=login", async ({}) => {});
test("test with strangeLabel @allure.label.strangeLabel=strangeValue", async ({}) => {});
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc