Skip to content

Commit b41d416

Browse files
committed
Fix cypress test and add to workflow
1 parent 80dfbe4 commit b41d416

File tree

4 files changed

+198
-94
lines changed

4 files changed

+198
-94
lines changed

.github/workflows/cypress.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Cypress
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
env:
13+
NODE_ENV: test
14+
SQLITE: db.db
15+
strategy:
16+
matrix:
17+
node-version: [18.x, 20.x, 22.x]
18+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: "npm"
26+
# Installs packages
27+
- run: npm ci
28+
# Tests the project
29+
- run: npm test

cypress/support/e2e.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,15 @@ import "./commands";
1818

1919
// Alternatively you can use CommonJS syntax:
2020
// require('./commands')
21+
22+
// Tests only work
23+
beforeEach(() => {
24+
cy.intercept(
25+
{
26+
url: /^((?!\/(_next\/data|api)).)*$/, // Exclude URLs containing "/_next/data" or "/api"
27+
},
28+
(req) => {
29+
req.headers["cache-control"] = "no-cache";
30+
},
31+
).as("allRequests");
32+
});

0 commit comments

Comments
 (0)