diff --git a/e2e/cypress-compatibility/__tests__/run.test.ts b/e2e/cypress-compatibility/__tests__/run.test.ts index 51cf9e8..c6a9216 100644 --- a/e2e/cypress-compatibility/__tests__/run.test.ts +++ b/e2e/cypress-compatibility/__tests__/run.test.ts @@ -1,5 +1,5 @@ import { expect, jest } from "@jest/globals"; -import { fetchRun, runCypressCloud } from "../../utils/utils"; +import { fetchRun, runCypressCloud } from "../utils/utils"; import { data as apiReference } from "../data-references/ccy-1.9.4-cy-12-crapi"; import { all, config, specs } from "../data-references/ccy-1.9.4-cy-12-cycl"; diff --git a/e2e/utils/utils.ts b/e2e/cypress-compatibility/utils/utils.ts similarity index 100% rename from e2e/utils/utils.ts rename to e2e/cypress-compatibility/utils/utils.ts diff --git a/packages/cypress-cloud/lib/cypress.types/12.ts b/packages/cypress-cloud/lib/cypress.types/12.ts index 16c2e52..9612dbe 100644 --- a/packages/cypress-cloud/lib/cypress.types/12.ts +++ b/packages/cypress-cloud/lib/cypress.types/12.ts @@ -95,6 +95,7 @@ export namespace Cypress12 { videoTimestamp: number; wallClockDuration: number; wallClockStartedAt: string; + startedAt: string; } export interface TestError { diff --git a/packages/cypress-cloud/lib/git.ts b/packages/cypress-cloud/lib/git.ts index 067dcc9..7fed105 100644 --- a/packages/cypress-cloud/lib/git.ts +++ b/packages/cypress-cloud/lib/git.ts @@ -6,7 +6,7 @@ export const getGitInfo = async (projectRoot: string) => { const commitInfo = await git.commitInfo(projectRoot); return getCommitDefaults({ branch: commitInfo.branch, - remoteOrigin: commitInfo.remote, + remoteOrigin: commitInfo.remote ?? 'null', authorEmail: commitInfo.email, authorName: commitInfo.author, message: commitInfo.message, diff --git a/packages/cypress-cloud/lib/results/specAfterResult.ts b/packages/cypress-cloud/lib/results/specAfterResult.ts index 2b85bea..ad16868 100644 --- a/packages/cypress-cloud/lib/results/specAfterResult.ts +++ b/packages/cypress-cloud/lib/results/specAfterResult.ts @@ -9,6 +9,7 @@ import { MochaError } from "../cypress.types/shared"; import { warn } from "../log"; import { getRandomString } from "../nano"; import { ExecutionState, ExecutionStateTestAttempt } from "../state"; +import { _cypressVersion } from "../state/global"; export class SpecAfterResult { /** @@ -104,6 +105,7 @@ export class SpecAfterResult { "wallClockDuration" in cypressAttempt ? cypressAttempt.wallClockDuration : null; + return { state: cypressAttempt.state, error: error @@ -112,9 +114,12 @@ export class SpecAfterResult { timings: "timings" in cypressAttempt ? cypressAttempt.timings : null, wallClockStartedAt: "wallClockStartedAt" in cypressAttempt - ? cypressAttempt.wallClockStartedAt + ? (cypressAttempt.wallClockStartedAt ?? new Date().toISOString()) + : new Date().toISOString(), + startedAt: + "startedAt" in cypressAttempt + ? (cypressAttempt.startedAt ?? new Date().toISOString()) : new Date().toISOString(), - wallClockDuration: duration ? duration : 0, failedFromHookId: "failedFromHookId" in cypressAttempt @@ -122,7 +127,7 @@ export class SpecAfterResult { : null, videoTimestamp: "videoTimestamp" in cypressAttempt - ? cypressAttempt.videoTimestamp + ? (cypressAttempt.videoTimestamp ?? 0) : 0, }; } @@ -140,6 +145,7 @@ export class SpecAfterResult { wallClockStartedAt: mochaAttempt.wallClockStartedAt ?? new Date().toISOString(), wallClockDuration: mochaAttempt.duration ?? -1, + startedAt: mochaAttempt.wallClockStartedAt, failedFromHookId: "failedFromHookId" in cypressAttempt ? cypressAttempt.failedFromHookId @@ -148,9 +154,9 @@ export class SpecAfterResult { "videoTimestamp" in cypressAttempt ? cypressAttempt.videoTimestamp : SpecAfterResult.getAttemptVideoTimestamp( - parseISO(mochaAttempt.wallClockStartedAt).getTime(), - specStartedAt.getTime() - ), + parseISO(mochaAttempt.wallClockStartedAt).getTime(), + specStartedAt.getTime() + ), }; } @@ -195,7 +201,7 @@ export class SpecAfterResult { spec: CypressTypes.EventPayload.SpecAfter.Spec ): Standard.SpecAfter.Spec { return { - name: spec.name, + name: parseFloat(_cypressVersion!) >= 13 ? spec.name : ("baseName" in spec ? spec.baseName : ""), relative: spec.relative, absolute: spec.absolute, fileExtension: spec.fileExtension,