Skip to content

Commit 53d83fd

Browse files
committed
streamlined project setup, add cy webkit
1 parent 5faeeae commit 53d83fd

File tree

13 files changed

+85
-164
lines changed

13 files changed

+85
-164
lines changed

.github/workflows/tests.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,23 @@ jobs:
1212
node-version: '16.x'
1313
- name: Install dependencies
1414
run: yarn
15-
- name: Cypress run
16-
uses: cypress-io/github-action@v4
15+
- name: Install Linux Webkit deps
16+
run: npx playwright install-deps webkit
17+
- name: Cypress Chrome
18+
uses: cypress-io/github-action@v5
1719
with:
1820
install: false
1921
component: true
22+
browser: chrome
23+
- name: Cypress Firefox
24+
uses: cypress-io/github-action@v5
25+
with:
26+
install: false
27+
component: true
28+
browser: firefox
29+
- name: Cypress Webkit
30+
uses: cypress-io/github-action@v5
31+
with:
32+
install: false
33+
component: true
34+
browser: webkit

cypress.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig } from 'cypress';
33
export default defineConfig({
44
component: {
55
viewportWidth: 1366,
6+
experimentalWebKitSupport: true,
67
viewportHeight: 768,
78
devServer: {
89
framework: 'vue',

cypress/support/commands.ts

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

cypress/support/component.ts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,9 @@
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')
1+
/// <reference types="cypress" />
212

223
import { mount } from 'cypress/vue';
234

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.
285
declare global {
6+
// eslint-disable-next-line @typescript-eslint/no-namespace
297
namespace Cypress {
308
interface Chainable {
319
mount: typeof mount;
@@ -39,12 +17,6 @@ export function getInt(max: number) {
3917
return Math.floor(Math.random() * max);
4018
}
4119

42-
export function getIntRange(min: number, max: number) {
43-
min = Math.ceil(min);
44-
max = Math.floor(max);
45-
return Math.floor(Math.random() * (max - min + 1) + min);
46-
}
47-
4820
export function getRandomSequence(maxLength: number) {
4921
const sequence: number[] = [];
5022

demo/components/Sidebar/TOC.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts" setup>
22
import { computed, ComputedRef, inject } from 'vue';
3-
import { useActive } from '../../../src/useActive';
3+
import { useRoute } from 'vue-router';
44
import animateScrollTo from 'animated-scroll-to';
5-
import { routerKey, useRoute } from 'vue-router';
5+
import { useActive } from '../../../src/useActive';
66
77
type TOCData = {
88
menuItems: { label: string; href: string }[];
@@ -37,7 +37,6 @@ function customScroll(id: string) {
3737
animateScrollTo(document.getElementById(id) as HTMLElement, {
3838
elementToScroll: rootId ? (document.getElementById(rootId) as HTMLElement) : window,
3939
easing: (x: number) => 1 + (1.70158 + 1) * Math.pow(x - 1, 3) + 1.70158 * Math.pow(x - 1, 2),
40-
minDuration: 300,
4140
maxDuration: 600,
4241
verticalOffset: -overlayHeight || 0,
4342
cancelOnUserAction: true,

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@
4141
"build:app": "vue-tsc && vite build --mode app",
4242
"dev": "vite",
4343
"prepare": "husky install",
44-
"preview": "vite preview",
4544
"test": "cypress run --component",
4645
"test:gui": "cypress open --component"
4746
},
4847
"lint-staged": {
4948
"*.{ts,vue}": "eslint --cache --fix",
5049
"*.{ts,vue,md}": "prettier --write"
5150
},
52-
"dependencies": {},
5351
"devDependencies": {
5452
"@rollup/plugin-terser": "^0.3.0",
5553
"@types/node": "^18.11.18",
@@ -61,6 +59,7 @@
6159
"eslint": "^8.32.0",
6260
"eslint-plugin-vue": "^9.9.0",
6361
"husky": "^8.0.3",
62+
"playwright-webkit": "^1.29.2",
6463
"prettier": "^2.8.3",
6564
"rimraf": "^4.1.1",
6665
"typescript": "^4.9.4",

0 commit comments

Comments
 (0)