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

feat: IATR cloud data backend #25316

Merged
merged 65 commits into from
Jan 17, 2023

Conversation

warrensplayer
Copy link
Contributor

@warrensplayer warrensplayer commented Dec 30, 2022

User facing changelog

N/A merging to feature branch

Additional details

Background
This PR moves the logic for determining the "relevant" run for the new Debug page to the server and exposing it through a GraphQL query. The server handles fetching the git hashes to send to the Cypress cloud and processing the runs returned to determine the appropriate run(s) for the front end.

What is a "relevant" run?
A "relevant" run for the Debug page is determined by looking up runs in a Cypress Cloud project that have a Git commit sha that matches one of the last 100 commit shas in the users's current development project. If the current environment does not use Git, then the Debug feature will not be available for that project. See the RelevantRunsDataSource to see the logic for how the "current" and "next" relevant runs are determined.

Main Components

  • packages/data-context/src/sources/RelevantRunsDatasource.ts
    • Server data source that determines which CloudRuns match the local Git shas and should be used for the Debug page
  • packages/data-context/src/sources/RelevantRunSoecsDatasource.ts
    • Server data source that pulls spec counts for the current and next runs. Used by a poller that backs a new GQL subscription
  • packages/app/src/composables/useRelevantRun.ts
    • GQL query for querying for the relevant run order to use the runNumber in subsequent queries
  • packages/app/src/composables/useTestsForDebug.ts
    • GQL query for finding the failed tests to use for a filter in the runner when filtering in debug mode

GQL Updates/Additions

  • CurrentProject
    • added testsForReviewBySpec
    • TODO: Need to complete resolver for testsForReviewBySpec. Currently just a placeholder
  • Mutation
    • added movetoNextRelevantRun for front end to indicate that the cached run just be removed and the newest run used as the current run
  • RelevantRun
    • New field type added for representing the relevant current and next run
  • Subscription
    • added relevantRuns to allow for the front end to see changes to the current and next relevant runs
    • added relevantRunSpecChange to allow for the banner and page that are showing updating spec counts for RUNNING builds to update

Dependency Updates

  • Added mocha-junit-reporter and moch-multi-reporters to the data-context package directly
    • This was required to fix a bug when a test would fail an assertion. These reporters were being referenced from the root package.json. They would make a call out to the peer dependency for mocha which is currently an older version at the root of the project. Various versions of mocha are used throughout the mono-repo that should be looked at.

Other Updates
Updated the various parts of the Debug feature that was using hardcoded runNumbers to use the new useRelevantRuns composable and delay the initial queries until the value is found.

Steps to test

In order to test this PR, you will currently need to have the Cypress Cloud running locally or point to Cloud staging

  • Open Cypress and log in to your local Cloud instance
  • Open a project that has recorded runs
  • Verify that the Debug page and the sidebar badge represent the appropriate "relevant" run based on the algorithm defined above and documented in the code in RelevantRunsDataSource
  • Start recording a new run to this project
  • Verify that the new RUNNING run is shown in the banner on the Debug page as running (banner implemented here [IATR](M1.0) Running/completed build banner for debug page #24853)
  • When the run completes, verify that the banner updates to show the completed status and a "View run" link (banner implemented here [IATR](M1.0) Running/completed build banner for debug page #24853)
  • Click the "View run" and verify that the latest run is now shown as the current run on the Debug page

How has the user experience changed?

N/A Backend changes only

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?

@cypress
Copy link

cypress bot commented Jan 4, 2023



Test summary

26535 2 1180 0Flakiness 46


Run details

Project cypress
Status Failed
Commit a97a39d
Started Jan 17, 2023 6:55 PM
Ended Jan 17, 2023 7:14 PM
Duration 19:27 💡
OS Linux Debian -
Browser Multiple

View run in Cypress Dashboard ➡️


Failures

Run group: launchpad-e2e (Linux, Chrome )
cypresse2e/migration.cy.ts Failed
1 global mode > migrates 2 projects in global mode
Run group: app-ct (Linux, Chrome )
srcdebug/GroupedDebugFailedTest.cy.tsx Failed
1 > mounts correctly and shows artifacts on hover

Flakiness

create-from-component.cy.ts Flakiness
1 ... > runs generated spec
2 ... > runs generated spec
runner/reporter-ct-vite.errors.cy.ts Flakiness
1 Vite - errors ui > cy.readFile
e2e/origin/commands/navigation.cy.ts Flakiness
1 cy.origin navigation > #consoleProps > .go()
commands/net_stubbing.cy.ts Flakiness
1 network stubbing > intercepting request > can delay and throttle a StaticResponse
This comment includes only the first 5 flaky tests. See all 46 flaky tests in the Cypress Dashboard.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@warrensplayer warrensplayer marked this pull request as ready for review January 5, 2023 14:12
Copy link
Contributor

@mike-plummer mike-plummer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is working great locally minus the issues I pointed out on Slack. Just a couple comments and it looks like there's a couple from Zach still pending as well, will approve assuming they are answered

@marktnoonan
Copy link
Contributor

I caught a brief flash of "new" here before this resolved to 0. Not blocking but possibly we could have a little delay to make sure nothing is coming from the cloud before we show the "new" status.

Screen Shot 2023-01-17 at 11 23 24 AM

@warrensplayer
Copy link
Contributor Author

I caught a brief flash of "new" here before this resolved to 0. Not blocking but possibly we could have a little delay to make sure nothing is coming from the cloud before we show the "new" status.

@marktnoonan Yes, there are some scenarios causing "flashes" of content. I am going to file a follow up issue for that.

@marktnoonan
Copy link
Contributor

What is the expectation when more than one run is pending? We just see the newest in this page?

Screen Shot 2023-01-17 at 11 27 18 AM

Copy link
Contributor

@marktnoonan marktnoonan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested as described in the PR and everything works. I have a few questions and captured them on the fly here: https://www.loom.com/share/bd58758e23d8469d9300dbe5fb37288d - it's a long one but might be good for reference.

There are a few instances where state flickers and I think some strategic debounces or waits could help us out as we polish. Nvm, I saw our earlier convo that we'll make a new issue.

The main usability issue I see at the the moment is the need to manually click a button called "View Run" (which is different to the other button "View in Cypress Cloud") on the just-finished run in order to "promote it" to be the run that you are actively debugging.

It feels weird that when Cypress "knows about a run" in the Debug page, it's possible for the run's page not to know about that run yet, and that there's no way to click through to the Cloud from the pending run. I think this has to do with the fact that we don't poll in the background when the user is not on the runs page, and we don't immediately poll again when they come back to it.

None of these are blocking issues for this PR, just a head start on feedback on the feature overall I guess.

@warrensplayer
Copy link
Contributor Author

Merging this to the feature branch. Items left to complete are filed here:

#25486
#25487

@warrensplayer warrensplayer merged commit 1c9d06f into feature/IATR-M0 Jan 17, 2023
@warrensplayer warrensplayer deleted the stokes/IATR-M0-cloud-run-data branch January 17, 2023 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants