Skip to content
This repository was archived by the owner on May 13, 2023. It is now read-only.

Commit 1193525

Browse files
committed
feat: add cypress
1 parent 8b85363 commit 1193525

File tree

13 files changed

+1381
-88
lines changed

13 files changed

+1381
-88
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ dist
99
.idea
1010
coverage
1111
.eslintcache
12+
cypress/screenshots/**
13+
cypress/videos/**

.husky/commit-msg

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx --no-install commitlint --edit $1
4+
npx --yes commitlint --edit $1

cypress.config.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from 'cypress';
2+
3+
export default defineConfig({
4+
e2e: {
5+
setupNodeEvents() {
6+
// implement node event listeners here
7+
},
8+
},
9+
video: false,
10+
});

cypress/e2e/home.cy.ts

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
describe('home', () => {
2+
context('mobile', () => {
3+
it('e2e', () => {
4+
cy.viewport(320, 480);
5+
cy.visit('http://localhost:3000');
6+
cy.title().should('include', 'Vuesion');
7+
});
8+
});
9+
10+
context('tablet portrait', () => {
11+
it('e2e', () => {
12+
cy.viewport(768, 1024);
13+
cy.visit('http://localhost:3000');
14+
cy.title().should('include', 'Vuesion');
15+
});
16+
});
17+
18+
context('tablet landscape', () => {
19+
it('e2e', () => {
20+
cy.viewport(1024, 768);
21+
cy.visit('http://localhost:3000');
22+
cy.title().should('include', 'Vuesion');
23+
});
24+
});
25+
26+
context('small desktop', () => {
27+
it('e2e', () => {
28+
cy.viewport(1200, 1024);
29+
cy.visit('http://localhost:3000');
30+
cy.title().should('include', 'Vuesion');
31+
});
32+
});
33+
34+
context('large desktop', () => {
35+
it('e2e', () => {
36+
cy.viewport(1440, 1200);
37+
cy.visit('http://localhost:3000');
38+
cy.title().should('include', 'Vuesion');
39+
});
40+
});
41+
});

cypress/fixtures/example.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}

cypress/support/commands.ts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************
3+
// This example commands.ts shows you how to
4+
// create various custom commands and overwrite
5+
// existing commands.
6+
//
7+
// For more comprehensive examples of custom
8+
// commands please read more here:
9+
// https://on.cypress.io/custom-commands
10+
// ***********************************************
11+
//
12+
//
13+
// -- This is a parent command --
14+
// Cypress.Commands.add('login', (email, password) => { ... })
15+
//
16+
//
17+
// -- This is a child command --
18+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
19+
//
20+
//
21+
// -- This is a dual command --
22+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
23+
//
24+
//
25+
// -- This will overwrite an existing command --
26+
// 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/e2e.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/e2e.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')

0 commit comments

Comments
 (0)