Skip to content

Commit

Permalink
chore: update tests to skip the welcome screen on launchpad tests. (#…
Browse files Browse the repository at this point in the history
…30240)

* chore: update tests to skip the welcome screen on launchpad tests.

* empty commit

* Fix some tests

* Fix another test
  • Loading branch information
jennifer-shehane committed Sep 23, 2024
1 parent 954cc50 commit 88900e7
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 125 deletions.
23 changes: 20 additions & 3 deletions packages/frontend-shared/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ declare global {
/**
* Visits the Cypress launchpad
*/
visitLaunchpad(href?: string): Chainable<AUTWindow>
visitLaunchpad: typeof visitLaunchpad
/**
* Skips the welcome screen of the launchpad
*/
Expand Down Expand Up @@ -384,15 +384,32 @@ function specsPageIsVisible (specsSetup) {
return cy.get('[data-cy=spec-list-container]').should('be.visible')
}

function visitLaunchpad () {
return logInternal(`visitLaunchpad ${Cypress.env('e2e_launchpadPort')}`, () => {
function visitLaunchpad (options: { showWelcome?: boolean } = { showWelcome: false }) {
function launchpadVisit () {
return cy.visit(`/__launchpad/index.html`, { log: false }).then((val) => {
return cy.get('[data-e2e]', { timeout: 10000, log: false }).then(() => {
return cy.get('.spinner', { timeout: 10000, log: false }).should('not.exist').then(() => {
return val
})
})
})
}

return logInternal(`visitLaunchpad ${Cypress.env('e2e_launchpadPort')}`, () => {
if (!options.showWelcome) {
return cy.withCtx(async (ctx, o) => {
// avoid re-stubbing already stubbed prompts in case we call getPreferences multiple times
if ((ctx._apis.localSettingsApi.getPreferences as any).wrappedMethod === undefined) {
o.sinon.stub(ctx._apis.localSettingsApi, 'getPreferences').resolves({ majorVersionWelcomeDismissed: {
[13]: Date.now(),
} })
}
}).then(() => {
return launchpadVisit()
})
}

return launchpadVisit()
})
}

Expand Down
15 changes: 0 additions & 15 deletions packages/launchpad/cypress/e2e/choose-a-browser.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--browser', 'edge'])
cy.visitLaunchpad()

cy.skipWelcome()
cy.get('[data-cy=card]').then(($buttons) => {
$buttons[0].click()
})
Expand All @@ -44,7 +43,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e', '--browser', 'edge'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand All @@ -64,7 +62,6 @@ describe('Choose a browser page', () => {

cy.openProject('launchpad', ['--e2e', '--browser', 'doesNotExist'])
cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')
cy.get('[data-cy="alert-header"]').should('contain', 'Warning: Browser Not Found')
Expand All @@ -91,7 +88,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e', '--browser', path])

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand Down Expand Up @@ -126,7 +122,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand All @@ -143,7 +138,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand Down Expand Up @@ -196,7 +190,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand All @@ -221,7 +214,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand All @@ -239,8 +231,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.withCtx((ctx) => {
ctx.actions.app.setBrowserStatus('open')
})
Expand All @@ -256,7 +246,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.withCtx((ctx) => {
ctx.actions.app.setBrowserStatus('open')
Expand Down Expand Up @@ -297,7 +286,6 @@ describe('Choose a browser page', () => {
})

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand All @@ -310,7 +298,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand Down Expand Up @@ -342,7 +329,6 @@ describe('Choose a browser page', () => {
it('should return to welcome screen if user modifies the config file to not include the current testing type and recover', () => {
cy.openProject('launchpad', ['--e2e'])
cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand Down Expand Up @@ -380,7 +366,6 @@ describe('Choose a browser page', () => {
cy.openProject('launchpad', ['--e2e'])

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('h1').should('contain', 'Choose a browser')

Expand Down
20 changes: 0 additions & 20 deletions packages/launchpad/cypress/e2e/config-files-error-handling.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Config files error handling', () => {
// Reopen the project, now that we have 2 config files
cy.openProject('pristine-with-e2e-testing')
cy.visitLaunchpad()
cy.skipWelcome()

cy.get('body').should('contain.text', 'Could not load a Cypress configuration file because there are multiple matches')
expectStackToBe('closed')
Expand All @@ -45,7 +44,6 @@ describe('Config files error handling', () => {
cy.openProject('pristine-with-e2e-testing')

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('body').should('contain.text', defaultMessages.migration.wizard.title.replace('{version}', pkg.version.split('.')[0]))
cy.get('body').should('contain.text', defaultMessages.migration.wizard.description)
Expand All @@ -59,7 +57,6 @@ describe('Config files error handling', () => {

cy.openProject('pristine-with-e2e-testing')
cy.visitLaunchpad()
cy.skipWelcome()

cy.contains('p', 'There is both a cypress.config.js and a cypress.json file at the location below:')
cy.contains('body', 'Cypress no longer supports cypress.json')
Expand All @@ -83,7 +80,6 @@ describe('Config files error handling', () => {
cy.openProject('pristine')

cy.visitLaunchpad()
cy.skipWelcome()
cy.get('[data-cy-testingType=e2e]').click()
cy.get('body', { timeout: 10000 }).should('contain.text', 'experimentalComponentTesting')
expectStackToBe('closed')
Expand All @@ -102,7 +98,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('plugins-root-sync-error')
cy.openProject('plugins-root-sync-error', ['--e2e'])
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
expectStackToBe('open')
})
Expand All @@ -111,7 +106,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('plugins-root-syntax-error')
cy.openProject('plugins-root-syntax-error', ['--e2e'])
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
expectStackToBe('open')
})
Expand All @@ -120,7 +114,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('plugins-root-async-error')
cy.openProject('plugins-root-async-error', ['--e2e'])
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', 'Unexpected Error', { timeout: 10000 })
expectStackToBe('open')
})
Expand All @@ -129,7 +122,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('plugins-function-sync-error')
cy.openProject('plugins-function-sync-error', ['--e2e'])
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
expectStackToBe('open')
})
Expand All @@ -138,7 +130,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('config-with-invalid-browser')
cy.openProject('config-with-invalid-browser', ['--e2e'])
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
expectStackToBe('closed')
})
Expand All @@ -147,7 +138,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('plugins-function-sync-error')
cy.openProject('plugins-function-sync-error', ['--e2e'])
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
expectStackToBe('open')
})
Expand All @@ -156,7 +146,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('config-with-ts-syntax-error')
cy.openProject('config-with-ts-syntax-error')
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })

cy.findAllByTestId('collapsible').should('be.visible')
Expand All @@ -179,7 +168,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('config-with-ts-syntax-error')
cy.openProject('config-with-ts-syntax-error')
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })

// Try again while the config is still invalid
Expand All @@ -203,7 +191,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('config-with-import-error')
cy.openProject('config-with-import-error')
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
cy.findAllByTestId('collapsible').should('be.visible')
cy.contains('h2', 'Error')
Expand All @@ -218,7 +205,6 @@ describe('Launchpad: Error System Tests', () => {
cy.scaffoldProject('config-with-ts-module-error')
cy.openProject('config-with-ts-module-error')
cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
cy.findAllByTestId('collapsible').should('be.visible')
cy.contains('h2', 'TSError')
Expand All @@ -234,7 +220,6 @@ describe('setupNodeEvents', () => {
cy.scaffoldProject('config-update-non-migrated-value')
cy.openProject('config-update-non-migrated-value')
cy.visitLaunchpad()
cy.skipWelcome()
cy.findByText('E2E Testing').click()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
cy.findAllByTestId('collapsible').should('be.visible')
Expand All @@ -247,7 +232,6 @@ describe('setupNodeEvents', () => {
cy.scaffoldProject('config-update-non-migrated-value-clone')
cy.openProject('config-update-non-migrated-value-clone')
cy.visitLaunchpad()
cy.skipWelcome()
cy.findByText('E2E Testing').click()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
cy.percySnapshot()
Expand All @@ -259,7 +243,6 @@ describe('setupNodeEvents', () => {
cy.scaffoldProject('config-update-non-migrated-value-e2e')
cy.openProject('config-update-non-migrated-value-e2e')
cy.visitLaunchpad()
cy.skipWelcome()
cy.findByText('E2E Testing').click()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
cy.percySnapshot()
Expand All @@ -284,7 +267,6 @@ describe('setupNodeEvents', () => {
cy.openProject('pristine')

cy.visitLaunchpad()
cy.skipWelcome()
cy.get('[data-cy-testingType=e2e]').click()
cy.get('body', { timeout: 10000 }).should('contain.text', 'testFiles')
cy.get('body', { timeout: 10000 }).should('contain.text', 'setupNodeEvents')
Expand All @@ -308,7 +290,6 @@ describe('setupNodeEvents', () => {
cy.openProject('pristine')

cy.visitLaunchpad()
cy.skipWelcome()
cy.contains('h1', cy.i18n.launchpadErrors.generic.configErrorTitle, { timeout: 10000 })
cy.get('[data-cy="alert-body"]').should('contain', 'Expected baseUrl to be a fully qualified URL')

Expand Down Expand Up @@ -337,7 +318,6 @@ describe('setupNodeEvents', () => {
cy.openProject('dev-server-invalid')

cy.visitLaunchpad()
cy.skipWelcome()

cy.get('[data-cy-testingtype=component]').click()

Expand Down
Loading

5 comments on commit 88900e7

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88900e7 Sep 23, 2024

Choose a reason for hiding this comment

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

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/linux-x64/develop-88900e79a4bc732368b1b3f1c2531755a43d849e/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88900e7 Sep 23, 2024

Choose a reason for hiding this comment

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

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/linux-arm64/develop-88900e79a4bc732368b1b3f1c2531755a43d849e/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88900e7 Sep 23, 2024

Choose a reason for hiding this comment

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

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/win32-x64/develop-88900e79a4bc732368b1b3f1c2531755a43d849e/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88900e7 Sep 23, 2024

Choose a reason for hiding this comment

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

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/darwin-arm64/develop-88900e79a4bc732368b1b3f1c2531755a43d849e/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 88900e7 Sep 23, 2024

Choose a reason for hiding this comment

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

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/darwin-x64/develop-88900e79a4bc732368b1b3f1c2531755a43d849e/cypress.tgz

Please sign in to comment.