Skip to content

Commit

Permalink
fix: a single attachment of a nested step ignored by allure1 reader
Browse files Browse the repository at this point in the history
  • Loading branch information
delatrie committed Jan 9, 2025
1 parent 4c2ccc6 commit 4537d8a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/reader/src/allure1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ const arrayTags: Set<string> = new Set([
"test-suite.labels.label",
"test-suite.test-cases.test-case",
"test-suite.test-cases.test-case.labels.label",
"test-suite.test-cases.test-case.attachments.attachment",
"test-suite.test-cases.test-case.parameters.parameter",
"test-suite.test-cases.test-case.steps.step.attachments.attachment",
]);
const arrayTagPatterns = [/^test-suite\.test-cases\.test-case(\.steps\.step)+$/];
const arrayTagPatterns = [
/^test-suite\.test-cases\.test-case(?:\.steps\.step)+$/,
/^test-suite\.test-cases\.test-case(?:\.steps\.step)*\.attachments\.attachment$/,
];

const xmlParser = new XMLParser({
parseTagValue: false,
Expand Down
9 changes: 9 additions & 0 deletions packages/reader/test/allure1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,15 @@ describe("allure1 reader", () => {
});
});

it("should parse a single attachment of a nested step", async () => {
const visitor = await readResults(allure1, {
"allure1data/steps/attachments/oneAttachmentInNestedStep.xml": randomTestsuiteFileName(),
});

expect(visitor.visitTestResult).toHaveBeenCalledTimes(1);
expect(visitor.visitTestResult.mock.calls[0][0]).toMatchObject({ steps: [{ steps: [{ steps: [expect.anything()] }] }] });
});

it("should ignore a missing title", async () => {
const visitor = await readResults(allure1, {
"allure1data/steps/attachments/titleMissing.xml": randomTestsuiteFileName(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<test-suite xmlns="urn:model.allure.qatools.yandex.ru">
<test-cases>
<test-case>
<steps>
<step>
<steps>
<step>
<attachments>
<attachment title="foo" source="bar" type="text/plain"/>
</attachments>
</step>
</steps>
</step>
</steps>
</test-case>
</test-cases>
</test-suite>

0 comments on commit 4537d8a

Please sign in to comment.