From b50714108df429571cbbf89166ee74ce270c6ea5 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Fri, 27 Jan 2023 11:59:55 -0600 Subject: [PATCH] chore: update packages/example deployment script and cleanup package/example (#25091) Co-authored-by: Bill Glesias --- npm/create-cypress-tests/scripts/example.js | 8 +++- .../examples}/cypress/fixtures/example.json | 0 .../examples}/cypress/support/commands.js | 0 .../examples/cypress/support/component.js | 20 +++++++++ .../scripts/examples/cypress/support/e2e.js | 20 +++++++++ .../tsconfig.json} | 0 packages/app/cypress/e2e/specs.cy.ts | 7 ++- .../scaffold/ScaffoldGeneratorStepOne.vue | 10 ++--- .../src/actions/CodegenActions.ts | 4 +- .../src/actions/ProjectActions.ts | 2 +- .../data-context/src/codegen/templates.ts | 2 +- .../test/unit/codegen/code-generator.spec.ts | 12 ++--- ..._USE_DEFAULT_DOCUMENT_DOMAIN_E2E_ONLY.html | 45 +++++++++++++++++++ packages/example/README.md | 25 ++++++----- packages/example/bin/build.js | 13 +++--- packages/example/cypress.config.js | 3 +- packages/example/cypress/plugins/index.js | 22 --------- packages/example/gulpfile.js | 8 ---- packages/example/index.d.ts | 2 +- packages/example/lib/example.d.ts | 8 +--- packages/example/lib/example.js | 33 +------------- packages/example/package.json | 15 ++----- packages/example/test/example_spec.js | 31 ------------- .../support/mock-graphql/stubgql-Mutation.ts | 2 +- packages/graphql/schemas/schema.graphql | 4 +- .../enumTypes/gql-CodeGenTypeEnum.ts | 2 +- .../schemaTypes/objectTypes/gql-Mutation.ts | 4 +- yarn.lock | 30 +++---------- 28 files changed, 149 insertions(+), 183 deletions(-) rename {packages/example => npm/create-cypress-tests/scripts/examples}/cypress/fixtures/example.json (100%) rename {packages/example => npm/create-cypress-tests/scripts/examples}/cypress/support/commands.js (100%) create mode 100644 npm/create-cypress-tests/scripts/examples/cypress/support/component.js create mode 100644 npm/create-cypress-tests/scripts/examples/cypress/support/e2e.js rename npm/create-cypress-tests/scripts/{example-tsconfig.json => examples/tsconfig.json} (100%) create mode 100644 packages/errors/__snapshot-html__/EXPERIMENTAL_USE_DEFAULT_DOCUMENT_DOMAIN_E2E_ONLY.html delete mode 100644 packages/example/cypress/plugins/index.js delete mode 100644 packages/example/test/example_spec.js diff --git a/npm/create-cypress-tests/scripts/example.js b/npm/create-cypress-tests/scripts/example.js index 49b35fd7ee..0925901447 100644 --- a/npm/create-cypress-tests/scripts/example.js +++ b/npm/create-cypress-tests/scripts/example.js @@ -13,9 +13,13 @@ program await fs.remove(destinationPath) await fs.copy(exampleFolder, destinationPath, { recursive: true }) - console.log(`✅ Example was successfully created at ${chalk.cyan(destination)}`) + console.log(`✅ E2E Examples were successfully created at ${chalk.cyan(destination)}`) - await fs.copy(path.join(__dirname, 'example-tsconfig.json'), path.join(destination, 'tsconfig.json')) + await fs.copy(path.join(__dirname, 'examples', 'cypress'), path.join(destination)) + + console.log(`✅ Cypress Setup was successfully created at ${chalk.cyan(destination)}`) + + await fs.copy(path.join(__dirname, 'examples', 'tsconfig.json'), path.join(destination, 'tsconfig.json')) console.log(`✅ tsconfig.json was created for ${chalk.cyan(destination)}`) }) diff --git a/packages/example/cypress/fixtures/example.json b/npm/create-cypress-tests/scripts/examples/cypress/fixtures/example.json similarity index 100% rename from packages/example/cypress/fixtures/example.json rename to npm/create-cypress-tests/scripts/examples/cypress/fixtures/example.json diff --git a/packages/example/cypress/support/commands.js b/npm/create-cypress-tests/scripts/examples/cypress/support/commands.js similarity index 100% rename from packages/example/cypress/support/commands.js rename to npm/create-cypress-tests/scripts/examples/cypress/support/commands.js diff --git a/npm/create-cypress-tests/scripts/examples/cypress/support/component.js b/npm/create-cypress-tests/scripts/examples/cypress/support/component.js new file mode 100644 index 0000000000..5e450a7b1a --- /dev/null +++ b/npm/create-cypress-tests/scripts/examples/cypress/support/component.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/component.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/npm/create-cypress-tests/scripts/examples/cypress/support/e2e.js b/npm/create-cypress-tests/scripts/examples/cypress/support/e2e.js new file mode 100644 index 0000000000..d1dd1353e8 --- /dev/null +++ b/npm/create-cypress-tests/scripts/examples/cypress/support/e2e.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/e2e.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/npm/create-cypress-tests/scripts/example-tsconfig.json b/npm/create-cypress-tests/scripts/examples/tsconfig.json similarity index 100% rename from npm/create-cypress-tests/scripts/example-tsconfig.json rename to npm/create-cypress-tests/scripts/examples/tsconfig.json diff --git a/packages/app/cypress/e2e/specs.cy.ts b/packages/app/cypress/e2e/specs.cy.ts index de73e4a280..e7a192bd9c 100644 --- a/packages/app/cypress/e2e/specs.cy.ts +++ b/packages/app/cypress/e2e/specs.cy.ts @@ -81,11 +81,13 @@ describe('App: Specs', () => { 'cypress_api', 'files', 'location', + 'misc', 'navigation', 'network_requests', 'querying', 'spies_stubs_clocks', 'storage', + 'traversal', 'utilities', 'viewport', 'waiting', @@ -114,10 +116,7 @@ describe('App: Specs', () => { additionalIgnorePattern: [], })).map((spec) => spec.relative) - // Validate that all expected paths have been generated within the data context - expect(generatedSpecPaths.filter((path) => { - return options.expectedScaffoldPathsForPlatform.includes(path) - })).to.have.lengthOf(options.expectedScaffoldPathsForPlatform.length) + expect(generatedSpecPaths).to.include.members(options.expectedScaffoldPathsForPlatform) }, { expectedScaffoldPathsForPlatform }) // cy.percySnapshot() // TODO: restore when Percy CSS is fixed. See https://github.com/cypress-io/cypress/issues/23435 diff --git a/packages/app/src/specs/generators/scaffold/ScaffoldGeneratorStepOne.vue b/packages/app/src/specs/generators/scaffold/ScaffoldGeneratorStepOne.vue index 548519c60d..70b776d097 100644 --- a/packages/app/src/specs/generators/scaffold/ScaffoldGeneratorStepOne.vue +++ b/packages/app/src/specs/generators/scaffold/ScaffoldGeneratorStepOne.vue @@ -56,7 +56,7 @@