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

Command Timeout Progress Bar #7646

Merged
merged 29 commits into from
Jun 16, 2020
Merged

Command Timeout Progress Bar #7646

merged 29 commits into from
Jun 16, 2020

Conversation

panzarino
Copy link
Contributor

@panzarino panzarino commented Jun 9, 2020

User facing changelog

Adds an animated progress bar indicating how close the running command is to timing out

Additional details

In order to implement these changes, two new fields were added to every command log object: timeout and wallClockStartedAt. These two fields are needed in order to know what the timeout is for a specific command (each command has different defaults and the ability to change the timeout through options), as well as how long the command has been running for when the progress bar is first displayed (displayed at different times based on number of tests in the file and arbitrary user clicks).

How has the user experience changed?

Here is an example of the progress bar when a command times out:

ezgif-6-ed8f7d0ed733

PR Tasks

  • Have tests been added/updated?
  • Has the original issue been tagged with a release in ZenHub?
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 9, 2020

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Jun 9, 2020



Test summary

7584 0 119 0


Run details

Project cypress
Status Passed
Commit b107537
Started Jun 16, 2020 3:41 PM
Ended Jun 16, 2020 3:48 PM
Duration 06:52 💡
OS Linux Debian - 10.1
Browser Multiple

View run in 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

@panzarino panzarino marked this pull request as ready for review June 12, 2020 01:38
Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

Threading options.timeout throughout the flow seems okay, but I’d like someone else to comment on this.

The UI code could be a bit cleaner and I left suggestions. The one I really care about is isolating the logic in the template into some sort of function or component. The Date stuff is a nitpick and just a suggestion to clean up the code and let you know there’s a diff way to spell it.

packages/reporter/src/commands/command.tsx Outdated Show resolved Hide resolved
packages/reporter/src/commands/command.tsx Outdated Show resolved Hide resolved
Copy link
Member

@jennifer-shehane jennifer-shehane 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 really cool btw when you use it. 😄

  1. So, it creates this 'jitter' effect due to the height of the command being 2px higher and then settling into the natural height of 2px less.

    Typically you'd want to negate this by always having the height of the command consistent whether there's a progress bar or not.

  2. The animations still play when using .debug(). Not sure how we want to handle this.

  3. I don't think progress bars are meant to be logged for just standard XHR requests / events that are not actual commands from Cypress. There is no 'timeout' for these completing, they respond when they respond.

  4. This is what I meant when speaking of perf the other day. Some of the team said 'there will only be one progress bar at a time', but if you do something like the example below Performance issues of the Runner when using Cypress commands on many DOM elements at once #6967, it gets overwhelmed drawing 200+ wrap/invokes/asserts in the Command Log, all with progress bars.

    There is a perf problem in general, so this PR doesn't introduce that!

    With this PR, the example seems to be spending ~4sec more rendering though. And issuing a big warning about layout shift. (Perhaps because we're adding the element in with height and removing it - requiring layout to be recalculated).

    I'd probably like someone else to verify though because I'm not that great with the performance tools.

    it('perf', () => {
      cy.visit('https://entertainment.cathaypacific.com/catalog?template=movie&parent=Movies')
      cy.get('.carouselImage > poster-image > figure > picture > source', { timeout: 40000 }).each(source => {
        cy.wrap(source)
          .invoke('attr', 'srcset')
          .should('contain', 'http')
      })
    })

    4.8.0

    Screen Shot 2020-06-12 at 12 51 08 PM

    This PR

    Screen Shot 2020-06-12 at 12 49 33 PM

@panzarino
Copy link
Contributor Author

@jennifer-shehane I was able to fix a majority of the issues described here.

As far as the debugging issue goes, the only way that I think this could be fixed is if there is some state that indicates that the tests have been opened in the debugger. Perhaps there could be an additional variable added to appState that indicates if the debugger is open, and that can be used to pause the animation.

The debugger gif you posted also revealed another small issue, that the progress bar would go back to full when complete, which has been fixed.

Fixed jitter effect:

ezgif-6-e8673a2224fc

Removed error where XHR requests would default to default command timeout:

ezgif-6-620026d4b3bc

Performance improvements:

Current develop branch:

Screen Shot 2020-06-12 at 3 07 38 PM

These changes:

Screen Shot 2020-06-12 at 3 10 28 PM

@JessicaSachs
Copy link
Contributor

JessicaSachs commented Jun 12, 2020

I validated that the jitter is fixed.

Another issue: on failed tests the spinner fails to stop spinning. You can trigger a failed test by hitting the "Stop" icon during a get command
Screenshot 2020-06-12 15 29 20

I don't believe we need to pause the spinner when the debugger state is active.

@panzarino
Copy link
Contributor Author

@JessicaSachs That issue is actually present on develop and I think its been like that for a while now. I feel like it warrants its own issue and fixing it is outside the scope of this PR.

Copy link
Contributor Author

@panzarino panzarino left a comment

Choose a reason for hiding this comment

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

Note: assertion timeout is not synced with command timeout, must fix before merge

@JessicaSachs JessicaSachs self-requested a review June 15, 2020 18:29
JessicaSachs
JessicaSachs previously approved these changes Jun 15, 2020
Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

Once the timeout issue you mentioned is fixed, this looks good to me

@panzarino
Copy link
Contributor Author

I have removed the progress bars under each assertion so that there can just be one progress bar that is synchronized around the whole command.

@bkucera and I decided that this progress bar should be displayed underneath the last assertion, but I was unable to find a way to accomplish this without a significant performance reduction. Therefore, the progress bar will be displayed underneath the top-level command as such:

Screen Shot 2020-06-15 at 4 06 45 PM

This is probably not the ideal solution, but I am unable to think of any better viable solution.

Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

Pulled it and ran it. Looks good to me.

Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

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

LGTM. I've rerun this firefox failing test a lot now and it keeps failing, so not sure there's something to investigate there.

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.

Command Timeout Indicator [TTR-36]
3 participants