Skip to content

Commit

Permalink
fix(playwright): remove step title length (fixes #1087, via #1088)
Browse files Browse the repository at this point in the history
  • Loading branch information
baev authored Aug 2, 2024
1 parent 4b5fbd8 commit f011d5c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
4 changes: 1 addition & 3 deletions packages/allure-playwright/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
});
}
Expand Down
46 changes: 46 additions & 0 deletions packages/allure-playwright/test/spec/steps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
],
}),
]);
});

0 comments on commit f011d5c

Please sign in to comment.