diff --git a/packages/app/cypress/e2e/studio/helper.ts b/packages/app/cypress/e2e/studio/helper.ts index b49c796278f..3c056321af5 100644 --- a/packages/app/cypress/e2e/studio/helper.ts +++ b/packages/app/cypress/e2e/studio/helper.ts @@ -39,7 +39,7 @@ export function launchStudio ({ specName = 'spec.cy.js', createNewTestFromSuite } cy.findByTestId('studio-panel').should('be.visible') - cy.findByTestId('new-test-button').should('be.visible') + cy.findByTestId('create-test-button').should('be.visible') } else { cy.get('@runnable-wrapper') .findByTestId('launch-studio') @@ -55,8 +55,12 @@ export function launchStudio ({ specName = 'spec.cy.js', createNewTestFromSuite } } -export function inputNewTestName (name: string = 'new-test') { - cy.findByTestId('new-test-button').click() +export function inputNewTestName ({ name = 'new-test', creatingNewTestFromWelcomeScreen = true }: { name?: string, creatingNewTestFromWelcomeScreen?: boolean } = {}) { + if (creatingNewTestFromWelcomeScreen) { + // we only need to click the new test button if we are not creating a new test from a suite or spec header + cy.findByTestId('new-test-button').click() + } + cy.findByTestId('test-name-input').type(name) cy.findByTestId('create-test-button').click() diff --git a/packages/app/cypress/e2e/studio/studio-navigation.cy.ts b/packages/app/cypress/e2e/studio/studio-navigation.cy.ts index e7bf565edf8..232f267778c 100644 --- a/packages/app/cypress/e2e/studio/studio-navigation.cy.ts +++ b/packages/app/cypress/e2e/studio/studio-navigation.cy.ts @@ -43,7 +43,7 @@ describe('Cypress Studio - Navigation and URL Management', () => { it('updates the AUT url when creating a new test', () => { launchStudio({ specName: 'navigation.cy.js', createNewTestFromSuite: true }) - inputNewTestName() + inputNewTestName({ creatingNewTestFromWelcomeScreen: false }) cy.findByTestId('aut-url-input').should('have.focus').type('cypress/e2e/navigation.html{enter}') diff --git a/packages/app/cypress/e2e/studio/studio-new-tests.cy.ts b/packages/app/cypress/e2e/studio/studio-new-tests.cy.ts index 978c1d0445e..ea56d162cda 100644 --- a/packages/app/cypress/e2e/studio/studio-new-tests.cy.ts +++ b/packages/app/cypress/e2e/studio/studio-new-tests.cy.ts @@ -15,7 +15,7 @@ describe('Cypress Studio - New Test Creation', () => { it('creates a new test from spec header', () => { launchStudio({ specName: 'spec-w-visit.cy.js', createNewTestFromSpecHeader: true }) - inputNewTestName() + inputNewTestName({ creatingNewTestFromWelcomeScreen: false }) cy.contains('new-test').click() @@ -128,10 +128,10 @@ describe('studio functionality', () => { it('creates a new test for a specific suite with the url already defined', () => { launchStudio({ specName: 'spec-w-visit.cy.js', createNewTestFromSuite: true }) - // create a new test from a specific suite - cy.findByTestId('create-new-test-from-suite').click() + inputNewTestName({ creatingNewTestFromWelcomeScreen: false }) - inputNewTestName() + // make sure that the visit has run and we're recording studio commands + cy.get('[data-cy="record-button-recording"]').should('be.visible') cy.percySnapshot()