Skip to content

Commit

Permalink
fix: set test id for pending tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agoldis committed Sep 6, 2023
1 parent 3d19fee commit f37312e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
17 changes: 17 additions & 0 deletions examples/webapp/cypress/e2e/notests.spec.js
Original file line number Diff line number Diff line change
@@ -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');
});
});
40 changes: 21 additions & 19 deletions packages/cypress-cloud/lib/results/combine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit f37312e

Please sign in to comment.