-
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
test(launchpad): add e2e tests for Project Setup - Round 2 #19580
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
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 |
@@ -320,27 +321,33 @@ export class ProjectLifecycleManager { | |||
return | |||
} | |||
|
|||
if (!this.metaState.hasValidConfigFile) { | |||
if (testingType === 'e2e' && !this.ctx.isRunMode) { | |||
this.ctx.actions.wizard.scaffoldTestingType().catch(this.onLoadError) |
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 assume that we need to add in a graceful error message for users that hit this when in run mode.
…ct, and open configured test type works without lifecyle updates
@@ -85,7 +85,6 @@ export class ProjectActions { | |||
|
|||
async setCurrentProject (projectRoot: string) { | |||
await this.clearCurrentProject() |
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.clearCurrentProject()
already calls this.ctx.lifecycleManager.clearCurrentProject()
: https://github.com/cypress-io/cypress/pull/19580/files#diff-d36f6626bf805d1bbbfba4786ca3a518f0083613a9814fd037c5592808949606L56
it('welcome page has "learn about testing types" link which opens modal', () => { | ||
cy.contains('Review the differences').click() | ||
cy.get('#app').should('have.attr', 'aria-hidden', 'true') | ||
cy.contains('Key Differences').should('be.visible') |
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.
You can get a tighter assertion by doing something like:
cy.findByRole('dialog', { name: 'Key Differences' }.within(() => {
// assert scoped dialog content here
})
It'd be nice to dry up things like the app being hidden when a dialog is open and other common dialog behaviors (like the ever-present "Need help?" link). Custom command maybe? Not necessary to change here but worth some thinking.
cy.getDialog({ name: '...', rootSelector: '#app' }) // asserts aria state common dialog features -> returns dialog element
cy.getDialog({
name: '...',
rootSelector: '#app',
reopen: () => {
cy.click('#launch') // Might even be able to optionally run through the dismissal flows if we provide a way to re-present it
}
})
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.
Good point. I was finding cy.contains would match a model on the dom even if it wasn't open. I'll make the updates.
@@ -2,3 +2,4 @@ | |||
require('../../../../frontend-shared/cypress/e2e/support/e2eSupport') | |||
|
|||
require('./dropFileWithPath') | |||
require('cypress-plugin-tab') |
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.
👀 did some reading about this, interesting. We've also recommended https://github.com/dmtrKovalenko/cypress-real-events previously, but there's no firefox support there
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...We have is issue logged #299 in the backlog for tab support so hopefully we can implement & provide first-class support soon.
Test Cases:
Project Setup (never setup e2e or CT before)
E2E Project Setup (Existing Project, Migrated, w/o E2E Configured)
cypress open --e2e
with no initial setup detected will launch into the project in e2e showing the first step in configuratione2e Configured Files (never having setup E2E before)
component Project Setup (never having setup CT before)
cypress open --component
with no initial setup detected will launch into the project in component showing 'choose framework' pageUser facing changelog
n/a
PR Tasks
[n/a ] 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?