From f37312e0651954481b1e3fb89552606bea3dde38 Mon Sep 17 00:00:00 2001 From: Andrew Goldis Date: Wed, 6 Sep 2023 16:56:28 -0700 Subject: [PATCH] fix: set test id for pending tests --- examples/webapp/cypress/e2e/notests.spec.js | 17 ++++++++ packages/cypress-cloud/lib/results/combine.ts | 40 ++++++++++--------- 2 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 examples/webapp/cypress/e2e/notests.spec.js diff --git a/examples/webapp/cypress/e2e/notests.spec.js b/examples/webapp/cypress/e2e/notests.spec.js new file mode 100644 index 0000000..6d56013 --- /dev/null +++ b/examples/webapp/cypress/e2e/notests.spec.js @@ -0,0 +1,17 @@ +describe('No tests', function () { + it.skip('A ', function () { + cy.visit('/'); + cy.get('#simpleSearch').type('Africa'); + cy.get('.suggestions-result').first().click(); + cy.scrollTo(0, 1200); + + cy.contains('adssaf'); + }); + it.skip('B ', function () { + cy.visit('/'); + cy.get('#simpleSearch').type('Africa'); + cy.get('.suggestions-result').first().click(); + cy.scrollTo(0, 1200); + cy.contains('giraffes'); + }); +}); diff --git a/packages/cypress-cloud/lib/results/combine.ts b/packages/cypress-cloud/lib/results/combine.ts index 7d3827f..bed0293 100644 --- a/packages/cypress-cloud/lib/results/combine.ts +++ b/packages/cypress-cloud/lib/results/combine.ts @@ -42,25 +42,27 @@ function getSpecResults(specResults: SpecResult, attempts?: any[]) { return specResults; } - const enhancedTestList = (specResults.tests ?? []).map((test: any) => { - const testFullTitle = test.title.join(" "); - const standaloneAttempts = attempts.filter( - (attempt) => attempt.fullTitle === testFullTitle - ); - test.attempts = standaloneAttempts.map((attempt) => ({ - state: attempt.state, - error: getAttemptError(attempt.err), - timings: attempt.timings, - wallClockStartedAt: attempt.wallClockStartedAt, - wallClockDuration: attempt.duration, - videoTimestamp: getAttemptVideoTimestamp( - parseISO(attempt.wallClockStartedAt).getTime(), - parseISO(specResults.stats.startedAt).getTime() - ), - })); - test.testId = standaloneAttempts[0].id; - return test; - }); + const enhancedTestList = (specResults.tests ?? []).map( + (test: any, i: number) => { + const testFullTitle = test.title.join(" "); + const standaloneAttempts = attempts.filter( + (attempt) => attempt.fullTitle === testFullTitle + ); + test.attempts = standaloneAttempts.map((attempt) => ({ + state: attempt.state, + error: getAttemptError(attempt.err), + timings: attempt.timings, + wallClockStartedAt: attempt.wallClockStartedAt, + wallClockDuration: attempt.duration, + videoTimestamp: getAttemptVideoTimestamp( + parseISO(attempt.wallClockStartedAt).getTime(), + parseISO(specResults.stats.startedAt).getTime() + ), + })); + test.testId = standaloneAttempts[0]?.id ?? `r${i}}`; + return test; + } + ); return { ..._.cloneDeep(specResults),