diff --git a/packages/reader/src/allure1/index.ts b/packages/reader/src/allure1/index.ts index 52de0029..3a14f3a9 100644 --- a/packages/reader/src/allure1/index.ts +++ b/packages/reader/src/allure1/index.ts @@ -51,11 +51,12 @@ const arrayTags: Set = 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, diff --git a/packages/reader/test/allure1.test.ts b/packages/reader/test/allure1.test.ts index e4cb2915..56c6c6a5 100644 --- a/packages/reader/test/allure1.test.ts +++ b/packages/reader/test/allure1.test.ts @@ -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(), diff --git a/packages/reader/test/resources/allure1data/steps/attachments/oneAttachmentInNestedStep.xml b/packages/reader/test/resources/allure1data/steps/attachments/oneAttachmentInNestedStep.xml new file mode 100644 index 00000000..6705efa3 --- /dev/null +++ b/packages/reader/test/resources/allure1data/steps/attachments/oneAttachmentInNestedStep.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + +