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: show running builds in the Debug page #25936

Merged
merged 53 commits into from
Mar 6, 2023

Conversation

warrensplayer
Copy link
Contributor

@warrensplayer warrensplayer commented Feb 24, 2023

Additional details

Before this update, a developer would have to wait for a run to complete before being able to see the failed tests that may be a part of the run. This change will allow the developer to switch to a running run and see any failed tests as they get recorded to the Cloud run.

Updates

  • Updated DebugNewRelevantRunBar
    • Was moved above the Debug header when it is shown
    • Link for "View run" was changed to "Switch to run"
    • Link for "Switch to run" was added for a RUNNING run

Before
image
image

After
Screenshot 2023-03-01 at 11 42 05 AM
Screenshot 2023-03-01 at 11 41 52 AM

  • Added DebugTestingProgress component
    • Shows when viewing a RUNNING run just below the header
    • Indicates how many specs have completed with text as well as a progress bar
    • Has a countdown when the run has a completionScheduledAt timestamp
    • Switches to say completion is soon if countdown expires

Screenshot 2023-03-01 at 11 45 36 AM

Screenshot 2023-03-01 at 11 45 46 AM

Screenshot 2023-03-01 at 11 46 07 AM

NOTE I have not implemented the "Run Completion Delay" tooltip and indication at the end of the progress bar. I need to review with Product to see if we want to do this in a fast-follow

  • Updated DebugPendingRunSplash
    • Removes the spec count because they are included in the DebugTestingProgress component
    • Update copy to support run is currently processing specs and has a state when the run is scheduled to complete

Screenshot 2023-03-01 at 11 48 12 AM

Screenshot 2023-03-01 at 11 48 27 AM

  • Update DebugPageHeader

    • Allow for the duration field to count up for a running run
  • Updated Sidebar badge to show when status of run is RUNNING

  • Updates to support animating the changing parts of the UI

    • Updated the logic Debug.vue to cache and replace the data being passed to the DebugContainer to make sure the page does not flash when the query is rerunning to update the page
    • Added various Transition and TransitionGroup components to fade components in and out
    • Modified CSS and the structure of some components
      • Pulled internal padding from some components up to a parent container
      • Updated StatsMetadata to support a "prefix" slot so that the render in DebugSpec did not render a list (ul) within another list using incorrect DOM
  • Backend updates

    • Updated moveToNext mutation to move to a specific run
    • Updates to RelevantRunSpecsDataSource
      • Track overall test counts to know when to trigger a running run to refresh
      • Track new cloud field called scheduledToCompleteAt to know when to switch the page to the "scheduled to complete" state

Extra credit

  • Discovered a missing browser icon in LayeredBrowserIcons and added a placeholder. Filed a ticket to get the real icon added.
  • Update useDurationFormat to show milliseconds if the duration is less than 1 second

Steps to test

  • Component tests to review

    • packages/app/src/debug/DebugContainer.cy.tsx
      • Added "renders running run with failed tests" test to some what mimic the phases of a running run
        • NOTE: Does not mock out DebugTestingProgress component due to issues with different mocked Urql queries interfering with each other
    • packages/app/src/debug/DebugNewRelevantRunBar.cy.tsx
    • packages/app/src/debug/DebugPageHeader.cy.tsx
    • packages/app/src/debug/DebugPendingRunSplash.cy.tsx
    • packages/app/src/debug/DebugTestingProgress.cy.tsx
    • packages/app/src/debug/StatsMetadata.cy.tsx
    • packages/app/src/navigation/SidebarNavigation.cy.tsx
  • E2E tests

    • The debug.cy.ts tests started to fail after including the scheduledToCompleteAt field in the query from DebugContainer. When running locally, the page would thrash between states. I believe the cause was the mocked up responses in packages/app/cypress/fixtures/debug-Passing/gql-Debug.json and packages/app/cypress/fixtures/debug-Failing/gql-Debug.json not containing this field. Thus, Urql which see that it was not present and requery causing other queries to also rerun. After adding the scheduledToCompleteAt field, the tests started passing again.
    • For this ticket, I relied on the CT tests for testing out the various states of the components and then live testing against a Cloud instance (staging and production). I worked on adding a new E2E tests for the running state, but could not get it working in short order so left it out.
  • Options for real world testing

    • Setup a project on a local Cloud instance, on staging, or in production and manually record a run to it
    • Check out the branch for this PR and trigger a Circle CI run against it to watch it.

How has the user experience changed?

See screenshots above

PR Tasks

@cypress
Copy link

cypress bot commented Feb 24, 2023

25 flaky tests on run #44553 ↗︎

0 26874 1281 0 Flakiness 25

Details:

