-
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: Hovering over mount in command log does not show component in AUT #24346
Changes from 9 commits
e359492
256ea39
07773af
6f868cb
b4977ed
112b87d
7ac78a3
4262b44
e6b204e
86e2f3a
7437c81
d9aacfd
dd03ac2
1434296
c8362ba
02d867d
59a6c20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { fixtureDirs } from '@tooling/system-tests' | ||
|
||
type ProjectDirs = typeof fixtureDirs | ||
|
||
const PROJECTS: {projectName: ProjectDirs[number], test: string}[] = [ | ||
{ projectName: 'angular-15', test: 'app.component' }, | ||
amehta265 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ projectName: 'vueclivue2-configured', test: 'HelloWorld.cy' }, | ||
{ projectName: 'react-vite-ts-configured', test: 'App.cy' }, | ||
{ projectName: 'react18', test: 'App.cy' }, | ||
{ projectName: 'create-react-app-configured', test: 'App.cy' }, | ||
{ projectName: 'vueclivue3-configured', test: 'HelloWorld.cy' }, | ||
{ projectName: 'nuxtjs-vue2-configured', test: 'Tutorial.cy' }, | ||
] | ||
|
||
for (const { projectName, test } of PROJECTS) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tests are very thorough, and I know this is already ✔️ , but I wonder if we want to consider adding these to an existing test in the future? Scaffolding all these projects is pretty expensive (in terms of CI time) for something that could be exercised in one of the other tests we've got for the various frameworks. |
||
describe(`CT Mount ${projectName}`, { viewportWidth: 1500, defaultCommandTimeout: 10000 }, () => { | ||
beforeEach(() => { | ||
cy.scaffoldProject(projectName) | ||
cy.findBrowsers() | ||
}), | ||
it(`While hovering on Mount(), shows component on AUT for ${projectName}`, () => { | ||
if (`${projectName}` === 'react18') { | ||
cy.openProject(projectName, ['--config-file', 'cypress-vite.config.ts']) | ||
cy.startAppServer('component') | ||
cy.visitApp() | ||
cy.contains(`${test}`).click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.collapsible-header-inner:first').click().get('.command.command-name-mount > .command-wrapper').click().then(() => { | ||
cy.get('iframe.aut-iframe').its('0.contentDocument.body').then(cy.wrap).within(() => { | ||
amehta265 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cy.get('[data-cy-root]').children().should('have.length.at.least', 1) | ||
}) | ||
}) | ||
} else { | ||
cy.openProject(projectName) | ||
cy.startAppServer('component') | ||
cy.visitApp() | ||
cy.contains(`${test}`).click() | ||
cy.waitForSpecToFinish() | ||
cy.get('.command.command-name-mount > .command-wrapper').click().then(() => { | ||
if (`${projectName}` === 'angular-15') { | ||
cy.get('iframe.aut-iframe').its('0.contentDocument.body').children().should('have.length.at.least', 2) | ||
} else { | ||
cy.get('iframe.aut-iframe').its('0.contentDocument.body').then(cy.wrap).within(() => { | ||
cy.get('[data-cy-root]').children().should('have.length.at.least', 1) | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
}) | ||
} |
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'd expect the
nextTick
to be wrapped within the chain so as to ensure the tick and log is captured before the next Cypress command is fired. You could convert this function to be async andawait Vue.nextTick()
as the end.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 am not sure we need async/await - could just do it like this, right?
If anyone was curious, under-the-hood
nextTick
is basically justPromise.resolve
(with various fallbacks). It actually usesMutationObserver
as a fallback, interestingly enough.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.
As long as the
.then(() => Vue.nextTick())
is done after the component creation I'm cool with 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.
This sounds good. I've made the necessary changes on the latest commit