diff --git a/packages/allure-cypress/src/index.ts b/packages/allure-cypress/src/index.ts index 3999e3eb0..065655551 100644 --- a/packages/allure-cypress/src/index.ts +++ b/packages/allure-cypress/src/index.ts @@ -197,6 +197,16 @@ export class AllureCypressTestRuntime implements TestRuntime { return Cypress.Promise.resolve(); } + + sendSkippedTestMessages(messages: CypressRuntimeMessage[]) { + const skippedTestsMessages: CypressRuntimeMessage[][] | undefined = Cypress.env("skippedTestsMessages"); + + if (!skippedTestsMessages) { + Cypress.env("skippedTestsMessages", [messages]); + } else { + skippedTestsMessages.push(messages); + } + } } const { @@ -521,6 +531,12 @@ const initializeAllure = () => { }); }); + afterEach(() => { + const runtimeMessages = Cypress.env("allureRuntimeMessages") as CypressMessage[]; + + cy.task("allureReportTest", runtimeMessages, { log: false }); + }); + after(ALLURE_REPORT_SHUTDOWN_HOOK, () => { const runtimeMessages = Cypress.env("allureRuntimeMessages") as CypressMessage[]; diff --git a/packages/allure-cypress/test/spec/base.test.ts b/packages/allure-cypress/test/spec/base.test.ts index fc759d7a6..5aaaa0ad6 100644 --- a/packages/allure-cypress/test/spec/base.test.ts +++ b/packages/allure-cypress/test/spec/base.test.ts @@ -44,3 +44,29 @@ it("broken test", async () => { expect(tests[0].stage).toBe(Stage.FINISHED); expect(tests[0].statusDetails).toHaveProperty("message", "broken"); }); + +it("skipped tests", async () => { + const { tests } = await runCypressInlineTest( + () => ` + it.skip("skipped-1", () => { + cy.wrap(1).should("eq", 1); + }); + it("passing", () => { + cy.wrap(1).should("eq", 1); + }); + it.skip("skipped-2", () => { + cy.wrap(2).should("eq", 2); + }); + `, + ); + + expect(tests).toHaveLength(3); + // The passing test is first, because afterEach hook runs before after hook + expect(tests[0].status).toBe(Status.PASSING); + expect(tests[0].stage).toBe(Stage.FINISHED); + + expect(tests[1].status).toBe(Status.SKIPPED); + expect(tests[1].stage).toBe(Stage.FINISHED); + expect(tests[2].status).toBe(Status.SKIPPED); + expect(tests[2].stage).toBe(Stage.FINISHED); +});