Skip to content

Commit

Permalink
fix codeceptjs
Browse files Browse the repository at this point in the history
  • Loading branch information
baev committed Jan 6, 2025
1 parent 962f247 commit 00d5e60
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 38 deletions.
3 changes: 1 addition & 2 deletions packages/allure-codeceptjs/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
}

Expand Down
71 changes: 35 additions & 36 deletions packages/allure-codeceptjs/test/spec/steps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}),
]),
}),
],
}),
Expand Down Expand Up @@ -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",
}),
]),
}),
],
}),
Expand Down Expand Up @@ -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",
}),
]),
}),
],
}),
Expand Down

0 comments on commit 00d5e60

Please sign in to comment.