|
| 1 | +import type { fixtureDirs } from '@tooling/system-tests' |
| 2 | + |
| 3 | +type ProjectDirs = typeof fixtureDirs |
| 4 | + |
| 5 | +const PROJECTS: {projectName: ProjectDirs[number], test: string}[] = [ |
| 6 | + { projectName: 'angular-14', test: 'app.component' }, |
| 7 | + { projectName: 'vueclivue2-configured', test: 'HelloWorld.cy' }, |
| 8 | + { projectName: 'react-vite-ts-configured', test: 'App.cy' }, |
| 9 | + { projectName: 'react18', test: 'App.cy' }, |
| 10 | + { projectName: 'create-react-app-configured', test: 'App.cy' }, |
| 11 | + { projectName: 'vueclivue3-configured', test: 'HelloWorld.cy' }, |
| 12 | + { projectName: 'nuxtjs-vue2-configured', test: 'Tutorial.cy' }, |
| 13 | +] |
| 14 | + |
| 15 | +// TODO: Add these tests to another cy-in-cy framework test to reduce CI cost as these scaffolding is expensive |
| 16 | +for (const { projectName, test } of PROJECTS) { |
| 17 | + describe(`CT Mount ${projectName}`, { viewportWidth: 1500, defaultCommandTimeout: 30000 }, () => { |
| 18 | + beforeEach(() => { |
| 19 | + cy.scaffoldProject(projectName) |
| 20 | + cy.findBrowsers() |
| 21 | + }), |
| 22 | + it(`While hovering on Mount(), shows component on AUT for ${projectName}`, () => { |
| 23 | + if (`${projectName}` === 'react18') { |
| 24 | + cy.openProject(projectName, ['--config-file', 'cypress-vite.config.ts']) |
| 25 | + cy.startAppServer('component') |
| 26 | + cy.visitApp() |
| 27 | + cy.contains(`${test}`).click() |
| 28 | + cy.waitForSpecToFinish() |
| 29 | + cy.get('.collapsible-header-inner:first').click().get('.command.command-name-mount > .command-wrapper').click().then(() => { |
| 30 | + cy.get('iframe.aut-iframe').its('0.contentDocument.body').then(cy.wrap).within(() => { |
| 31 | + cy.get('[data-cy-root]').children().should('have.length.at.least', 1) |
| 32 | + }) |
| 33 | + }) |
| 34 | + } else { |
| 35 | + cy.openProject(projectName) |
| 36 | + cy.startAppServer('component') |
| 37 | + cy.visitApp() |
| 38 | + cy.contains(`${test}`).click() |
| 39 | + cy.waitForSpecToFinish() |
| 40 | + cy.get('.command.command-name-mount > .command-wrapper').click().then(() => { |
| 41 | + if (`${projectName}` === 'angular-14') { |
| 42 | + cy.get('iframe.aut-iframe').its('0.contentDocument.body').children().should('have.length.at.least', 2) |
| 43 | + } else { |
| 44 | + cy.get('iframe.aut-iframe').its('0.contentDocument.body').then(cy.wrap).within(() => { |
| 45 | + cy.get('[data-cy-root]').children().should('have.length.at.least', 1) |
| 46 | + }) |
| 47 | + } |
| 48 | + }) |
| 49 | + } |
| 50 | + }) |
| 51 | + }) |
| 52 | +} |
0 commit comments