From 00d5e60ad8f533fdb2a81e05b86af16a78262310 Mon Sep 17 00:00:00 2001 From: Dmitry Baev Date: Mon, 6 Jan 2025 15:33:03 +0000 Subject: [PATCH] fix codeceptjs --- packages/allure-codeceptjs/src/reporter.ts | 3 +- .../allure-codeceptjs/test/spec/steps.test.ts | 71 +++++++++---------- 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/packages/allure-codeceptjs/src/reporter.ts b/packages/allure-codeceptjs/src/reporter.ts index 2486355c1..c6a93b0a1 100644 --- a/packages/allure-codeceptjs/src/reporter.ts +++ b/packages/allure-codeceptjs/src/reporter.ts @@ -46,8 +46,7 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter { return; } this.runtime.startStep(root, undefined, { - name: `${step.actor} ${step.name}`, - parameters: step.args?.map((arg, index) => ({ name: `arg${index}`, value: `${arg}` })), + name: step.toString().trim(), }); } diff --git a/packages/allure-codeceptjs/test/spec/steps.test.ts b/packages/allure-codeceptjs/test/spec/steps.test.ts index d51c587fa..cdd4e2608 100644 --- a/packages/allure-codeceptjs/test/spec/steps.test.ts +++ b/packages/allure-codeceptjs/test/spec/steps.test.ts @@ -108,18 +108,39 @@ it("should log steps with parameters", async () => { status: Status.PASSED, }), expect.objectContaining({ - name: "I parameters", + name: "I parameters \"https://example.com/\", \"#header\"", + status: Status.PASSED, + }), + ], + }), + ]), + ); +}); + +it("should support secret step parameters", async () => { + const { tests } = await runCodeceptJsInlineTest({ + "steps.test.js": ` + Feature("a feature"); + Scenario("scenario 1", async ({ I }) => { + await I.pass(); + await I.parameters("https://example.com/", secret("#header")); + }); + `, + }); + + expect(tests).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + status: Status.PASSED, + name: "scenario 1", + steps: [ + expect.objectContaining({ + name: "I pass", + status: Status.PASSED, + }), + expect.objectContaining({ + name: "I parameters \"https://example.com/\", *****", status: Status.PASSED, - parameters: expect.arrayContaining([ - expect.objectContaining({ - name: "arg0", - value: "https://example.com/", - }), - expect.objectContaining({ - name: "arg1", - value: "#header", - }), - ]), }), ], }), @@ -150,24 +171,12 @@ it("should log comments", async () => { status: Status.PASSED, }), expect.objectContaining({ - name: "I say", + name: "I say \"hi\"", status: Status.PASSED, - parameters: expect.arrayContaining([ - expect.objectContaining({ - name: "arg0", - value: "hi", - }), - ]), }), expect.objectContaining({ - name: "I say", + name: "I say \"bye\"", status: Status.PASSED, - parameters: expect.arrayContaining([ - expect.objectContaining({ - name: "arg0", - value: "bye", - }), - ]), }), ], }), @@ -195,21 +204,11 @@ it("should log expects", async () => { }), steps: [ expect.objectContaining({ - name: "I expectEqual", + name: "I expect equal 1, 2", status: Status.FAILED, statusDetails: expect.objectContaining({ message: "expected 1 to equal 2", }), - parameters: expect.arrayContaining([ - expect.objectContaining({ - name: "arg0", - value: "1", - }), - expect.objectContaining({ - name: "arg1", - value: "2", - }), - ]), }), ], }),