Skip to content

Wrong 'AttemptResult' TS type #24110

Closed
@bass3l

Description

@bass3l

Current behavior

Hi and thank you for this great work.

Just want to report a tiny issue with the CommandLine.AttemptResult type. The type definition is:

interface AttemptResult {
  state: string
  error: TestError | null
  startedAt: dateTimeISO
  duration: ms
  videoTimestamp: ms
  screenshots: ScreenshotInformation[]
}

But duration and startedAt don't exist in the actual object, instead the following should be defined wallClockDuration and wallClockStartedAt respectively, I've attached a sample AttemptResult object.

Not sure if screenshots property exist in the actual object, and there is failedFromHookId and timings missing in the type definition which exist. Anyway, if this is confirmed, I could take a look into fixing it. 👍

Desired behavior

No response

Test code to reproduce

Here is a TS example accessing mentioned properties:

export default (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {
  // `on` is used to hook into various events Cypress emits
  // `config` is the resolved Cypress config
  on('after:spec', async (spec, results) => {
    results.tests.forEach(cypressTestResult => {
      const attempt = cypressTestResult.attempts.pop();
      console.log(attempt);
      // This will complain that the property doesn't exist
      const wallClockDuration = attempt.wallClockDuration;
      // This will complain that the property doesn't exist
      const wallClockStartedAt = attempt.wallClockStartedAt;
    });
  });
}

Cypress Version

10.9.0

Node version

16.3.0

Operating System

macOS 12.1

Debug Logs

{
  state: 'passed',
  error: null,
  timings: { lifecycle: 7, test: { fnDuration: 9805, afterFnDuration: 0 } },
  failedFromHookId: null,
  wallClockStartedAt: '2022-10-04T10:39:19.792Z',
  wallClockDuration: 9817,
  videoTimestamp: 1584
}

Other

No response

Metadata

Metadata

Assignees

Labels

E2EIssue related to end-to-end testingTriagedIssue has been routed to backlog. This is not a commitment to have it prioritized by the team.good first issueGood for newcomerstype: typingsIssue related to Cypress types (for TypeScript)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions