From 802d45f048441278c2732eebb8e9d54ee398a1c1 Mon Sep 17 00:00:00 2001 From: Alexander Alemayhu Date: Sun, 26 Jun 2022 20:11:02 +0200 Subject: [PATCH] chore(cypress): run the migration --- cypress.config.ts | 18 ++++++++++ cypress.json | 4 --- cypress/{integration => e2e}/upload.spec.js | 0 cypress/support/commands.ts | 37 +++++++++++++++++++ cypress/support/component-index.html | 12 +++++++ cypress/support/component.ts | 39 +++++++++++++++++++++ cypress/support/{index.js => e2e.js} | 0 7 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 cypress.config.ts delete mode 100644 cypress.json rename cypress/{integration => e2e}/upload.spec.js (100%) create mode 100644 cypress/support/commands.ts create mode 100644 cypress/support/component-index.html create mode 100644 cypress/support/component.ts rename cypress/support/{index.js => e2e.js} (100%) diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 00000000..8e77a8a1 --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from "cypress"; + +export default defineConfig({ + projectId: "m6njzj", + + e2e: { + setupNodeEvents(on, config) {}, + baseUrl: "http://localhost:3000", + specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}", + }, + + component: { + devServer: { + framework: "create-react-app", + bundler: "webpack", + }, + }, +}); diff --git a/cypress.json b/cypress.json deleted file mode 100644 index d4b72041..00000000 --- a/cypress.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "projectId": "m6njzj", - "baseUrl": "http://localhost:3000" -} diff --git a/cypress/integration/upload.spec.js b/cypress/e2e/upload.spec.js similarity index 100% rename from cypress/integration/upload.spec.js rename to cypress/e2e/upload.spec.js diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts new file mode 100644 index 00000000..698b01a4 --- /dev/null +++ b/cypress/support/commands.ts @@ -0,0 +1,37 @@ +/// +// *********************************************** +// This example commands.ts shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add('login', (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) +// +// declare global { +// namespace Cypress { +// interface Chainable { +// login(email: string, password: string): Chainable +// drag(subject: string, options?: Partial): Chainable +// dismiss(subject: string, options?: Partial): Chainable +// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable +// } +// } +// } \ No newline at end of file diff --git a/cypress/support/component-index.html b/cypress/support/component-index.html new file mode 100644 index 00000000..ac6e79fd --- /dev/null +++ b/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + Components App + + +
+ + \ No newline at end of file diff --git a/cypress/support/component.ts b/cypress/support/component.ts new file mode 100644 index 00000000..bd8ff018 --- /dev/null +++ b/cypress/support/component.ts @@ -0,0 +1,39 @@ +// *********************************************************** +// This example support/component.ts 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') + +import { mount } from 'cypress/react' + +// Augment the Cypress namespace to include type definitions for +// your custom command. +// Alternatively, can be defined in cypress/support/component.d.ts +// with a at the top of your spec. +declare global { + namespace Cypress { + interface Chainable { + mount: typeof mount + } + } +} + +Cypress.Commands.add('mount', mount) + +// Example use: +// cy.mount() \ No newline at end of file diff --git a/cypress/support/index.js b/cypress/support/e2e.js similarity index 100% rename from cypress/support/index.js rename to cypress/support/e2e.js