Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change wording for spec creation #25271

Merged
merged 11 commits into from Jan 3, 2023
2 changes: 1 addition & 1 deletion npm/webpack-dev-server/cypress/e2e/react.cy.ts
Expand Up @@ -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 new spec' }).should('be.visible').click()

cy.findByRole('dialog').within(() => {
cy.get('input').clear().type('src/App.cy.jsx')
Expand Down
16 changes: 8 additions & 8 deletions packages/app/cypress/e2e/specs.cy.ts
Expand Up @@ -408,7 +408,7 @@ describe('App: Specs', () => {
.and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header)
})

cy.contains('Create new empty spec').click()
cy.contains('Create new spec').click()

cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder)
.as('enterSpecInput')
Expand Down Expand Up @@ -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 new spec').click()

cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder)
.as('enterSpecInput')
Expand All @@ -484,7 +484,7 @@ describe('App: Specs', () => {
.and('contain', defaultMessages.createSpec.e2e.importEmptySpec.header)
})

cy.contains('Create new empty spec').click()
cy.contains('Create new spec').click()

cy.findAllByLabelText(defaultMessages.createSpec.e2e.importEmptySpec.inputPlaceholder)
.as('enterSpecInput')
Expand Down Expand Up @@ -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 new spec' }).should('be.visible').click()
}

describe('Testing Type: Component', {
Expand All @@ -544,11 +544,11 @@ describe('App: Specs', () => {
cy.findAllByTestId('card').eq(1).as('EmptyCard')
})

it('shows create new empty spec card', () => {
it('shows Create new spec card', () => {
cy.get('@EmptyCard')
.within(() => {
cy.findByRole('button', {
name: 'Create new empty spec',
name: 'Create new spec',
}).should('be.visible')
.and('not.be.disabled')
})
Expand Down Expand Up @@ -593,10 +593,10 @@ 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 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 new empty spec' }).should('be.visible')
cy.findByRole('button', { name: 'Create new spec' }).should('be.visible')
cy.findByRole('button', { name: 'Create from component' }).should('be.visible')
})

Expand Down
4 changes: 2 additions & 2 deletions packages/app/cypress/e2e/specs_list_component.cy.ts
Expand Up @@ -31,15 +31,15 @@ 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 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')
cy.get('button').get('[aria-label="Close"]').click()
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 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'))
Expand Down
12 changes: 6 additions & 6 deletions packages/app/cypress/e2e/specs_list_e2e.cy.ts
Expand Up @@ -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 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 a new 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 new empty 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 a new 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 a new 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 new empty 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()
})
Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/specs/CreateSpecModal.cy.tsx
Expand Up @@ -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 new spec' }).should('be.visible').click()
})

it('enter should call create spec function', () => {
Expand Down Expand Up @@ -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 new spec' }).should('be.visible').click()
})

it('focuses text input and selects file name by default', () => {
Expand Down Expand Up @@ -219,7 +219,7 @@ describe('<CreateSpecModal />', () => {
/>
</div>))

cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click()
cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click()

cy.focused().as('specNameInput')

Expand Down Expand Up @@ -296,7 +296,7 @@ describe('defaultSpecFileName', () => {
},
})

cy.findByText('Create new empty spec').click()
cy.findByText('Create new spec').click()
cy.get('input').invoke('val').should('contain', 'spec.cy.js')

cy.percySnapshot()
Expand Down
10 changes: 5 additions & 5 deletions packages/frontend-shared/src/locales/en-US.json
Expand Up @@ -64,7 +64,7 @@
"noComponentsFound": "No components found",
"unableToParseFile": "Unable to parse file",
"updateSpecPattern": "Update spec pattern",
"newSpecModalTitle": "Create a new spec",
"newSpecModalTitle": "Create new spec",
"successPage": {
"header": "Great! The spec was successfully added",
"runSpecButton": "Okay, run the spec",
Expand Down Expand Up @@ -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 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 ",
Expand All @@ -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 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 "
}
}
Expand Down