Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(playwright): remove step title length #1088

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
}),
],
}),
]);
});
Loading