Skip to content

Commit 4d53941

Browse files
authored
Add cypress build / e2e interactivity tests (#184)
1 parent 7138d53 commit 4d53941

File tree

8 files changed

+1413
-10
lines changed

8 files changed

+1413
-10
lines changed

.github/workflows/e2e.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
name: ci
3+
4+
on:
5+
pull_request:
6+
branches: [main]
7+
push:
8+
branches: [main]
9+
10+
jobs:
11+
e2e-tests:
12+
name: "E2E tests"
13+
strategy:
14+
fail-fast: false
15+
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: "23"
23+
24+
- uses: pnpm/action-setup@v4
25+
with:
26+
version: 9.15.3
27+
28+
- name: Install project dependencies
29+
run: pnpm i
30+
31+
- name: Build project
32+
run: pnpm run build
33+
34+
- name: Run tests
35+
run: pnpm run test

cypress.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineConfig } from 'cypress'
2+
import vitePreprocessor from 'cypress-vite'
3+
4+
export default defineConfig({
5+
e2e: {
6+
baseUrl: 'http://localhost:4173',
7+
supportFile: 'cypress/support/e2e.ts',
8+
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
9+
setupNodeEvents(on) {
10+
on('file:preprocessor', vitePreprocessor())
11+
},
12+
env: {
13+
example: '',
14+
}
15+
},
16+
})

cypress/e2e/examples.cy.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
describe('Vite Plugin Solid Examples', () => {
2+
it('should increment counter correctly', () => {
3+
cy.visit('/')
4+
cy.get('h1').contains('Count: 0')
5+
cy.contains('button', 'Increment').click()
6+
cy.get('h1').contains('Count: 1')
7+
})
8+
})

cypress/support/e2e.ts

Whitespace-only changes.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"dev": "rollup -c -w",
2222
"prepublishOnly": "pnpm build",
2323
"release": "pnpm build && changeset publish",
24-
"check": "package-check"
24+
"check": "package-check",
25+
"test": "node scripts/test-examples.ts"
2526
},
2627
"repository": {
2728
"type": "git",
@@ -58,6 +59,10 @@
5859
"@rollup/plugin-node-resolve": "^15.2.3",
5960
"@skypack/package-check": "^0.2.2",
6061
"@types/node": "^18.18.4",
62+
"cypress": "^14.0.0",
63+
"cypress-visual-regression": "^5.2.2",
64+
"cypress-vite": "^1.6.0",
65+
"cypress-wait-until": "^3.0.2",
6166
"prettier": "^3.1.0",
6267
"rollup": "^4.5.0",
6368
"rollup-plugin-cleaner": "^1.0.0",

0 commit comments

Comments
 (0)