Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong 'AttemptResult' TS type #24110

Closed
bass3l opened this issue Oct 4, 2022 · 4 comments · Fixed by #26569
Closed

Wrong 'AttemptResult' TS type #24110

bass3l opened this issue Oct 4, 2022 · 4 comments · Fixed by #26569
Assignees
Labels
E2E Issue related to end-to-end testing good first issue Good for newcomers Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: typings Issue related to Cypress types (for TypeScript)

Comments

@bass3l
Copy link

bass3l commented Oct 4, 2022

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

@astone123 astone123 self-assigned this Oct 4, 2022
@astone123 astone123 added routed-to-e2e type: typings Issue related to Cypress types (for TypeScript) labels Oct 4, 2022
@astone123 astone123 removed their assignment Oct 4, 2022
@Ioanna2001
Copy link
Contributor

Hello, I am really interested in contributing and I am in the process of learning Vue and TypeScript. I see that this is still an active issue, do you think I could tackle this? @emilyrohrbough

@emilyrohrbough
Copy link
Member

@Ioanna2001 Please feel free to pick this up!

@nagash77 nagash77 added E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-e2e labels Apr 19, 2023
@mahdikhashan
Copy link
Contributor

mahdikhashan commented Jun 14, 2023

@emilyrohrbough Hi, can I open a PR to improve the typing? if yes, please assign the issue to me.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 6, 2023

Released in 12.17.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v12.17.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
E2E Issue related to end-to-end testing good first issue Good for newcomers Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: typings Issue related to Cypress types (for TypeScript)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants