From f011d5cfa8df9720c3e0a54704d7110224eb6586 Mon Sep 17 00:00:00 2001 From: Dmitry Baev Date: Fri, 2 Aug 2024 17:46:20 +0100 Subject: [PATCH] fix(playwright): remove step title length (fixes #1087, via #1088) --- packages/allure-playwright/src/index.ts | 4 +- .../allure-playwright/test/spec/steps.spec.ts | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/packages/allure-playwright/src/index.ts b/packages/allure-playwright/src/index.ts index 7adf98e33..1ecaae23d 100644 --- a/packages/allure-playwright/src/index.ts +++ b/packages/allure-playwright/src/index.ts @@ -39,8 +39,6 @@ import { statusToAllureStats } from "./utils.js"; // TODO: move to utils.ts const diffEndRegexp = /-((expected)|(diff)|(actual))\.png$/; -// 12 (allureattach) + 1 (_) + 36 (uuid v4) + 1 (_) -const stepAttachPrefixLength = 50; interface ReporterV2 { onConfigure(config: FullConfig): void; @@ -229,7 +227,7 @@ export class AllureReporter implements ReporterV2 { } this.allureRuntime!.startStep(testUuid, undefined, { - name: step.title.substring(0, stepAttachPrefixLength), + name: step.title, start: step.startTime.getTime(), }); } diff --git a/packages/allure-playwright/test/spec/steps.spec.ts b/packages/allure-playwright/test/spec/steps.spec.ts index 2ac9a111c..73481b9c8 100644 --- a/packages/allure-playwright/test/spec/steps.spec.ts +++ b/packages/allure-playwright/test/spec/steps.spec.ts @@ -151,3 +151,49 @@ it("reports failed test steps", async () => { }), ]); }); + +it("should support steps with names longer then 50 chars", async () => { + const { tests } = await runPlaywrightInlineTest({ + "a.test.js": ` + import { test, expect } from '@playwright/test'; + + test('a test', async ({}) => { + await test.step('Check email input field and submit button on password recovery window', async () => { + }); + }); + `, + "playwright.config.js": ` + module.exports = { + reporter: [ + [ + require.resolve("allure-playwright"), + { + resultsDir: "./allure-results", + detail: false, + }, + ], + ["dot"], + ], + projects: [ + { + name: "project", + }, + ], + }; + `, + }); + + expect(tests).toHaveLength(1); + expect(tests).toEqual([ + expect.objectContaining({ + name: "a test", + status: Status.PASSED, + steps: [ + expect.objectContaining({ + name: "Check email input field and submit button on password recovery window", + status: Status.PASSED, + }), + ], + }), + ]); +});