Skip to content

Commit 58004cc

Browse files
committed
run e2e tests on every PR
1 parent 8212722 commit 58004cc

9 files changed

Lines changed: 166 additions & 158 deletions

File tree

.github/workflows/test.yaml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,43 @@ on:
99
- "*"
1010
jobs:
1111
test:
12-
name: "Run Tests"
12+
name: "Run Unit Tests"
1313
runs-on: "depot-ubuntu-24.04-small"
1414
steps:
15-
- uses: "actions/checkout@v4"
15+
- uses: "actions/checkout@v6"
1616
with:
1717
submodules: true
18-
- uses: "authzed/action-spicedb@v1"
19-
with:
20-
version: "latest"
21-
- uses: "actions/setup-node@v4"
18+
- uses: "actions/setup-node@v6"
2219
with:
2320
node-version: 22
2421
cache-dependency-path: "yarn.lock"
2522
cache: "yarn"
2623
- uses: "bahmutov/npm-install@v1"
2724
- name: "Run tests"
2825
run: "yarn test"
26+
e2e-tests:
27+
name: "Run E2E Tests"
28+
runs-on: "depot-ubuntu-24.04-arm-small" # Use a larger instance for E2E tests
29+
steps:
30+
- uses: "actions/checkout@v6"
31+
- uses: "actions/setup-node@v6"
32+
with:
33+
node-version: 22
34+
cache-dependency-path: "yarn.lock"
35+
cache: "yarn"
36+
- uses: "bahmutov/npm-install@v1"
37+
- name: "Cypress run"
38+
uses: "cypress-io/github-action@v6"
39+
with:
40+
browser: chrome
41+
start: HTTPS=true vite preview -l info --strictPort --port 5173
42+
wait-on: "http://localhost:5173"
43+
wait-on-timeout: 120
44+
- uses: "actions/upload-artifact@v4"
45+
if: always()
46+
with:
47+
name: "cypress-artifacts" # see in "summary" tab of the workflow run
48+
path: |
49+
cypress/screenshots/
50+
cypress/videos/
51+
cypress/logs/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ zed
66
build
77
.vercel
88
.env
9+
cypress/screenshots
10+
cypress/videos

cypress.config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
import { defineConfig } from "cypress";
22

33
export default defineConfig({
4-
retries: 1,
5-
defaultCommandTimeout: 10000,
6-
requestTimeout: 11000,
7-
responseTimeout: 60000,
4+
retries: 0,
5+
pageLoadTimeout: 120000, // 120 seconds
6+
defaultCommandTimeout: 10000, // 10 seconds
7+
requestTimeout: 11000, // 11 seconds
8+
responseTimeout: 60000, // 60 seconds
89
viewportHeight: 768,
910
viewportWidth: 1400,
1011
chromeWebSecurity: false,
12+
video: true,
13+
screenshotOnRunFailure: true,
1114

1215
e2e: {
13-
baseUrl: "http://localhost:3000",
16+
baseUrl: "http://localhost:5173",
1417
specPattern: ["cypress/integration/**/*.spec.{js,ts}", "cypress/e2e/**/*.cy.{js,jsx,ts,tsx}"],
1518
},
1619
});

cypress/integration/basic.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ describe("Playground", () => {
1717

1818
it("displays header buttons", () => {
1919
cy.dismissTour();
20-
cy.get("a").contains("Discuss on Discord").should("exist");
2120
cy.get("header > button").contains("Select Example Schema").should("exist");
2221
cy.get("header > button").contains("Share").should("exist");
2322
cy.get("header > button").contains("Download").should("exist");
2423
cy.get("header > button").contains("Load From File").should("exist");
25-
cy.contains("Sign In To Import").should("exist");
2624
});
2725

2826
it("default validation succeeds", () => {

cypress/support/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Cypress.Commands.add("panelText", () => {
4040
Cypress.Commands.add("waitForWasm", () => {
4141
cy.waitUntil(() => cy.window().then((win) => !!win.runSpiceDBDeveloperRequest), {
4242
errorMsg: "WASM development package not loaded",
43-
timeout: 30000,
43+
timeout: 120000, // 120 seconds
4444
interval: 500,
4545
});
4646
return;

cypress/support/e2e.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
import "./commands";
1818

1919
// Handle uncaught exceptions
20-
Cypress.on("uncaught:exception", (err) => {
21-
// TODO: Ignore transient network errors until either browser caching
22-
// or js fixtures are supported
23-
// https://github.com/cypress-io/cypress/issues/18335
24-
// https://github.com/cypress-io/cypress/issues/1271
25-
if (err.message.includes("Uncaught NetworkError")) {
26-
return false;
27-
}
20+
Cypress.on("uncaught:exception", (err: Error) => {
21+
// https://github.com/suren-atoyan/monaco-react/issues/440
22+
// if (err.message.includes("operation is manually canceled")) {
23+
// return false; // Prevents Cypress from failing the test
24+
// }
25+
// // https://github.com/cypress-io/cypress/issues/28400
26+
// if (err.message.match(`Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope'`)) {
27+
// return false;
28+
// }
29+
return true; // Let other exceptions fail the test
2830
});

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"typecheck": "tsc --noEmit",
1313
"format": "oxfmt",
1414
"format:check": "oxfmt --check",
15-
"cy:run": "cypress run --browser chrome",
15+
"cy:run": "cypress run --browser chrome --headless",
1616
"cy:open": "cypress open",
1717
"update:deps": "./scripts/update-spicedb.sh && buf generate && ./scripts/update-zed.sh"
1818
},
@@ -95,7 +95,7 @@
9595
"@types/use-deep-compare-effect": "^1.5.1",
9696
"@types/uuid": "^9.0.1",
9797
"@vitejs/plugin-react": "^4.3.4",
98-
"cypress": "^12.9.0",
98+
"cypress": "15.4.0",
9999
"cypress-wait-until": "^1.7.2",
100100
"eslint": "^9.18.0",
101101
"eslint-plugin-react-hooks": "^5.1.0",
@@ -122,4 +122,4 @@
122122
]
123123
},
124124
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
125-
}
125+
}

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const rootRoute = createRootRoute({
2929
component: () => (
3030
<>
3131
<Outlet />
32-
<TanStackRouterDevtools />
32+
<TanStackRouterDevtools position={"bottom-right"} />
3333
</>
3434
),
3535
});

0 commit comments

Comments
 (0)