Skip to content

Commit 146f68d

Browse files
committed
Migrate cypress to cypress 10.0
1 parent e38a86e commit 146f68d

16 files changed

+97
-22
lines changed

cypress.config.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({
4+
video: false,
5+
e2e: {
6+
// We've imported your old cypress plugins here.
7+
// You may want to clean this up later by importing these.
8+
setupNodeEvents(on, config) {
9+
return require('./cypress/plugins/index.js')(on, config);
10+
},
11+
specPattern: 'cypress/e2e/**/*.spec.ts',
12+
baseUrl: 'http://localhost:3000',
13+
},
14+
component: {
15+
devServer: {
16+
framework: 'vue',
17+
bundler: 'vite',
18+
},
19+
// setupNodeEvents(on, config) {},
20+
specPattern: 'src/**/*.spec.ts',
21+
},
22+
});

cypress.json

Lines changed: 0 additions & 8 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

cypress/support/commands.js renamed to cypress/support/commands.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
/// <reference types="cypress" />
12
// ***********************************************
2-
// This example commands.js shows you how to
3+
// This example commands.ts shows you how to
34
// create various custom commands and overwrite
45
// existing commands.
56
//
@@ -23,3 +24,14 @@
2324
//
2425
// -- This will overwrite an existing command --
2526
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
27+
//
28+
// declare global {
29+
// namespace Cypress {
30+
// interface Chainable {
31+
// login(email: string, password: string): Chainable<void>
32+
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
33+
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
34+
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
35+
// }
36+
// }
37+
// }

cypress/support/component-index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<title>Components App</title>
8+
</head>
9+
<body>
10+
<div data-cy-root></div>
11+
</body>
12+
</html>

cypress/support/component.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// ***********************************************************
2+
// This example support/component.ts 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')
21+
22+
import { mount } from 'cypress/vue2';
23+
24+
// Augment the Cypress namespace to include type definitions for
25+
// your custom command.
26+
// Alternatively, can be defined in cypress/support/component.d.ts
27+
// with a <reference path="./component" /> at the top of your spec.
28+
declare global {
29+
namespace Cypress {
30+
interface Chainable {
31+
mount: typeof mount;
32+
}
33+
}
34+
}
35+
36+
Cypress.Commands.add('mount', mount);
37+
38+
// Example use:
39+
// cy.mount(MyComponent)
File renamed without changes.

0 commit comments

Comments
 (0)