Explorar o código

setup cypress

Michael Wang %!s(int64=2) %!d(string=hai) anos
pai
achega
f5008106a5

+ 8 - 0
cypress.config.ts

@@ -0,0 +1,8 @@
+import { defineConfig } from "cypress";
+
+export default defineConfig({
+  e2e: {
+    baseUrl: "http://localhost:9000",
+    // setupNodeEvents(on, config) {},
+  },
+});

+ 16 - 0
cypress/e2e/spec.cy.ts

@@ -0,0 +1,16 @@
+// describe("empty spec", () => {
+//   it("passes", () => {
+//     cy.visit("https://example.cypress.io");
+//   });
+// });
+
+describe("My First Test", () => {
+  it("Does not do much!", () => {
+    expect(true).to.equal(true);
+  });
+});
+describe("The Home Page", () => {
+  it("successfully loads", () => {
+    cy.visit("/"); // change URL to match your dev URL
+  });
+});

+ 5 - 0
cypress/fixtures/example.json

@@ -0,0 +1,5 @@
+{
+  "name": "Using fixtures to represent data",
+  "email": "hello@cypress.io",
+  "body": "Fixtures are a great way to mock data for responses to routes"
+}

+ 37 - 0
cypress/support/commands.ts

@@ -0,0 +1,37 @@
+/// <reference types="cypress" />
+// ***********************************************
+// 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<void>
+//       drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
+//       dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
+//       visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
+//     }
+//   }
+// }

+ 20 - 0
cypress/support/e2e.ts

@@ -0,0 +1,20 @@
+// ***********************************************************
+// This example support/e2e.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')

+ 7 - 0
cypress/tsconfig.json

@@ -0,0 +1,7 @@
+{
+  "extends": "../tsconfig.json",
+  "compilerOptions": {
+    "isolatedModules": false,
+    "types": []
+  }
+}

+ 1 - 0
package.json

@@ -39,6 +39,7 @@
     "@vitejs/plugin-vue": "^3.0.1",
     "@vue/runtime-core": "^3.2.37",
     "autoprefixer": "^10.4.7",
+    "cypress": "^10.3.0",
     "eslint": "^8.20.0",
     "eslint-config-prettier": "^8.5.0",
     "eslint-plugin-vue": "^9.2.0",

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 657 - 2
pnpm-lock.yaml


+ 3 - 1
tsconfig.json

@@ -25,6 +25,8 @@
     "src/**/*.vue",
     "src/*.vue",
     "*.js",
-    "components.d.ts"
+    "components.d.ts",
+    "cypress/**/*.ts",
+    "cypress.config.ts"
   ]
 }

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio