Skip to content

Commit c40b391

Browse files
committed
run e2e tests on every PR
1 parent d8f4cf3 commit c40b391

File tree

10 files changed

+47
-20
lines changed

10 files changed

+47
-20
lines changed

.github/workflows/test.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
branches:
99
- "*"
1010
jobs:
11-
test:
11+
unit-tests:
1212
name: "Run Tests"
1313
runs-on: "depot-ubuntu-24.04-small"
1414
steps:
@@ -24,3 +24,30 @@ jobs:
2424
- uses: "bahmutov/npm-install@v1"
2525
- name: "Run tests"
2626
run: "yarn test"
27+
e2e-tests:
28+
name: "Run E2E Tests"
29+
runs-on: "depot-ubuntu-24.04-4" # Use a larger instance for E2E tests
30+
steps:
31+
- uses: "actions/checkout@v4"
32+
- uses: "authzed/action-spicedb@v1"
33+
with:
34+
version: "latest"
35+
- uses: "actions/setup-node@v4"
36+
with:
37+
node-version: 22
38+
cache-dependency-path: "yarn.lock"
39+
cache: "yarn"
40+
- uses: "bahmutov/npm-install@v1"
41+
- name: "Run server locally and tests"
42+
run:
43+
yarn dev & sleep 60 && yarn cy:run
44+
- uses: actions/upload-artifact@v4
45+
if: failure()
46+
with:
47+
name: cypress-screenshots
48+
path: cypress/screenshots
49+
- uses: actions/upload-artifact@v4
50+
if: always()
51+
with:
52+
name: cypress-videos
53+
path: cypress/videos

.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: [
1518
"cypress/integration/**/*.spec.{js,ts}",
1619
"cypress/e2e/**/*.cy.{js,jsx,ts,tsx}",

cypress/integration/basic.spec.js

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

2020
it("displays header buttons", () => {
2121
cy.dismissTour();
22-
cy.get("a").contains("Discuss on Discord").should("exist");
2322
cy.get("header > button").contains("Select Example Schema").should("exist");
2423
cy.get("header > button").contains("Share").should("exist");
2524
cy.get("header > button").contains("Download").should("exist");
2625
cy.get("header > button").contains("Load From File").should("exist");
27-
cy.contains("Sign In To Import").should("exist");
2826
});
2927

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

cypress/support/commands.js

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

cypress/support/e2e.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
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;
20+
Cypress.on("uncaught:exception", (err: { msg: string }) => {
21+
// https://github.com/suren-atoyan/monaco-react/issues/440
22+
if (err.msg.includes("operation is manually canceled")) {
23+
return false; // Prevents Cypress from failing the test
2724
}
2825
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"lint-fix": "eslint --fix .",
9797
"format": "prettier . -w",
9898
"format:check": "prettier . -c",
99-
"cy:run": "cypress run --browser chrome",
99+
"cy:run": "cypress run --browser chrome --headless",
100100
"cy:open": "cypress open",
101101
"update:spicedb": "./scripts/update-spicedb.sh",
102102
"update:zed": "./scripts/update-zed.sh",

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const rootRoute = createRootRoute({
2424
component: () => (
2525
<>
2626
<Outlet />
27-
<TanStackRouterDevtools />
27+
<TanStackRouterDevtools position={"bottom-right"} />
2828
</>
2929
),
3030
});

src/spicedb-common/services/developerservice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { create, fromJsonString, toJsonString } from "@bufbuild/protobuf";
2626
import wasmConfig from "../../wasm-config.json";
2727

2828
const WASM_FILE = `/static/main.wasm`;
29-
const ESTIMATED_WASM_BINARY_SIZE = 46376012; // bytes
29+
const ESTIMATED_WASM_BINARY_SIZE = 58000000; // bytes
3030
const ENTRYPOINT_FUNCTION = "runSpiceDBDeveloperRequest";
3131

3232
/**

src/spicedb-common/services/zedservice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { create, toJson } from "@bufbuild/protobuf";
66
import wasmConfig from "../../wasm-config.json";
77

88
const WASM_FILE = `/static/zed.wasm`;
9-
const ESTIMATED_WASM_BINARY_SIZE = 55126053; // bytes
9+
const ESTIMATED_WASM_BINARY_SIZE = 65000000; // bytes
1010
const ENTRYPOINT_FUNCTION = "runZedCommand";
1111

1212
/**

0 commit comments

Comments
 (0)