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

fix(unify): Updating reporter to consistently use app-provided "Preferred Editor" dialog #19933

Merged
merged 10 commits into from
Jan 31, 2022

Conversation

tbiethman
Copy link
Contributor

@tbiethman tbiethman commented Jan 27, 2022

The reporter package had a few areas where the react-based dialog was still being used to manage file opening. I updated these to emit the appropriate events so that these flows go through graphql and the app's provided dialog.

Also migrating helpers and initial tests to app from existing runner specs. More tests to come; I wanted to get some of the existing helper logic + the dialog fix in before inflating the PR size too much.

User facing changelog

Additional details

One side effect of the reporter component restructuring is that we have a little more control over the tooltip presentation. With these changes, the "Open in IDE" tooltip does not present when the link/element itself says "Open in IDE", as it was kind of redundant. However, I could not find designs to that effect, so we can add those back if we need to.

How has the user experience changed?

Before:
Screen Shot 2022-01-27 at 1 59 52 PM

After:
Screen Shot 2022-01-27 at 10 55 44 PM

PR Tasks

  • Have tests been added/updated?
  • [n/a] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [n/a] Has a PR for user-facing changes been opened in cypress-documentation?
  • [n/a] Have API changes been updated in the type definitions?
  • [n/a] Have new configuration options been added to the cypress.schema.json?

Migrating helpers and initial tests to app from existing runner specs
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 27, 2022

Thanks for taking the time to open a PR!

@tbiethman tbiethman marked this pull request as draft January 27, 2022 19:35
@cypress
Copy link

cypress bot commented Jan 27, 2022



Test summary

17897 0 211 0Flakiness 5


Run details

Project cypress
Status Passed
Commit 85ef6b6
Started Jan 31, 2022 4:44 PM
Ended Jan 31, 2022 4:57 PM
Duration 12:07 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

commands/net_stubbing.cy.ts Flakiness
1 network stubbing > waiting and aliasing > should handle aborted requests
2 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
3 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
cypress/proxy-logging.cy.ts Flakiness
1 Proxy Logging > request logging > xhr log has response body/status code
2 Proxy Logging > request logging > xhr log has response body/status code

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

@tbiethman tbiethman changed the title fix(unify): Updating reporter to use vue preferred editor dialog fix(unify): Updating reporter to consistently use app-provided "Preferred Editor" dialog Jan 27, 2022
@@ -0,0 +1,205 @@
import _ from 'lodash'
Copy link
Contributor Author

@tbiethman tbiethman Jan 28, 2022

Choose a reason for hiding this comment

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

The majority of this file was pre-existing in the runner package here. It's been modified here to no longer use runIsolatedCypress, as the spec is responsible for scaffolding and initializing the e2e test. We also no longer spy on the socket for external IDE interactions and intercept mutations/assert DOM instead.

This might change a bit as more tests get ported over.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, definitely worth porting this - it might be a bit of work to figure out how it all works and what it does, but definitely time well spent.

@@ -70,12 +56,6 @@ export const verify = (ctx, options) => {
.should('not.include.text', '__stackReplacementMarker')

cy.contains('.runnable-err-stack-trace .runnable-err-file-path', openInIdePath.relative)
Copy link
Contributor Author

@tbiethman tbiethman Jan 28, 2022

Choose a reason for hiding this comment

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

I left the assertions for the element presence but removed the action assertions. I struggled to find a good way to continue to have coverage for the actions here; any suggestions are welcomed.

@@ -1,43 +0,0 @@
import { observer } from 'mobx-react'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This component is no longer needed now that we delegate this workflow through graphql.

@@ -0,0 +1,90 @@
import { verify } from './support/verify-helpers'
Copy link
Contributor Author

@tbiethman tbiethman Jan 28, 2022

Choose a reason for hiding this comment

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

These tests were carried forward from the runner package and modified to be more e2e. There's a lot more where this came from, I'll be adding more in future PRs.

})
})

describe('when user has not already set opener and opens file', () => {
Copy link
Contributor Author

@tbiethman tbiethman Jan 28, 2022

Choose a reason for hiding this comment

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

These workflows and related components are no longer accessible. I think we're good to remove the ui-components/FileOpener and related files at this point? I can go ahead and do that here too if that makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, as we remove more code we should incrementally delete it from @packages/ui-components. We can't get rid of all that package, since some of it is used in the reporter, but we can get close. The remainder of the components could probably just get collapsed into reporter.

where: availableEditors[4],
...file,
})
expect(getRunner().emit).to.be.calledWith('open:file:unified')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We continue to have token coverage here by asserting the correct event gets emitted, but the rest of the coverage will come from app/e2e.

@tbiethman tbiethman marked this pull request as ready for review January 28, 2022 04:44
}}>
<h3><OpenIcon />Open file in IDE</h3>
</a>
</OpenFileInIDE>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm assuming that we don't want a tooltip here either, but we do want the link styles. So this guy is a little cobbled together.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is okay for now 👍

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.

Code seems good - I didn't give this a fully expressive test locally yet, I'm guessing you gave it a pretty good try?

@@ -0,0 +1,205 @@
import _ from 'lodash'
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, definitely worth porting this - it might be a bit of work to figure out how it all works and what it does, but definitely time well spent.

})
})

describe('when user has not already set opener and opens file', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, as we remove more code we should incrementally delete it from @packages/ui-components. We can't get rid of all that package, since some of it is used in the reporter, but we can get close. The remainder of the components could probably just get collapsed into reporter.

{props.children}
</span>
</Tooltip>
<span className={props.className} onClick={() => events.emit('open:file:unified', props.fileDetails)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, I guess this could become open:file (without unified) potentially?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think so, now that we're not needing two separate communication paths. I'll get a follow up PR out to remove the old plumbing and remove the old UI component.

}}>
<h3><OpenIcon />Open file in IDE</h3>
</a>
</OpenFileInIDE>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is okay for now 👍

@tbiethman tbiethman self-assigned this Jan 28, 2022
Copy link
Contributor

@flotwig flotwig left a comment

Choose a reason for hiding this comment

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

LGTM, tested working on Linux too

@tbiethman tbiethman merged commit dbe9030 into 10.0-release Jan 31, 2022
@tbiethman tbiethman deleted the runner-e2e-round-1 branch January 31, 2022 18:06
tgriesser added a commit that referenced this pull request Feb 1, 2022
* 10.0-release:
  fix: restore @lmiller1990's changes
  feat: styling snapshots (#19972)
  fix bad merge overrides- GOOD CATCH TYLER!
  fix(unify): Updating reporter to consistently use app-provided "Preferred Editor" dialog (#19933)
  fix: move node 17 Check from Binary to CLI (#19977)
  fix: pass correct spec URL in `cypress run` on Windows (#19890)
  fix: send click event with `cy.type('{enter}')`. (#19726)
  feat: detect package manager in wizard (#19960)
  fix: refactor set specs by specPattern (#19953)
  chore: Update Chrome (beta) to 98.0.4758.74
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