From 06761eeb9e8b20225dc671708d8acee2c508ea66 Mon Sep 17 00:00:00 2001 From: Manuel-Suarez-Abascal Date: Mon, 26 Dec 2022 07:01:39 -0500 Subject: [PATCH 1/6] fix: change wording for spec creation --- packages/app/cypress/e2e/specs.cy.ts | 12 ++++++------ packages/app/cypress/e2e/specs_list_component.cy.ts | 4 ++-- packages/app/cypress/e2e/specs_list_e2e.cy.ts | 12 ++++++------ packages/app/src/specs/CreateSpecModal.cy.tsx | 2 +- packages/frontend-shared/src/locales/en-US.json | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/app/cypress/e2e/specs.cy.ts b/packages/app/cypress/e2e/specs.cy.ts index 6fbcce550edc..04546610d19f 100644 --- a/packages/app/cypress/e2e/specs.cy.ts +++ b/packages/app/cypress/e2e/specs.cy.ts @@ -408,7 +408,7 @@ describe('App: Specs', () => { .and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header) }) - cy.contains('Create new empty spec').click() + cy.contains('Create starter spec').click() cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) .as('enterSpecInput') @@ -458,7 +458,7 @@ describe('App: Specs', () => { cy.contains('No specs found').should('be.visible') cy.findByRole('button', { name: 'New spec' }).click() - cy.contains('Create new empty spec').click() + cy.contains('Create starter spec').click() cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) .as('enterSpecInput') @@ -484,7 +484,7 @@ describe('App: Specs', () => { .and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header) }) - cy.contains('Create new empty spec').click() + cy.contains('Create starter spec').click() cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) .as('enterSpecInput') @@ -544,11 +544,11 @@ describe('App: Specs', () => { cy.findAllByTestId('card').eq(1).as('EmptyCard') }) - it('shows create new empty spec card', () => { + it('shows Create starter spec card', () => { cy.get('@EmptyCard') .within(() => { cy.findByRole('button', { - name: 'Create new empty spec', + name: 'Create starter spec', }).should('be.visible') .and('not.be.disabled') }) @@ -593,7 +593,7 @@ describe('App: Specs', () => { cy.findByRole('button', { name: 'Create another spec' }).click() }) - // 'Create a new spec' dialog presents with options when user indicates they want to create + // 'Create starter spec' dialog presents with options when user indicates they want to create // another spec. cy.findAllByTestId('card').should('have.length', 2) cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible') diff --git a/packages/app/cypress/e2e/specs_list_component.cy.ts b/packages/app/cypress/e2e/specs_list_component.cy.ts index de3f9b3163cd..af8aaae6f5d9 100644 --- a/packages/app/cypress/e2e/specs_list_component.cy.ts +++ b/packages/app/cypress/e2e/specs_list_component.cy.ts @@ -31,7 +31,7 @@ describe('App: Spec List (Component)', () => { cy.get('[data-selected-spec="false"]').should('contain', 'foo') }) - it('opens the "Create a new spec" modal after clicking the "New specs" button', () => { + it('opens the "Create starter spec" modal after clicking the "New specs" button', () => { cy.get('[data-cy="standard-modal"]').should('not.exist') cy.get('[data-cy="new-spec-button"]').click() cy.get('[data-cy="standard-modal"]').get('h2').contains('Enter the path for your new spec') @@ -39,7 +39,7 @@ describe('App: Spec List (Component)', () => { cy.get('[data-cy="standard-modal"]').should('not.exist') }) - it('has the correct defaultSpecFileName in the "Create a new spec" modal', () => { + it('has the correct defaultSpecFileName in the "Create starter spec" modal', () => { cy.findByTestId('standard-modal').should('not.exist') cy.findByTestId('new-spec-button').click() cy.get('input').get('[aria-label="Enter a relative path..."]').invoke('val').should('contain', getPathForPlatform('cypress/component-tests/ComponentName.spec.js')) diff --git a/packages/app/cypress/e2e/specs_list_e2e.cy.ts b/packages/app/cypress/e2e/specs_list_e2e.cy.ts index ba8279d2460e..bfe63a0dc6d2 100644 --- a/packages/app/cypress/e2e/specs_list_e2e.cy.ts +++ b/packages/app/cypress/e2e/specs_list_e2e.cy.ts @@ -85,22 +85,22 @@ describe('App: Spec List (E2E)', () => { cy.findAllByTestId('spec-item').should('contain', 'dom-content.spec.js') }) - it('opens the "Create a new spec" modal after clicking the "New specs" button', () => { + it('opens the "Create starter spec" modal after clicking the "New specs" button', () => { cy.findByTestId('standard-modal').should('not.exist') cy.findByTestId('new-spec-button').click() - cy.findByTestId('standard-modal').get('h2').contains('Create a new spec') + cy.findByTestId('standard-modal').get('h2').contains('Create starter spec') cy.get('button').contains('Scaffold example specs').should('be.visible') - cy.get('button').contains('Create new empty spec').should('be.visible') + cy.get('button').contains('Create starter spec').should('be.visible') cy.get('button').get('[aria-label="Close"]').click() cy.findByTestId('standard-modal').should('not.exist') }) - it('has the correct defaultSpecFileName in the "Create a new spec" modal', () => { + it('has the correct defaultSpecFileName in the "Create starter spec" modal', () => { cy.findByTestId('standard-modal').should('not.exist') cy.findByTestId('new-spec-button').click() - cy.findByTestId('standard-modal').get('h2').contains('Create a new spec') + cy.findByTestId('standard-modal').get('h2').contains('Create starter spec') cy.get('button').contains('Scaffold example specs').should('be.visible') - cy.get('button').contains('Create new empty spec').should('be.visible').click() + cy.get('button').contains('Create starter spec').should('be.visible').click() cy.get('input').get('[aria-label="Enter a relative path..."]').invoke('val').should('contain', getPathForPlatform('cypress/e2e/spec.spec.js')) cy.get('button').get('[aria-label="Close"]').click() }) diff --git a/packages/app/src/specs/CreateSpecModal.cy.tsx b/packages/app/src/specs/CreateSpecModal.cy.tsx index bc3d161b1709..2c84aa95fa6e 100644 --- a/packages/app/src/specs/CreateSpecModal.cy.tsx +++ b/packages/app/src/specs/CreateSpecModal.cy.tsx @@ -296,7 +296,7 @@ describe('defaultSpecFileName', () => { }, }) - cy.findByText('Create new empty spec').click() + cy.findByText('Create starter spec').click() cy.get('input').invoke('val').should('contain', 'spec.cy.js') cy.percySnapshot() diff --git a/packages/frontend-shared/src/locales/en-US.json b/packages/frontend-shared/src/locales/en-US.json index 43025405e02c..ab2a1dea4ed2 100644 --- a/packages/frontend-shared/src/locales/en-US.json +++ b/packages/frontend-shared/src/locales/en-US.json @@ -64,7 +64,7 @@ "noComponentsFound": "No components found", "unableToParseFile": "Unable to parse file", "updateSpecPattern": "Update spec pattern", - "newSpecModalTitle": "Create a new spec", + "newSpecModalTitle": "Create starter spec", "successPage": { "header": "Great! The spec was successfully added", "runSpecButton": "Okay, run the spec", @@ -96,8 +96,8 @@ "specsAddingHeader": "Adding specs..." }, "importEmptySpec": { - "header": "Create new empty spec", - "description": "We'll generate an empty spec file which can be used to start testing your application.", + "header": "Create starter spec", + "description": "We'll generate a starter spec file which can be used to start testing your application.", "chooseFilenameHeader": "Enter the path for your new spec", "inputPlaceholder": "Enter a relative path...", "invalidSpecWarning": "This path is invalid because it doesn't match the following ", @@ -111,8 +111,8 @@ "chooseAComponentHeader": "Choose a component" }, "importEmptySpec": { - "header": "Create a new spec", - "description": "We'll generate an empty spec file to start testing components.", + "header": "Create starter spec", + "description": "We'll generate a starter spec file to start testing components.", "invalidComponentWarning": "We couldn't generate a valid path matching your custom " } } From 5bb2c8d256430fceb37088119480f7c3990c0423 Mon Sep 17 00:00:00 2001 From: Manuel-Suarez-Abascal Date: Mon, 26 Dec 2022 07:41:55 -0500 Subject: [PATCH 2/6] fix: refactor test files --- npm/webpack-dev-server/cypress/e2e/react.cy.ts | 2 +- packages/app/cypress/e2e/specs.cy.ts | 4 ++-- packages/app/src/specs/CreateSpecModal.cy.tsx | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/npm/webpack-dev-server/cypress/e2e/react.cy.ts b/npm/webpack-dev-server/cypress/e2e/react.cy.ts index d3def96214ca..8612ec9e3879 100644 --- a/npm/webpack-dev-server/cypress/e2e/react.cy.ts +++ b/npm/webpack-dev-server/cypress/e2e/react.cy.ts @@ -129,7 +129,7 @@ for (const project of WEBPACK_REACT) { // 4. recreate spec, with same name as removed spec cy.findByTestId('new-spec-button').click() - cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() cy.findByRole('dialog').within(() => { cy.get('input').clear().type('src/App.cy.jsx') diff --git a/packages/app/cypress/e2e/specs.cy.ts b/packages/app/cypress/e2e/specs.cy.ts index 04546610d19f..d42149925c2f 100644 --- a/packages/app/cypress/e2e/specs.cy.ts +++ b/packages/app/cypress/e2e/specs.cy.ts @@ -527,7 +527,7 @@ describe('App: Specs', () => { function selectEmptySpecCard () { cy.findAllByTestId('card').should('have.length', 2) cy.findByRole('button', { name: 'Create from component' }).should('be.visible') - cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() } describe('Testing Type: Component', { @@ -596,7 +596,7 @@ describe('App: Specs', () => { // 'Create starter spec' dialog presents with options when user indicates they want to create // another spec. cy.findAllByTestId('card').should('have.length', 2) - cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible') + cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible') cy.findByRole('button', { name: 'Create from component' }).should('be.visible') }) diff --git a/packages/app/src/specs/CreateSpecModal.cy.tsx b/packages/app/src/specs/CreateSpecModal.cy.tsx index 2c84aa95fa6e..58159caa857e 100644 --- a/packages/app/src/specs/CreateSpecModal.cy.tsx +++ b/packages/app/src/specs/CreateSpecModal.cy.tsx @@ -32,7 +32,7 @@ function testEmptySpecModal (fullDefaultSpecFileName: string, specName: string) describe('form behavior', () => { beforeEach(() => { - cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() }) it('enter should call create spec function', () => { @@ -68,7 +68,7 @@ function testEmptySpecModal (fullDefaultSpecFileName: string, specName: string) describe('text Input', () => { beforeEach(() => { - cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() }) it('focuses text input and selects file name by default', () => { @@ -219,7 +219,7 @@ describe('', () => { /> )) - cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() cy.focused().as('specNameInput') From f7d7f16089d51fb33785343557b5024927b1b7f5 Mon Sep 17 00:00:00 2001 From: Manuel-Suarez-Abascal Date: Tue, 27 Dec 2022 10:14:37 -0500 Subject: [PATCH 3/6] fix: address PR comments --- packages/app/src/specs/CreateSpecModal.cy.tsx | 8 ++++---- packages/frontend-shared/src/locales/en-US.json | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/app/src/specs/CreateSpecModal.cy.tsx b/packages/app/src/specs/CreateSpecModal.cy.tsx index 58159caa857e..be312d30b106 100644 --- a/packages/app/src/specs/CreateSpecModal.cy.tsx +++ b/packages/app/src/specs/CreateSpecModal.cy.tsx @@ -32,7 +32,7 @@ function testEmptySpecModal (fullDefaultSpecFileName: string, specName: string) describe('form behavior', () => { beforeEach(() => { - cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click() }) it('enter should call create spec function', () => { @@ -68,7 +68,7 @@ function testEmptySpecModal (fullDefaultSpecFileName: string, specName: string) describe('text Input', () => { beforeEach(() => { - cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click() }) it('focuses text input and selects file name by default', () => { @@ -219,7 +219,7 @@ describe('', () => { /> )) - cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click() cy.focused().as('specNameInput') @@ -296,7 +296,7 @@ describe('defaultSpecFileName', () => { }, }) - cy.findByText('Create starter spec').click() + cy.findByText('Create new spec').click() cy.get('input').invoke('val').should('contain', 'spec.cy.js') cy.percySnapshot() diff --git a/packages/frontend-shared/src/locales/en-US.json b/packages/frontend-shared/src/locales/en-US.json index ab2a1dea4ed2..83bd3cbbb5d0 100644 --- a/packages/frontend-shared/src/locales/en-US.json +++ b/packages/frontend-shared/src/locales/en-US.json @@ -64,7 +64,7 @@ "noComponentsFound": "No components found", "unableToParseFile": "Unable to parse file", "updateSpecPattern": "Update spec pattern", - "newSpecModalTitle": "Create starter spec", + "newSpecModalTitle": "Create new spec", "successPage": { "header": "Great! The spec was successfully added", "runSpecButton": "Okay, run the spec", @@ -96,8 +96,8 @@ "specsAddingHeader": "Adding specs..." }, "importEmptySpec": { - "header": "Create starter spec", - "description": "We'll generate a starter spec file which can be used to start testing your application.", + "header": "Create new spec", + "description": "We'll generate a template spec file which can be used to start testing your application.", "chooseFilenameHeader": "Enter the path for your new spec", "inputPlaceholder": "Enter a relative path...", "invalidSpecWarning": "This path is invalid because it doesn't match the following ", @@ -111,8 +111,8 @@ "chooseAComponentHeader": "Choose a component" }, "importEmptySpec": { - "header": "Create starter spec", - "description": "We'll generate a starter spec file to start testing components.", + "header": "Create new spec", + "description": "We'll generate a template spec file which can be used to start testing your components.", "invalidComponentWarning": "We couldn't generate a valid path matching your custom " } } From c96f76652738ac5680c27ecd5cdc0c8e72c4c210 Mon Sep 17 00:00:00 2001 From: Manuel-Suarez-Abascal Date: Tue, 27 Dec 2022 10:16:38 -0500 Subject: [PATCH 4/6] fix: address PR comments --- npm/webpack-dev-server/cypress/e2e/react.cy.ts | 2 +- packages/app/cypress/e2e/specs.cy.ts | 16 ++++++++-------- .../app/cypress/e2e/specs_list_component.cy.ts | 4 ++-- packages/app/cypress/e2e/specs_list_e2e.cy.ts | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/npm/webpack-dev-server/cypress/e2e/react.cy.ts b/npm/webpack-dev-server/cypress/e2e/react.cy.ts index 8612ec9e3879..049096b0c98a 100644 --- a/npm/webpack-dev-server/cypress/e2e/react.cy.ts +++ b/npm/webpack-dev-server/cypress/e2e/react.cy.ts @@ -129,7 +129,7 @@ for (const project of WEBPACK_REACT) { // 4. recreate spec, with same name as removed spec cy.findByTestId('new-spec-button').click() - cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click() cy.findByRole('dialog').within(() => { cy.get('input').clear().type('src/App.cy.jsx') diff --git a/packages/app/cypress/e2e/specs.cy.ts b/packages/app/cypress/e2e/specs.cy.ts index d42149925c2f..f5d903163f35 100644 --- a/packages/app/cypress/e2e/specs.cy.ts +++ b/packages/app/cypress/e2e/specs.cy.ts @@ -408,7 +408,7 @@ describe('App: Specs', () => { .and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header) }) - cy.contains('Create starter spec').click() + cy.contains('Create new spec').click() cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) .as('enterSpecInput') @@ -458,7 +458,7 @@ describe('App: Specs', () => { cy.contains('No specs found').should('be.visible') cy.findByRole('button', { name: 'New spec' }).click() - cy.contains('Create starter spec').click() + cy.contains('Create new spec').click() cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) .as('enterSpecInput') @@ -484,7 +484,7 @@ describe('App: Specs', () => { .and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header) }) - cy.contains('Create starter spec').click() + cy.contains('Create new spec').click() cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) .as('enterSpecInput') @@ -527,7 +527,7 @@ describe('App: Specs', () => { function selectEmptySpecCard () { cy.findAllByTestId('card').should('have.length', 2) cy.findByRole('button', { name: 'Create from component' }).should('be.visible') - cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible').click() + cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click() } describe('Testing Type: Component', { @@ -544,11 +544,11 @@ describe('App: Specs', () => { cy.findAllByTestId('card').eq(1).as('EmptyCard') }) - it('shows Create starter spec card', () => { + it('shows Create new spec card', () => { cy.get('@EmptyCard') .within(() => { cy.findByRole('button', { - name: 'Create starter spec', + name: 'Create new spec', }).should('be.visible') .and('not.be.disabled') }) @@ -593,10 +593,10 @@ describe('App: Specs', () => { cy.findByRole('button', { name: 'Create another spec' }).click() }) - // 'Create starter spec' dialog presents with options when user indicates they want to create + // 'Create new spec' dialog presents with options when user indicates they want to create // another spec. cy.findAllByTestId('card').should('have.length', 2) - cy.findByRole('button', { name: 'Create starter spec' }).should('be.visible') + cy.findByRole('button', { name: 'Create new spec' }).should('be.visible') cy.findByRole('button', { name: 'Create from component' }).should('be.visible') }) diff --git a/packages/app/cypress/e2e/specs_list_component.cy.ts b/packages/app/cypress/e2e/specs_list_component.cy.ts index af8aaae6f5d9..9a7c28aeaf8f 100644 --- a/packages/app/cypress/e2e/specs_list_component.cy.ts +++ b/packages/app/cypress/e2e/specs_list_component.cy.ts @@ -31,7 +31,7 @@ describe('App: Spec List (Component)', () => { cy.get('[data-selected-spec="false"]').should('contain', 'foo') }) - it('opens the "Create starter spec" modal after clicking the "New specs" button', () => { + it('opens the "Create new spec" modal after clicking the "New specs" button', () => { cy.get('[data-cy="standard-modal"]').should('not.exist') cy.get('[data-cy="new-spec-button"]').click() cy.get('[data-cy="standard-modal"]').get('h2').contains('Enter the path for your new spec') @@ -39,7 +39,7 @@ describe('App: Spec List (Component)', () => { cy.get('[data-cy="standard-modal"]').should('not.exist') }) - it('has the correct defaultSpecFileName in the "Create starter spec" modal', () => { + it('has the correct defaultSpecFileName in the "Create new spec" modal', () => { cy.findByTestId('standard-modal').should('not.exist') cy.findByTestId('new-spec-button').click() cy.get('input').get('[aria-label="Enter a relative path..."]').invoke('val').should('contain', getPathForPlatform('cypress/component-tests/ComponentName.spec.js')) diff --git a/packages/app/cypress/e2e/specs_list_e2e.cy.ts b/packages/app/cypress/e2e/specs_list_e2e.cy.ts index bfe63a0dc6d2..904e5939f281 100644 --- a/packages/app/cypress/e2e/specs_list_e2e.cy.ts +++ b/packages/app/cypress/e2e/specs_list_e2e.cy.ts @@ -85,22 +85,22 @@ describe('App: Spec List (E2E)', () => { cy.findAllByTestId('spec-item').should('contain', 'dom-content.spec.js') }) - it('opens the "Create starter spec" modal after clicking the "New specs" button', () => { + it('opens the "Create new spec" modal after clicking the "New specs" button', () => { cy.findByTestId('standard-modal').should('not.exist') cy.findByTestId('new-spec-button').click() - cy.findByTestId('standard-modal').get('h2').contains('Create starter spec') + cy.findByTestId('standard-modal').get('h2').contains('Create new spec') cy.get('button').contains('Scaffold example specs').should('be.visible') - cy.get('button').contains('Create starter spec').should('be.visible') + cy.get('button').contains('Create new spec').should('be.visible') cy.get('button').get('[aria-label="Close"]').click() cy.findByTestId('standard-modal').should('not.exist') }) - it('has the correct defaultSpecFileName in the "Create starter spec" modal', () => { + it('has the correct defaultSpecFileName in the "Create new spec" modal', () => { cy.findByTestId('standard-modal').should('not.exist') cy.findByTestId('new-spec-button').click() - cy.findByTestId('standard-modal').get('h2').contains('Create starter spec') + cy.findByTestId('standard-modal').get('h2').contains('Create new spec') cy.get('button').contains('Scaffold example specs').should('be.visible') - cy.get('button').contains('Create starter spec').should('be.visible').click() + cy.get('button').contains('Create new spec').should('be.visible').click() cy.get('input').get('[aria-label="Enter a relative path..."]').invoke('val').should('contain', getPathForPlatform('cypress/e2e/spec.spec.js')) cy.get('button').get('[aria-label="Close"]').click() }) From 58865d2104396d37c286d828a1770131074339bb Mon Sep 17 00:00:00 2001 From: Manuel-Suarez-Abascal Date: Fri, 30 Dec 2022 08:46:57 -0500 Subject: [PATCH 5/6] fix: address PR comment & fix CI failures --- packages/app/src/specs/CreateSpecModal.cy.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/specs/CreateSpecModal.cy.tsx b/packages/app/src/specs/CreateSpecModal.cy.tsx index be312d30b106..3f2418a629fc 100644 --- a/packages/app/src/specs/CreateSpecModal.cy.tsx +++ b/packages/app/src/specs/CreateSpecModal.cy.tsx @@ -296,7 +296,7 @@ describe('defaultSpecFileName', () => { }, }) - cy.findByText('Create new spec').click() + cy.get('[data-cy="card"]').contains('Create new spec').click() cy.get('input').invoke('val').should('contain', 'spec.cy.js') cy.percySnapshot() From 694b814be9e162e3bdb04a8659439f327aab96bc Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 30 Dec 2022 12:16:59 -0600 Subject: [PATCH 6/6] fix tests & update verbiage in a few other places --- npm/create-cypress-tests/README.md | 2 +- packages/app/cypress/e2e/specs.cy.ts | 125 +++++++++--------- packages/app/src/specs/CreateSpecModal.cy.tsx | 2 +- packages/app/src/specs/NoSpecsPage.cy.tsx | 4 +- .../src/specs/generators/EmptyGenerator.vue | 10 +- .../ReactComponentGeneratorStepOne.vue | 2 +- .../VueComponentGeneratorStepOne.vue | 2 +- .../generators/empty/EmptyGeneratorCard.vue | 4 +- .../src/actions/ProjectActions.ts | 2 +- .../src/codegen/templates/empty-e2e/empty.ejs | 2 +- .../test/unit/codegen/code-generator.spec.ts | 2 +- .../frontend-shared/src/locales/en-US.json | 4 +- 12 files changed, 81 insertions(+), 80 deletions(-) diff --git a/npm/create-cypress-tests/README.md b/npm/create-cypress-tests/README.md index b962f78c990b..528987627d36 100644 --- a/npm/create-cypress-tests/README.md +++ b/npm/create-cypress-tests/README.md @@ -44,7 +44,7 @@ Here is a list of available configuration options: `--use-npm` – use npm if yarn available `--ignore-typescript` – will not create typescript configuration if available -`--ignore-examples` – will create a 1 empty spec file (`cypress/integration/spec.js`) to start with +`--ignore-examples` – will create a 1 template spec file (`cypress/integration/spec.js`) to start with `--component-tests` – will not ask should setup component testing or not ## License diff --git a/packages/app/cypress/e2e/specs.cy.ts b/packages/app/cypress/e2e/specs.cy.ts index f5d903163f35..5dfbf2a46ad2 100644 --- a/packages/app/cypress/e2e/specs.cy.ts +++ b/packages/app/cypress/e2e/specs.cy.ts @@ -24,19 +24,19 @@ describe('App: Specs', () => { .should('be.visible') }) - cy.findAllByTestId('card').eq(1).as('EmptySpecCard') + cy.findAllByTestId('card').eq(1).as('TemplateSpecCard') .within(() => { cy.findByRole('button', { - name: defaultMessages.createSpec.e2e.importEmptySpec.header, + name: defaultMessages.createSpec.e2e.importTemplateSpec.header, }).should('be.visible') .and('not.be.disabled') - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.description) + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.description) .should('be.visible') }) }) - it('shows create first spec page with scaffold and create empty spec options', () => { + it('shows create first spec page with scaffold and create template spec options', () => { cy.findByRole('heading', { level: 1, name: defaultMessages.createSpec.page.defaultPatternNoSpecs.title, @@ -46,7 +46,7 @@ describe('App: Specs', () => { .and('contain', defaultMessages.createSpec.page.defaultPatternNoSpecs.e2e.description) cy.get('@ScaffoldCard').should('be.visible') - cy.get('@EmptySpecCard').should('be.visible') + cy.get('@TemplateSpecCard').should('be.visible') cy.findByTestId('no-specs-message').should('be.visible') .and('contain', defaultMessages.createSpec.noSpecsMessage) @@ -148,34 +148,34 @@ describe('App: Specs', () => { }) }) - context('scaffold empty spec', () => { - it('should generate empty spec', () => { + context('scaffold starter spec', () => { + it('should generate starter spec', () => { // Verify the modal can be closed - cy.get('@EmptySpecCard').click() + cy.get('@TemplateSpecCard').click() cy.get('body').click(0, 0) cy.get('[data-cy="create-spec-modal"]').should('not.exist') - cy.get('@EmptySpecCard').click() + cy.get('@TemplateSpecCard').click() cy.get('[aria-label="Close"]').click() cy.get('[data-cy="create-spec-modal"]').should('not.exist') - cy.get('@EmptySpecCard').click() + cy.get('@TemplateSpecCard').click() cy.contains('button', defaultMessages.components.button.back).click() cy.get('[data-cy="create-spec-modal"]').within(() => { - cy.get('[data-cy="card"]').contains(defaultMessages.createSpec.e2e.importEmptySpec.header).click() + cy.get('[data-cy="card"]').contains(defaultMessages.createSpec.e2e.importTemplateSpec.header).click() }) // cy.percySnapshot('Default') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 - cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) + cy.findAllByLabelText(defaultMessages.createSpec.e2e.importTemplateSpec.inputPlaceholder) .as('enterSpecInput') cy.get('@enterSpecInput').invoke('val').should('eq', getPathForPlatform('cypress/e2e/spec.cy.ts')) - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning).should('not.exist') + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning).should('not.exist') cy.get('@enterSpecInput').clear() - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning).should('not.exist') + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning).should('not.exist') // Shows entered file does not match spec pattern cy.get('@enterSpecInput').type(getPathForPlatform('cypress/e2e/no-match')) - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning) + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning) cy.contains('button', defaultMessages.createSpec.createSpec).should('be.disabled') // cy.percySnapshot('Invalid spec error') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 @@ -187,7 +187,7 @@ describe('App: Specs', () => { cy.get('[data-cy="file-row"]').contains(getPathForPlatform('cypress/e2e/MyTest.cy.js')).click() - cy.get('pre').should('contain', 'describe(\'empty spec\'') + cy.get('pre').should('contain', 'describe(\'template spec\'') // cy.percySnapshot('Generator success') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 @@ -197,9 +197,9 @@ describe('App: Specs', () => { }) it('should not show trouble rendering alert', () => { - cy.get('@EmptySpecCard').click() + cy.get('@TemplateSpecCard').click() - cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) + cy.findAllByLabelText(defaultMessages.createSpec.e2e.importTemplateSpec.inputPlaceholder) .as('enterSpecInput') // Create spec @@ -208,7 +208,7 @@ describe('App: Specs', () => { cy.get('[data-cy="file-row"]').contains(getPathForPlatform('cypress/e2e/spec.cy.ts')).click() - cy.get('pre').should('contain', 'describe(\'empty spec\'') + cy.get('pre').should('contain', 'describe(\'template spec\'') cy.findByRole('link', { name: 'Okay, run the spec' }) .should('have.attr', 'href', `#/specs/runner?file=cypress/e2e/spec.cy.ts`).click() @@ -245,46 +245,46 @@ describe('App: Specs', () => { .should('be.visible') }) - cy.findAllByTestId('card').eq(1).as('EmptySpecCard') + cy.findAllByTestId('card').eq(1).as('TemplateSpecCard') .within(() => { cy.findByRole('button', { - name: defaultMessages.createSpec.e2e.importEmptySpec.header, + name: defaultMessages.createSpec.e2e.importTemplateSpec.header, }).should('be.visible') .and('not.be.disabled') - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.description) + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.description) .should('be.visible') }) }) - context('scaffold empty spec', () => { - it('should generate empty spec for a TS project', () => { + context('scaffold starter spec', () => { + it('should generate starter spec for a TS project', () => { // Verify the modal can be closed - cy.get('@EmptySpecCard').click() + cy.get('@TemplateSpecCard').click() cy.get('body').click(0, 0) cy.get('[data-cy="create-spec-modal"]').should('not.exist') - cy.get('@EmptySpecCard').click() + cy.get('@TemplateSpecCard').click() cy.get('[aria-label="Close"]').click() cy.get('[data-cy="create-spec-modal"]').should('not.exist') - cy.get('@EmptySpecCard').click() + cy.get('@TemplateSpecCard').click() cy.contains('button', defaultMessages.components.button.back).click() cy.get('[data-cy="create-spec-modal"]').within(() => { - cy.get('[data-cy="card"]').contains(defaultMessages.createSpec.e2e.importEmptySpec.header).click() + cy.get('[data-cy="card"]').contains(defaultMessages.createSpec.e2e.importTemplateSpec.header).click() }) // cy.percySnapshot('Default') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 - cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) + cy.findAllByLabelText(defaultMessages.createSpec.e2e.importTemplateSpec.inputPlaceholder) .as('enterSpecInput') cy.get('@enterSpecInput').invoke('val').should('eq', getPathForPlatform('cypress/e2e/spec.cy.ts')) - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning).should('not.exist') + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning).should('not.exist') cy.get('@enterSpecInput').clear() - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning).should('not.exist') + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning).should('not.exist') // Shows entered file does not match spec pattern cy.get('@enterSpecInput').type(getPathForPlatform('cypress/e2e/no-match')) - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning) + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning) cy.contains('button', defaultMessages.createSpec.createSpec).should('be.disabled') // cy.percySnapshot('Invalid spec error') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 @@ -298,7 +298,7 @@ describe('App: Specs', () => { // cy.percySnapshot('Generator success') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 - cy.get('pre').should('contain', 'describe(\'empty spec\'') + cy.get('pre').should('contain', 'describe(\'template spec\'') cy.get('[aria-label="Close"]').click() @@ -392,12 +392,12 @@ describe('App: Specs', () => { .and('contain', defaultMessages.createSpec.e2e.importFromScaffold.header) cy.findAllByTestId('card').eq(1) - .and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header) + .and('contain', defaultMessages.createSpec.e2e.importTemplateSpec.header) }) }) - context('scaffold empty spec', () => { - it('should generate empty spec', () => { + context('scaffold starter spec', () => { + it('should generate template spec', () => { cy.findByRole('button', { name: 'New spec', exact: false }).click() cy.findByRole('dialog', { name: defaultMessages.createSpec.newSpecModalTitle }).within(() => { @@ -405,22 +405,21 @@ describe('App: Specs', () => { .and('contain', defaultMessages.createSpec.e2e.importFromScaffold.header) cy.findAllByTestId('card').eq(1) - .and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header) + .and('contain', defaultMessages.createSpec.e2e.importTemplateSpec.header) + .click() }) - cy.contains('Create new spec').click() - - cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) + cy.findAllByLabelText(defaultMessages.createSpec.e2e.importTemplateSpec.inputPlaceholder) .as('enterSpecInput') cy.get('@enterSpecInput').invoke('val').should('eq', getPathForPlatform('src/spec.cy.js')) - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning).should('not.exist') + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning).should('not.exist') cy.get('@enterSpecInput').clear() - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning).should('not.exist') + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning).should('not.exist') // Shows entered file does not match spec pattern cy.get('@enterSpecInput').type(getPathForPlatform('cypress/e2e/no-match')) - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning) + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning) cy.contains('button', defaultMessages.createSpec.createSpec).should('be.disabled') // cy.percySnapshot('Invalid spec error') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 @@ -432,7 +431,7 @@ describe('App: Specs', () => { cy.get('[data-cy="file-row"]').contains(getPathForPlatform('src/MyTest.cy.js')).click() - cy.get('pre').should('contain', 'describe(\'empty spec\'') + cy.get('pre').should('contain', 'describe(\'template spec\'') // cy.percySnapshot('Generator success') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 @@ -458,13 +457,16 @@ describe('App: Specs', () => { cy.contains('No specs found').should('be.visible') cy.findByRole('button', { name: 'New spec' }).click() - cy.contains('Create new spec').click() + cy.findAllByTestId('card') + .and('contain', defaultMessages.createSpec.e2e.importTemplateSpec.header) + .eq(1) + .click() - cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) + cy.findAllByLabelText(defaultMessages.createSpec.e2e.importTemplateSpec.inputPlaceholder) .as('enterSpecInput') cy.get('@enterSpecInput').invoke('val').should('eq', getPathForPlatform('src/e2e/spec.js')) - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.invalidSpecWarning).should('not.exist') + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.invalidSpecWarning).should('not.exist') cy.contains('button', defaultMessages.createSpec.createSpec).should('not.be.disabled').click() cy.contains('h2', defaultMessages.createSpec.successPage.header) @@ -481,17 +483,16 @@ describe('App: Specs', () => { .and('contain', defaultMessages.createSpec.e2e.importFromScaffold.header) cy.findAllByTestId('card').eq(1) - .and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header) + .and('contain', defaultMessages.createSpec.e2e.importTemplateSpec.header) + .click() }) - cy.contains('Create new spec').click() - - cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder) + cy.findAllByLabelText(defaultMessages.createSpec.e2e.importTemplateSpec.inputPlaceholder) .as('enterSpecInput') cy.get('@enterSpecInput').clear().type(getPathForPlatform('src/e2e/MyTest.spec.jsx')) - cy.contains(defaultMessages.createSpec.e2e.importEmptySpec.specExtensionWarning) + cy.contains(defaultMessages.createSpec.e2e.importTemplateSpec.specExtensionWarning) // cy.percySnapshot('Non-recommended spec pattern warning') // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 cy.contains('span', '{filename}.cy.jsx') @@ -524,7 +525,7 @@ describe('App: Specs', () => { }) }) - function selectEmptySpecCard () { + function selectTemplateSpecCard () { cy.findAllByTestId('card').should('have.length', 2) cy.findByRole('button', { name: 'Create from component' }).should('be.visible') cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click() @@ -541,11 +542,11 @@ describe('App: Specs', () => { cy.startAppServer('component') cy.visitApp() - cy.findAllByTestId('card').eq(1).as('EmptyCard') + cy.findAllByTestId('card').eq(1).as('TemplateSpecCard') }) it('shows Create new spec card', () => { - cy.get('@EmptyCard') + cy.get('@TemplateSpecCard') .within(() => { cy.findByRole('button', { name: 'Create new spec', @@ -554,9 +555,9 @@ describe('App: Specs', () => { }) }) - context('create empty card', () => { + context('create template spec', () => { beforeEach(() => { - cy.get('@EmptyCard').click() + cy.get('@TemplateSpecCard').click() cy.findByRole('dialog', { name: 'Enter the path for your new spec', @@ -572,7 +573,7 @@ describe('App: Specs', () => { }).should('not.exist') }) - it('shows success modal when empty spec is created', () => { + it('shows success modal when template spec is created', () => { cy.get('@CreateEmptySpecDialog').within(() => { cy.findByLabelText('Enter a relative path...').invoke('val').should('eq', getPathForPlatform('cypress/component/ComponentName.cy.ts')) @@ -717,15 +718,15 @@ describe('App: Specs', () => { it('shows new spec button to start creation workflow', () => { cy.findByRole('button', { name: 'New spec', exact: false }).click() - selectEmptySpecCard() + selectTemplateSpecCard() cy.findByRole('dialog', { name: 'Enter the path for your new spec' }).should('be.visible') }) - it('shows create first spec page with create empty option and goes back if it is cancel', () => { + it('shows create first spec page with create template spec option and goes back if it is cancel', () => { cy.findByRole('button', { name: 'New spec', exact: false }).click() - selectEmptySpecCard() + selectTemplateSpecCard() cy.contains('Back').click() @@ -750,7 +751,7 @@ describe('App: Specs', () => { cy.findByRole('button', { name: 'New spec' }).click() - selectEmptySpecCard() + selectTemplateSpecCard() cy.findByRole('dialog', { name: 'Enter the path for your new spec', diff --git a/packages/app/src/specs/CreateSpecModal.cy.tsx b/packages/app/src/specs/CreateSpecModal.cy.tsx index 3f2418a629fc..293937474c1e 100644 --- a/packages/app/src/specs/CreateSpecModal.cy.tsx +++ b/packages/app/src/specs/CreateSpecModal.cy.tsx @@ -86,7 +86,7 @@ function testEmptySpecModal (fullDefaultSpecFileName: string, specName: string) } describe('', () => { - context('create empty spec', () => { + context('create template spec', () => { context('e2e', () => { const defaultSpecName = 'spec' const defaultSpecFileName = 'cypress/e2e/spec.cy.js' diff --git a/packages/app/src/specs/NoSpecsPage.cy.tsx b/packages/app/src/specs/NoSpecsPage.cy.tsx index 352f6f4375b3..3d887034f85a 100644 --- a/packages/app/src/specs/NoSpecsPage.cy.tsx +++ b/packages/app/src/specs/NoSpecsPage.cy.tsx @@ -72,8 +72,8 @@ describe('', { viewportHeight: 655, viewportWidth: 1032 }, () => cy.contains(text.importFromScaffold.header).should('be.visible') cy.contains(text.importFromScaffold.description).should('be.visible') - cy.contains(text.importEmptySpec.header).should('be.visible') - cy.contains(text.importEmptySpec.description).should('be.visible') + cy.contains(text.importTemplateSpec.header).should('be.visible') + cy.contains(text.importTemplateSpec.description).should('be.visible') cy.percySnapshot() }) }) diff --git a/packages/app/src/specs/generators/EmptyGenerator.vue b/packages/app/src/specs/generators/EmptyGenerator.vue index 8f1d19bd8217..2268ab684552 100644 --- a/packages/app/src/specs/generators/EmptyGenerator.vue +++ b/packages/app/src/specs/generators/EmptyGenerator.vue @@ -6,8 +6,8 @@