Merge branch 'develop' into stokes/25759_debug_running_builds
Project: cypress Commit: 33f7cbe580
Status: Passed Duration: 18:30 💡
Started: Mar 6, 2023 7:15 PM Ended: Mar 6, 2023 7:34 PM
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
network stubbing > intercepting request > can delay and throttle a StaticResponse Output
Flakiness  cypress/cypress.cy.js • 3 flaky tests • 5x-driver-firefox

View Output Video

Test Artifacts
... > correctly returns currentRetry Output
... > correctly returns currentRetry Output
... > correctly returns currentRetry Output
Flakiness  specs_list_latest_runs.cy.ts • 2 flaky tests • app-e2e

View Output Video

Test Artifacts
App/Cloud Integration - Latest runs and Average duration > when no runs are recorded > shows placeholders for all visible specs Output Screenshots Video
App/Cloud Integration - Latest runs and Average duration > when offline > shows offline alert then hides it after coming online Output Screenshots Video
Flakiness  cypress-origin-communicator.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
Cypress In Cypress Origin Communicator > cy.origin passivity with app interactions > passes upon test reload mid test execution Output Screenshots Video
Flakiness  cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron

View Output Video

Test Artifacts
... > correctly returns currentRetry Output Video
... > correctly returns currentRetry Output Video
... > correctly returns currentRetry Output Video

The first 5 flaky specs are shown, see all 12 specs in Cypress Cloud.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@lmiller1990
Copy link
Contributor

lmiller1990 commented Mar 2, 2023

I am still going over the code, but this worked well when I tested it. I did real world testing, against an actual production app where I use Cypress for CT and E2E.

I did have to change from and back to the tab to see it update real time - I was just staring at it, expecting it to change - I guess the subscription only triggers if there is a run in progress when you open the page?

Watching it real time was really good - I could start debugging my tests (failed ones) without waiting! Very useful.

@warrensplayer
Copy link
Contributor Author

warrensplayer commented Mar 2, 2023

I did have to change from and back to the tab to see it update real time - I was just staring at it, expecting it to change - I guess the subscription only triggers if there is a run in progress when you open the page?

@lmiller1990 I saw this when developing but then was not able to reproduce it. I will try this scenario again and see if I can make it happen.

@warrensplayer
Copy link
Contributor Author

warrensplayer commented Mar 2, 2023

One thing I'm noticing in initial testing is that there's some flickering back and forth with the navigation badge (seemingly when new data comes in from the cloud?) - I'll see the number of failures, then the badge will flash to "New" for a second, and then back to the number of failures (this time updated since more tests are failing).

@astone123 I have also seen this happen. It seems to only happen once for me and then stop acting that way. If you are able to consistently see it, please try to recall the steps you took to get it to happen.

@warrensplayer
Copy link
Contributor Author

warrensplayer commented Mar 2, 2023

Feedback from acceptance testing with Product and Design

  • add “previous” to banner DONE
  • banner hide delay fix DONE
  • run persistence fix DONE

@warrensplayer
Copy link
Contributor Author

I did have to change from and back to the tab to see it update real time - I was just staring at it, expecting it to change - I guess the subscription only triggers if there is a run in progress when you open the page?

@lmiller1990 I saw this when developing but then was not able to reproduce it. I will try this scenario again and see if I can make it happen.

@lmiller1990 I tested again and I think this is just a matter of waiting for the next outer poll to happen which is every 30 seconds. The "outer" poll is the one from RelevantRunsDataSource that is sending the Git commit shas and determining the appropriate relevant runs. If a run starts recording a split second after one poll, you would have to wait an entire 30 seconds before it polls again. Try your test again and see if that is the case. There are DEBUG logs in the datasources you can turn on to see when it polls.

Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

This is looking good to me - I'll do a little more testing but the code seems mostly straight forward.

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.

LGTM. Only remaining feedback is that I would like to see a few Percy snapshots added for the new UI behaviors, but that's non-blocking

@@ -147,5 +152,41 @@ describe('RelevantRunsDataSource', () => {
commitsAhead: 0,
})
})

it('preserves running if switched', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

What does "switching" imply here - when you click on "Change to this run" (or whatever the button says)?

I'm guessing the reason no-one found this edge case in testing was because it was closely related to the timing of when you change runs?

Hope we can find a good way to E2E test this at some point - unit tests do the job, but I imagine it'd be hard to fully grok what this does from a user point of view without an E2E test.

@lmiller1990
Copy link
Contributor

lmiller1990 commented Mar 6, 2023

Let's merge it! Asked a question around the latest commit but it's just a question, not a blocker on merging.

@lmiller1990 lmiller1990 merged commit 434e6ee into develop Mar 6, 2023
@lmiller1990 lmiller1990 deleted the stokes/25759_debug_running_builds branch March 6, 2023 23:57
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.

Debug 1.1 - Show Running Build details
4 participants