test: add "cypress-in-cypress" tests for navigating in and out of spec runner (#19845)

Co-authored-by: Barthélémy Ledoux <bart@cypress.io>
This commit is contained in:
Mark Noonan
2022-01-26 10:22:11 -05:00
committed by GitHub
parent f1bc084a6d
commit 5ff647e364
2 changed files with 52 additions and 4 deletions

View File

@@ -1,9 +1,14 @@
describe('Cypress In Cypress', () => {
it('test component', () => {
import defaultMessages from '@packages/frontend-shared/src/locales/en-US.json'
describe('Cypress In Cypress', { viewportWidth: 1200 }, () => {
beforeEach(() => {
cy.scaffoldProject('cypress-in-cypress')
cy.openProject('cypress-in-cypress')
cy.startAppServer('component')
cy.visitApp()
})
it('test component', () => {
cy.contains('TestComponent.spec').click()
cy.location().should((location) => {
expect(location.hash).to.contain('TestComponent.spec')
@@ -11,4 +16,23 @@ describe('Cypress In Cypress', () => {
cy.get('[data-model-state="passed"]').should('contain', 'renders the test component')
})
it('navigation between specs and other parts of the app works', () => {
cy.contains('TestComponent.spec').click()
cy.get('[data-model-state="passed"]').should('contain', 'renders the test component')
// go to Settings page and back to spec runner
cy.contains('a', 'Settings').click()
cy.contains(defaultMessages.settingsPage.device.title).should('be.visible')
cy.contains('a', 'Specs').click()
cy.contains('TestComponent.spec').click()
cy.get('[data-model-state="passed"]').should('contain', 'renders the test component')
// go to Runs page and back to spec runner
cy.contains('a', 'Runs').click()
cy.contains(defaultMessages.runs.connect.title).should('be.visible')
cy.contains('a', 'Specs').click()
cy.contains('TestComponent.spec').click()
cy.get('[data-model-state="passed"]').should('contain', 'renders the test component')
})
})

View File

@@ -1,9 +1,14 @@
describe('Cypress In Cypress', () => {
it('test e2e', () => {
import defaultMessages from '@packages/frontend-shared/src/locales/en-US.json'
describe('Cypress In Cypress', { viewportWidth: 1200 }, () => {
beforeEach(() => {
cy.scaffoldProject('cypress-in-cypress')
cy.openProject('cypress-in-cypress')
cy.startAppServer()
cy.visitApp()
})
it('test e2e', () => {
cy.contains('dom-content.spec').click()
cy.location().should((location) => {
expect(location.hash).to.contain('dom-content.spec')
@@ -11,4 +16,23 @@ describe('Cypress In Cypress', () => {
cy.get('[data-model-state="passed"]').should('contain', 'renders the test content')
})
it('navigation between specs and other parts of the app works', () => {
cy.contains('dom-content.spec').click()
cy.get('[data-model-state="passed"]').should('contain', 'renders the test content')
// go to Settings page and back to spec runner
cy.contains('a', 'Settings').click()
cy.contains(defaultMessages.settingsPage.device.title).should('be.visible')
cy.contains('a', 'Specs').click()
cy.contains('dom-content.spec').click()
cy.get('[data-model-state="passed"]').should('contain', 'renders the test content')
// go to Runs page and back to spec runner
cy.contains('a', 'Runs').click()
cy.contains(defaultMessages.runs.connect.title).should('be.visible')
cy.contains('a', 'Specs').click()
cy.contains('dom-content.spec').click()
cy.get('[data-model-state="passed"]').should('contain', 'renders the test content')
})
})