Skip to content

Commit 8759de5

Browse files
Merge pull request #26 from webdevnerdstuff/tests
Tests
2 parents cf45a76 + d2f7147 commit 8759de5

File tree

81 files changed

+8608
-2892
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+8608
-2892
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ trim_trailing_whitespace = false
1313

1414
[*.{yml,yaml}]
1515
indent_size = 2
16+
indent_style = space
1617

1718
[*.{js,ts,mts,vue}]
1819
indent_size = 2

.github/workflows/cypress.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Cypress Tests with Dependency and Artifact Caching
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
install:
9+
runs-on: ubuntu-22.04
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup pnpm
15+
uses: pnpm/action-setup@v4
16+
with:
17+
version: 9
18+
19+
- name: Install dependencies
20+
run: pnpm install
21+
22+
- name: Build application
23+
run: pnpm build
24+
25+
- name: Save build folder
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: build
29+
if-no-files-found: error
30+
path: ./dist
31+
32+
cypress-run:
33+
runs-on: ubuntu-22.04
34+
needs: install
35+
steps:
36+
- name: Setup pnpm
37+
uses: pnpm/action-setup@v4
38+
with:
39+
version: 9
40+
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
- name: Download the build folder
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: build
48+
path: ./dist
49+
50+
- name: Install dependencies
51+
run: pnpm install
52+
53+
- name: Cypress run
54+
uses: cypress-io/github-action@v6
55+
with:
56+
start: pnpm cy:run
57+
component: true
58+
browser: chrome

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,11 @@ dist-ssr
2828

2929
src/plugin/**/*.bk.*
3030

31+
# Temp files and directories
32+
*__TEMP.*
33+
*__TEMP/
3134

35+
# Cypress
36+
cypress/downloads
37+
cypress/screenshots
38+
cypress/videos

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22

3-
npx lint-staged && npm run test:build
3+
# npx lint-staged && npm run test:build
44
npx lint-staged

.husky/prepare-commit-msg

Lines changed: 0 additions & 3 deletions
This file was deleted.

cypress.config.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineConfig } from 'cypress';
2+
import customViteConfig from './vite.cypress.config';
3+
4+
export default defineConfig({
5+
e2e: {
6+
setupNodeEvents(on, config) {
7+
config.env = {
8+
...process.env,
9+
...config.env,
10+
};
11+
return config;
12+
},
13+
specPattern: './src/**/*.spec.cy.{js,jsx,ts,tsx}',
14+
},
15+
16+
component: {
17+
devServer: {
18+
bundler: 'vite',
19+
framework: 'vue',
20+
viteConfig: customViteConfig,
21+
},
22+
specPattern: './src/**/*.cy.{js,jsx,ts,tsx}',
23+
viewportHeight: 800,
24+
viewportWidth: 1920,
25+
},
26+
});

cypress/fixtures/example.json

Lines changed: 5 additions & 0 deletions
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/plugins/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const path = require('path');
2+
const { startDevServer } = require('@cypress/vite-dev-server');
3+
4+
module.exports = (on, config) => {
5+
config.env.tsconfigPath = path.resolve(__dirname, '../../tsconfig.cypress.json'); // Adjust the path as needed
6+
return config;
7+
};

cypress/support/commands.ts

Lines changed: 37 additions & 0 deletions
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/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>

0 commit comments

Comments
 (0)