Skip to content

Commit c12a7e3

Browse files
fix: change wording for spec creation (#25271)
Co-authored-by: Emily Rohrbough <[email protected]> Closes undefined
1 parent 3925ae0 commit c12a7e3

File tree

15 files changed

+104
-103
lines changed

15 files changed

+104
-103
lines changed

npm/create-cypress-tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Here is a list of available configuration options:
4444

4545
`--use-npm` – use npm if yarn available
4646
`--ignore-typescript` – will not create typescript configuration if available
47-
`--ignore-examples` – will create a 1 empty spec file (`cypress/integration/spec.js`) to start with
47+
`--ignore-examples` – will create a 1 template spec file (`cypress/integration/spec.js`) to start with
4848
`--component-tests` – will not ask should setup component testing or not
4949

5050
## License

npm/webpack-dev-server/cypress/e2e/react.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ for (const project of WEBPACK_REACT) {
129129

130130
// 4. recreate spec, with same name as removed spec
131131
cy.findByTestId('new-spec-button').click()
132-
cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click()
132+
cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click()
133133

134134
cy.findByRole('dialog').within(() => {
135135
cy.get('input').clear().type('src/App.cy.jsx')

packages/app/cypress/e2e/specs.cy.ts

Lines changed: 68 additions & 67 deletions
Large diffs are not rendered by default.

packages/app/cypress/e2e/specs_list_component.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ describe('App: Spec List (Component)', () => {
3131
cy.get('[data-selected-spec="false"]').should('contain', 'foo')
3232
})
3333

34-
it('opens the "Create a new spec" modal after clicking the "New specs" button', () => {
34+
it('opens the "Create new spec" modal after clicking the "New specs" button', () => {
3535
cy.get('[data-cy="standard-modal"]').should('not.exist')
3636
cy.get('[data-cy="new-spec-button"]').click()
3737
cy.get('[data-cy="standard-modal"]').get('h2').contains('Enter the path for your new spec')
3838
cy.get('button').get('[aria-label="Close"]').click()
3939
cy.get('[data-cy="standard-modal"]').should('not.exist')
4040
})
4141

42-
it('has the correct defaultSpecFileName in the "Create a new spec" modal', () => {
42+
it('has the correct defaultSpecFileName in the "Create new spec" modal', () => {
4343
cy.findByTestId('standard-modal').should('not.exist')
4444
cy.findByTestId('new-spec-button').click()
4545
cy.get('input').get('[aria-label="Enter a relative path..."]').invoke('val').should('contain', getPathForPlatform('cypress/component-tests/ComponentName.spec.js'))

packages/app/cypress/e2e/specs_list_e2e.cy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,22 @@ describe('App: Spec List (E2E)', () => {
8585
cy.findAllByTestId('spec-item').should('contain', 'dom-content.spec.js')
8686
})
8787

88-
it('opens the "Create a new spec" modal after clicking the "New specs" button', () => {
88+
it('opens the "Create new spec" modal after clicking the "New specs" button', () => {
8989
cy.findByTestId('standard-modal').should('not.exist')
9090
cy.findByTestId('new-spec-button').click()
91-
cy.findByTestId('standard-modal').get('h2').contains('Create a new spec')
91+
cy.findByTestId('standard-modal').get('h2').contains('Create new spec')
9292
cy.get('button').contains('Scaffold example specs').should('be.visible')
93-
cy.get('button').contains('Create new empty spec').should('be.visible')
93+
cy.get('button').contains('Create new spec').should('be.visible')
9494
cy.get('button').get('[aria-label="Close"]').click()
9595
cy.findByTestId('standard-modal').should('not.exist')
9696
})
9797

98-
it('has the correct defaultSpecFileName in the "Create a new spec" modal', () => {
98+
it('has the correct defaultSpecFileName in the "Create new spec" modal', () => {
9999
cy.findByTestId('standard-modal').should('not.exist')
100100
cy.findByTestId('new-spec-button').click()
101-
cy.findByTestId('standard-modal').get('h2').contains('Create a new spec')
101+
cy.findByTestId('standard-modal').get('h2').contains('Create new spec')
102102
cy.get('button').contains('Scaffold example specs').should('be.visible')
103-
cy.get('button').contains('Create new empty spec').should('be.visible').click()
103+
cy.get('button').contains('Create new spec').should('be.visible').click()
104104
cy.get('input').get('[aria-label="Enter a relative path..."]').invoke('val').should('contain', getPathForPlatform('cypress/e2e/spec.spec.js'))
105105
cy.get('button').get('[aria-label="Close"]').click()
106106
})

packages/app/src/specs/CreateSpecModal.cy.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function testEmptySpecModal (fullDefaultSpecFileName: string, specName: string)
3232

3333
describe('form behavior', () => {
3434
beforeEach(() => {
35-
cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click()
35+
cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click()
3636
})
3737

3838
it('enter should call create spec function', () => {
@@ -68,7 +68,7 @@ function testEmptySpecModal (fullDefaultSpecFileName: string, specName: string)
6868

6969
describe('text Input', () => {
7070
beforeEach(() => {
71-
cy.findByRole('button', { name: 'Create new empty spec' }).should('be.visible').click()
71+
cy.findByRole('button', { name: 'Create new spec' }).should('be.visible').click()
7272
})
7373

7474
it('focuses text input and selects file name by default', () => {
@@ -86,7 +86,7 @@ function testEmptySpecModal (fullDefaultSpecFileName: string, specName: string)
8686
}
8787

8888
describe('<CreateSpecModal />', () => {
89-
context('create empty spec', () => {
89+
context('create template spec', () => {
9090
context('e2e', () => {
9191
const defaultSpecName = 'spec'
9292
const defaultSpecFileName = 'cypress/e2e/spec.cy.js'
@@ -219,7 +219,7 @@ describe('<CreateSpecModal />', () => {
219219
/>
220220
</div>))
221221

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

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

@@ -296,7 +296,7 @@ describe('defaultSpecFileName', () => {
296296
},
297297
})
298298

299-
cy.findByText('Create new empty spec').click()
299+
cy.get('[data-cy="card"]').contains('Create new spec').click()
300300
cy.get('input').invoke('val').should('contain', 'spec.cy.js')
301301

302302
cy.percySnapshot()

packages/app/src/specs/NoSpecsPage.cy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ describe('<NoSpecsPage />', { viewportHeight: 655, viewportWidth: 1032 }, () =>
7272

7373
cy.contains(text.importFromScaffold.header).should('be.visible')
7474
cy.contains(text.importFromScaffold.description).should('be.visible')
75-
cy.contains(text.importEmptySpec.header).should('be.visible')
76-
cy.contains(text.importEmptySpec.description).should('be.visible')
75+
cy.contains(text.importTemplateSpec.header).should('be.visible')
76+
cy.contains(text.importTemplateSpec.description).should('be.visible')
7777
cy.percySnapshot()
7878
})
7979
})

packages/app/src/specs/generators/EmptyGenerator.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Input
77
v-model="specFile"
88
:input-ref="inputRefFn"
9-
:placeholder="t('createSpec.e2e.importEmptySpec.inputPlaceholder')"
10-
:aria-label="t('createSpec.e2e.importEmptySpec.inputPlaceholder')"
9+
:placeholder="t('createSpec.e2e.importTemplateSpec.inputPlaceholder')"
10+
:aria-label="t('createSpec.e2e.importTemplateSpec.inputPlaceholder')"
1111
:has-error="hasError"
1212
>
1313
<template #prefix>
@@ -36,7 +36,7 @@
3636
class="rounded flex font-medium bg-warning-100 mt-16px p-16px text-warning-600 gap-8px items-center"
3737
>
3838
<i-cy-errored-outline_x16 class="icon-dark-warning-600" />
39-
{{ t('createSpec.e2e.importEmptySpec.specExtensionWarning') }}<span class="rounded bg-warning-200 py-2px px-8px text-warning-700">{{ recommendedFileName }}</span>
39+
{{ t('createSpec.e2e.importTemplateSpec.specExtensionWarning') }}<span class="rounded bg-warning-200 py-2px px-8px text-warning-700">{{ recommendedFileName }}</span>
4040
</div>
4141

4242
<div
@@ -241,7 +241,7 @@ watch(specFile, async (value) => {
241241
isValidSpecFile.value = result.data?.matchesSpecPattern ?? false
242242
}, { immediate: true })
243243
244-
title.value = t('createSpec.e2e.importEmptySpec.chooseFilenameHeader')
244+
title.value = t('createSpec.e2e.importTemplateSpec.chooseFilenameHeader')
245245
246246
const showExtensionWarning = computed(() => isValidSpecFile.value && !specFile.value.includes('.cy'))
247247
const recommendedFileName = computed(() => {
@@ -250,6 +250,6 @@ const recommendedFileName = computed(() => {
250250
return `{filename}.cy.${split[split.length - 1]}`
251251
})
252252
253-
const invalidSpecWarning = computed(() => props.type === 'e2e' ? t('createSpec.e2e.importEmptySpec.invalidSpecWarning') : t('createSpec.component.importEmptySpec.invalidComponentWarning'))
253+
const invalidSpecWarning = computed(() => props.type === 'e2e' ? t('createSpec.e2e.importTemplateSpec.invalidSpecWarning') : t('createSpec.component.importTemplateSpec.invalidComponentWarning'))
254254
255255
</script>

packages/app/src/specs/generators/component/ReactComponentGeneratorStepOne.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ whenever(result, () => {
167167
})
168168
169169
whenever(generatedSpecError, () => {
170-
title.value = t('createSpec.component.importEmptySpec.header')
170+
title.value = t('createSpec.component.importTemplateSpec.header')
171171
})
172172
173173
const makeSpec = async ({ file, item }) => {

packages/app/src/specs/generators/component/VueComponentGeneratorStepOne.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ whenever(result, () => {
160160
})
161161
162162
whenever(generatedSpecError, () => {
163-
title.value = t('createSpec.component.importEmptySpec.header')
163+
title.value = t('createSpec.component.importTemplateSpec.header')
164164
})
165165
166166
const makeSpec = async (file) => {

packages/app/src/specs/generators/empty/EmptyGeneratorCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<CreateSpecCard
33
:disabled="disabled"
4-
:header="t('createSpec.e2e.importEmptySpec.header')"
5-
:description="t('createSpec.e2e.importEmptySpec.description')"
4+
:header="t('createSpec.e2e.importTemplateSpec.header')"
5+
:description="t('createSpec.e2e.importTemplateSpec.description')"
66
:icon="DocumentCodeIcon"
77
/>
88
</template>

packages/data-context/src/actions/ProjectActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export class ProjectActions {
253253
}
254254

255255
// launchProject expects a spec when opening browser for url navigation.
256-
// We give it an empty spec if none is passed so as to land on home page
256+
// We give it an template spec if none is passed so as to land on home page
257257
const emptySpec: Cypress.Spec = {
258258
name: '',
259259
absolute: '',

packages/data-context/src/codegen/templates/empty-e2e/empty.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
fileName: <%= fileName %>
33
---
44

5-
describe('empty spec', () => {
5+
describe('template spec', () => {
66
it('passes', () => {
77
cy.visit('https://example.cypress.io')
88
})

packages/data-context/test/unit/codegen/code-generator.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('code-generator', () => {
124124
status: 'add',
125125
file: fileAbsolute,
126126
content: `${dedent`
127-
describe('empty spec', () => {
127+
describe('template spec', () => {
128128
it('passes', () => {
129129
cy.visit('https://example.cypress.io')
130130
})

packages/frontend-shared/src/locales/en-US.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"noComponentsFound": "No components found",
6565
"unableToParseFile": "Unable to parse file",
6666
"updateSpecPattern": "Update spec pattern",
67-
"newSpecModalTitle": "Create a new spec",
67+
"newSpecModalTitle": "Create new spec",
6868
"successPage": {
6969
"header": "Great! The spec was successfully added",
7070
"runSpecButton": "Okay, run the spec",
@@ -95,9 +95,9 @@
9595
"specsAddedButton": "Okay, I got it!",
9696
"specsAddingHeader": "Adding specs..."
9797
},
98-
"importEmptySpec": {
99-
"header": "Create new empty spec",
100-
"description": "We'll generate an empty spec file which can be used to start testing your application.",
98+
"importTemplateSpec": {
99+
"header": "Create new spec",
100+
"description": "We'll generate a template spec file which can be used to start testing your application.",
101101
"chooseFilenameHeader": "Enter the path for your new spec",
102102
"inputPlaceholder": "Enter a relative path...",
103103
"invalidSpecWarning": "This path is invalid because it doesn't match the following ",
@@ -110,9 +110,9 @@
110110
"description": "Generate a basic component test for any of the components in this project.",
111111
"chooseAComponentHeader": "Choose a component"
112112
},
113-
"importEmptySpec": {
114-
"header": "Create a new spec",
115-
"description": "We'll generate an empty spec file to start testing components.",
113+
"importTemplateSpec": {
114+
"header": "Create new spec",
115+
"description": "We'll generate a template spec file which can be used to start testing your components.",
116116
"invalidComponentWarning": "We couldn't generate a valid path matching your custom "
117117
}
118118
}

0 commit comments

Comments
 (0)