-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Conversation
Migrating helpers and initial tests to app from existing runner specs
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ FlakinessThis 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 |
@@ -0,0 +1,205 @@ | |||
import _ from 'lodash' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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', () => { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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.
}}> | ||
<h3><OpenIcon />Open file in IDE</h3> | ||
</a> | ||
</OpenFileInIDE> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 👍
There was a problem hiding this 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' |
There was a problem hiding this comment.
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', () => { |
There was a problem hiding this comment.
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)}> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 👍
There was a problem hiding this 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
* 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
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:
After:
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?