Skip to content

Commit 7079a22

Browse files
astone123mschile
andauthored
internal: (studio) update e2e tests for creating new tests in studio (#32844)
Co-authored-by: Matt Schile <[email protected]>
1 parent a5dfa2a commit 7079a22

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

packages/app/cypress/e2e/studio/helper.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function launchStudio ({ specName = 'spec.cy.js', createNewTestFromSuite
3939
}
4040

4141
cy.findByTestId('studio-panel').should('be.visible')
42-
cy.findByTestId('new-test-button').should('be.visible')
42+
cy.findByTestId('create-test-button').should('be.visible')
4343
} else {
4444
cy.get('@runnable-wrapper')
4545
.findByTestId('launch-studio')
@@ -55,8 +55,12 @@ export function launchStudio ({ specName = 'spec.cy.js', createNewTestFromSuite
5555
}
5656
}
5757

58-
export function inputNewTestName (name: string = 'new-test') {
59-
cy.findByTestId('new-test-button').click()
58+
export function inputNewTestName ({ name = 'new-test', creatingNewTestFromWelcomeScreen = true }: { name?: string, creatingNewTestFromWelcomeScreen?: boolean } = {}) {
59+
if (creatingNewTestFromWelcomeScreen) {
60+
// we only need to click the new test button if we are not creating a new test from a suite or spec header
61+
cy.findByTestId('new-test-button').click()
62+
}
63+
6064
cy.findByTestId('test-name-input').type(name)
6165
cy.findByTestId('create-test-button').click()
6266

packages/app/cypress/e2e/studio/studio-navigation.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('Cypress Studio - Navigation and URL Management', () => {
4343
it('updates the AUT url when creating a new test', () => {
4444
launchStudio({ specName: 'navigation.cy.js', createNewTestFromSuite: true })
4545

46-
inputNewTestName()
46+
inputNewTestName({ creatingNewTestFromWelcomeScreen: false })
4747

4848
cy.findByTestId('aut-url-input').should('have.focus').type('cypress/e2e/navigation.html{enter}')
4949

packages/app/cypress/e2e/studio/studio-new-tests.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Cypress Studio - New Test Creation', () => {
1515
it('creates a new test from spec header', () => {
1616
launchStudio({ specName: 'spec-w-visit.cy.js', createNewTestFromSpecHeader: true })
1717

18-
inputNewTestName()
18+
inputNewTestName({ creatingNewTestFromWelcomeScreen: false })
1919

2020
cy.contains('new-test').click()
2121

@@ -128,10 +128,10 @@ describe('studio functionality', () => {
128128
it('creates a new test for a specific suite with the url already defined', () => {
129129
launchStudio({ specName: 'spec-w-visit.cy.js', createNewTestFromSuite: true })
130130

131-
// create a new test from a specific suite
132-
cy.findByTestId('create-new-test-from-suite').click()
131+
inputNewTestName({ creatingNewTestFromWelcomeScreen: false })
133132

134-
inputNewTestName()
133+
// make sure that the visit has run and we're recording studio commands
134+
cy.get('[data-cy="record-button-recording"]').should('be.visible')
135135

136136
cy.percySnapshot()
137137

0 commit comments

Comments
 (0)