Skip to content

Commit b507141

Browse files
chore: update packages/example deployment script and cleanup package/example (#25091)
Co-authored-by: Bill Glesias <bglesias@gmail.com>
1 parent 5afe19f commit b507141

File tree

28 files changed

+149
-183
lines changed

28 files changed

+149
-183
lines changed

npm/create-cypress-tests/scripts/example.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ program
1313
await fs.remove(destinationPath)
1414
await fs.copy(exampleFolder, destinationPath, { recursive: true })
1515

16-
console.log(`✅ Example was successfully created at ${chalk.cyan(destination)}`)
16+
console.log(`✅ E2E Examples were successfully created at ${chalk.cyan(destination)}`)
1717

18-
await fs.copy(path.join(__dirname, 'example-tsconfig.json'), path.join(destination, 'tsconfig.json'))
18+
await fs.copy(path.join(__dirname, 'examples', 'cypress'), path.join(destination))
19+
20+
console.log(`✅ Cypress Setup was successfully created at ${chalk.cyan(destination)}`)
21+
22+
await fs.copy(path.join(__dirname, 'examples', 'tsconfig.json'), path.join(destination, 'tsconfig.json'))
1923

2024
console.log(`✅ tsconfig.json was created for ${chalk.cyan(destination)}`)
2125
})
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/component.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/e2e.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ describe('App: Specs', () => {
8181
'cypress_api',
8282
'files',
8383
'location',
84+
'misc',
8485
'navigation',
8586
'network_requests',
8687
'querying',
8788
'spies_stubs_clocks',
8889
'storage',
90+
'traversal',
8991
'utilities',
9092
'viewport',
9193
'waiting',
@@ -114,10 +116,7 @@ describe('App: Specs', () => {
114116
additionalIgnorePattern: [],
115117
})).map((spec) => spec.relative)
116118

117-
// Validate that all expected paths have been generated within the data context
118-
expect(generatedSpecPaths.filter((path) => {
119-
return options.expectedScaffoldPathsForPlatform.includes(path)
120-
})).to.have.lengthOf(options.expectedScaffoldPathsForPlatform.length)
119+
expect(generatedSpecPaths).to.include.members(options.expectedScaffoldPathsForPlatform)
121120
}, { expectedScaffoldPathsForPlatform })
122121

123122
// cy.percySnapshot() // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435

packages/app/src/specs/generators/scaffold/ScaffoldGeneratorStepOne.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
<script lang="ts" setup>
5858
import { gql, useMutation } from '@urql/vue'
59-
import { ScaffoldGeneratorStepOne_ScaffoldIntegrationDocument } from '../../../generated/graphql'
59+
import { ScaffoldGeneratorStepOne_E2eExamplesDocument } from '../../../generated/graphql'
6060
import { computed, onMounted } from 'vue'
6161
import { buildSpecTree } from '../../../specs/tree/useCollapsibleTree'
6262
import { useCollapsibleTree } from '../../tree/useCollapsibleTree'
@@ -68,8 +68,8 @@ import type { FoundSpec } from '@packages/types/src'
6868
const { t } = useI18n()
6969
7070
gql`
71-
mutation ScaffoldGeneratorStepOne_scaffoldIntegration {
72-
scaffoldIntegration {
71+
mutation ScaffoldGeneratorStepOne_e2eExamples {
72+
e2eExamples {
7373
file {
7474
id
7575
absolute
@@ -89,15 +89,15 @@ const emits = defineEmits<{
8989
(event: 'close'): void
9090
}>()
9191
92-
const mutation = useMutation(ScaffoldGeneratorStepOne_ScaffoldIntegrationDocument)
92+
const mutation = useMutation(ScaffoldGeneratorStepOne_E2eExamplesDocument)
9393
9494
onMounted(async () => {
9595
emits('update:title', t('createSpec.e2e.importFromScaffold.specsAddingHeader'))
9696
await mutation.executeMutation({})
9797
emits('update:title', t('createSpec.e2e.importFromScaffold.specsAddedHeader'))
9898
})
9999
100-
const scaffoldedFiles = computed(() => mutation.data.value?.scaffoldIntegration || [])
100+
const scaffoldedFiles = computed(() => mutation.data.value?.e2eExamples || [])
101101
const specTree = computed(() => {
102102
const files: FoundSpec[] = scaffoldedFiles.value.map((res) => {
103103
return {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ export class CodegenActions {
129129
return path.join(projectRoot, 'cypress', 'e2e')
130130
}
131131

132-
async scaffoldIntegration (): Promise<NexusGenObjects['ScaffoldedFile'][]> {
132+
async e2eExamples (): Promise<NexusGenObjects['ScaffoldedFile'][]> {
133133
const projectRoot = this.ctx.currentProject
134134

135135
assert(projectRoot, `Cannot create spec without currentProject.`)
136136

137137
const results = await codeGenerator(
138-
{ templateDir: templates['scaffoldIntegration'], target: this.defaultE2EPath },
138+
{ templateDir: templates['e2eExamples'], target: this.defaultE2EPath },
139139
{},
140140
)
141141

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export class ProjectActions {
415415

416416
switch (this.ctx.coreData.currentTestingType) {
417417
case 'e2e':
418-
return hasNonExampleSpec(templates.scaffoldIntegration, specs)
418+
return hasNonExampleSpec(templates.e2eExamples, specs)
419419
case 'component':
420420
return specs.length > 0
421421
case null:

0 commit comments

Comments
 (0)