Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ced6731

Browse files
thelostone-mc0xkenj1
andauthoredMar 18, 2025··
chore: rebase with upstream (#7)
* fix: e2e (#102) ## Checklist before requesting a review - [x] I have conducted a self-review of my code. - [x] I have conducted a QA. - [x] If it is a core feature, I have included comprehensive tests. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Tests** - Introduced a new automated end-to-end testing workflow. - Standardized wait times in test setups for improved consistency across scenarios. - **Chores** - Updated continuous integration configurations with refined naming and sequencing for enhanced clarity and reliability during test executions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> * chore: increase fetch limit to 200 --------- Co-authored-by: 0xkenj1 <[email protected]>
1 parent 91dcb1b commit ced6731

10 files changed

+48
-9
lines changed
 

‎.github/workflows/e2e-tests.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: E2E Tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
e2e:
8+
name: E2E Tests
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out github repository
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 1
15+
16+
- name: Setup environment
17+
uses: ./.github/actions/setup
18+
19+
- name: Install dependencies
20+
run: pnpm install --frozen-lockfile
21+
22+
- name: Run tests
23+
run: pnpm test:e2e

‎.github/workflows/main-workflow.yml

+4
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ jobs:
2525
test:
2626
uses: ./.github/workflows/test.yml
2727
needs: lint
28+
29+
e2e-tests:
30+
uses: ./.github/workflows/e2e-tests.yml
31+
needs: test

‎.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Tests
1+
name: Unit and Integration Tests
22

33
on:
44
workflow_call:
55

66
jobs:
77
unit:
8-
name: Tests
8+
name: Unit and Integration Tests
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check out github repository

‎scripts/hasura-config/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CustomFunction, HasuraMetadataApi, RelationshipConfig } from "./interna
55

66
configDotenv();
77

8-
const DEFAULT_PUBLIC_FETCH_LIMIT = 50;
8+
const DEFAULT_PUBLIC_FETCH_LIMIT = 200;
99

1010
const envSchema = z.object({
1111
HASURA_ENDPOINT: z.string().url(),

‎tests/e2e/test/globalSetup.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import type { TestProject } from "vitest/node";
22

33
import { TestEnvironment } from "../src/utils/test-environment.js";
44

5+
/**
6+
* Delay in milliseconds to wait for the processing service to finish processing events
7+
*/
8+
export const PROCESSING_SERVICE_RUNNING_DELAY_MS = 10000;
9+
510
let env: TestEnvironment | undefined;
611

712
/**

‎tests/e2e/test/scenarios/allocation.spec-e2e.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { beforeAll, describe, expect, inject, it } from "vitest";
44
import { Bytes32String, IndexerFetchedEvent, TimestampMs } from "@grants-stack-indexer/shared";
55

66
import { TestHelper } from "../../src/utils/test-helper.js";
7+
import { PROCESSING_SERVICE_RUNNING_DELAY_MS } from "../globalSetup.js";
78

89
/**
910
* This test suite covers allocation event types:
@@ -272,7 +273,9 @@ describe("Allocation Events", () => {
272273
]);
273274

274275
await testHelper.startProcessingService();
275-
await new Promise((resolve) => setTimeout(resolve, 4000));
276+
await new Promise((resolve) =>
277+
setTimeout(resolve, PROCESSING_SERVICE_RUNNING_DELAY_MS),
278+
);
276279
await testHelper.stopProcessingService();
277280
});
278281

‎tests/e2e/test/scenarios/attestation.spec-e2e.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { beforeAll, describe, expect, inject, it } from "vitest";
44
import { Bytes32String, IndexerFetchedEvent, TimestampMs } from "@grants-stack-indexer/shared";
55

66
import { TestHelper } from "../../src/utils/test-helper.js";
7+
import { PROCESSING_SERVICE_RUNNING_DELAY_MS } from "../globalSetup.js";
78

89
/**
910
* This test suite covers attestation scenarios:
@@ -206,7 +207,7 @@ describe("Attestation Events", () => {
206207
fetchDelayMs: 5000,
207208
},
208209
]);
209-
await new Promise((resolve) => setTimeout(resolve, 3500));
210+
await new Promise((resolve) => setTimeout(resolve, PROCESSING_SERVICE_RUNNING_DELAY_MS));
210211
await testHelper.stopProcessingService();
211212
await testHelperOtherChain.stopProcessingService();
212213
});

‎tests/e2e/test/scenarios/profileCreated.spec-e2e.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { beforeAll, describe, expect, inject, it } from "vitest";
44
import { Bytes32String, IndexerFetchedEvent, TimestampMs } from "@grants-stack-indexer/shared";
55

66
import { TestHelper } from "../../src/utils/test-helper.js";
7+
import { PROCESSING_SERVICE_RUNNING_DELAY_MS } from "../globalSetup.js";
78

89
describe("Profile Created", () => {
910
let testHelper: TestHelper;
@@ -54,7 +55,7 @@ describe("Profile Created", () => {
5455

5556
await testHelper.startProcessingService();
5657
// give some time to fetch the events
57-
await new Promise((resolve) => setTimeout(resolve, 1000));
58+
await new Promise((resolve) => setTimeout(resolve, PROCESSING_SERVICE_RUNNING_DELAY_MS));
5859
await testHelper.stopProcessingService();
5960
});
6061

‎tests/e2e/test/scenarios/roundApplication.spec-e2e.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { beforeAll, describe, expect, expectTypeOf, inject, it } from "vitest";
55
import { Bytes32String, IndexerFetchedEvent, TimestampMs } from "@grants-stack-indexer/shared";
66

77
import { TestHelper } from "../../src/utils/test-helper.js";
8+
import { PROCESSING_SERVICE_RUNNING_DELAY_MS } from "../globalSetup.js";
89

910
/**
1011
* Happy path events sequence:
@@ -133,7 +134,7 @@ describe("DVMD Round creation with Pending Role and Application", () => {
133134
]);
134135

135136
await testHelper.startProcessingService();
136-
await new Promise((resolve) => setTimeout(resolve, 2500));
137+
await new Promise((resolve) => setTimeout(resolve, PROCESSING_SERVICE_RUNNING_DELAY_MS));
137138
await testHelper.stopProcessingService();
138139
});
139140

@@ -528,7 +529,7 @@ describe("Unsupported Strategy and Events", () => {
528529
]);
529530

530531
await testHelper.startProcessingService();
531-
await new Promise((resolve) => setTimeout(resolve, 1500));
532+
await new Promise((resolve) => setTimeout(resolve, 10000));
532533
await testHelper.stopProcessingService();
533534
});
534535

‎tests/e2e/test/scenarios/searchProjects.spec-e2e.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { beforeAll, describe, expect, inject, it } from "vitest";
44
import { Bytes32String, Hex, IndexerFetchedEvent, TimestampMs } from "@grants-stack-indexer/shared";
55

66
import { TestHelper } from "../../src/utils/test-helper.js";
7+
import { PROCESSING_SERVICE_RUNNING_DELAY_MS } from "../globalSetup.js";
78

89
describe("Search Projects", () => {
910
let testHelper: TestHelper;
@@ -84,7 +85,7 @@ describe("Search Projects", () => {
8485
await testHelper.addEvents(events);
8586

8687
await testHelper.startProcessingService();
87-
await new Promise((resolve) => setTimeout(resolve, 2000));
88+
await new Promise((resolve) => setTimeout(resolve, PROCESSING_SERVICE_RUNNING_DELAY_MS));
8889
await testHelper.stopProcessingService();
8990
});
9091

0 commit comments

Comments
 (0)
Please sign in to comment.