Skip to content

Commit f00fdeb

Browse files
committed
[web-console] Add unit tests for connectors tables
Signed-off-by: Karakatiza666 <bulakh.96@gmail.com>
1 parent 2120bbb commit f00fdeb

File tree

16 files changed

+1100
-104
lines changed

16 files changed

+1100
-104
lines changed

.github/workflows/ci-pre-mergequeue.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ jobs:
7777
pre-commit run --show-diff-on-failure --color=always --all-files
7878
shell: bash
7979
if: ${{ vars.CI_DRY_RUN != 'true' }}
80+
81+
- name: Validate OpenAPI codegen
82+
if: ${{ vars.CI_DRY_RUN != 'true' }}
83+
working-directory: js-packages/web-console
84+
run: |
85+
bun install --frozen-lockfile
86+
bunx openapi-ts --output /tmp/openapi-ts-check
87+
8088
- name: Print sccache stats
8189
run: sccache --show-stats
8290
- uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ jobs:
8787
uses: ./.github/workflows/build-docs.yml
8888
secrets: inherit
8989

90+
invoke-tests-web-console-unit:
91+
name: Web Console Unit Tests
92+
uses: ./.github/workflows/test-web-console-unit.yml
93+
secrets: inherit
94+
9095
invoke-tests-unit:
9196
name: Unit Tests
9297
needs: [check-prior-build, invoke-build-rust, invoke-build-java]
@@ -177,6 +182,21 @@ jobs:
177182
# The jobs below work around this: each one watches a single upstream job and, if that
178183
# job fails, immediately cancels the entire workflow run so everything else stops too.
179184

185+
cancel-if-tests-web-console-unit-failed:
186+
name: Cancel if Web Console Unit Tests Failed
187+
needs: [invoke-tests-web-console-unit]
188+
if: failure()
189+
runs-on: ubuntu-latest-amd64
190+
permissions:
191+
actions: write
192+
steps:
193+
- name: Cancel workflow
194+
run: |
195+
curl -fsSL -X POST \
196+
-H "Authorization: Bearer ${{ github.token }}" \
197+
-H "Accept: application/vnd.github+json" \
198+
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
199+
180200
cancel-if-build-rust-failed:
181201
name: Cancel if Rust Build Failed
182202
needs: [invoke-build-rust]
@@ -338,6 +358,7 @@ jobs:
338358
- invoke-build-rust
339359
- invoke-build-java
340360
- invoke-build-docs
361+
- invoke-tests-web-console-unit
341362
- invoke-tests-unit
342363
- invoke-tests-adapter
343364
- invoke-build-docker
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Web Console Unit Tests
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
web-console-unit-tests:
9+
name: Web Console Unit Tests
10+
runs-on: [k8s-runners-amd64]
11+
12+
container:
13+
image: mcr.microsoft.com/playwright:v1.58.2-noble
14+
options: --user root
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install unzip
21+
run: apt-get update && apt-get install -y unzip
22+
23+
- name: Setup Bun
24+
uses: oven-sh/setup-bun@v2
25+
with:
26+
bun-version: 1.3.10
27+
28+
- name: Install dependencies
29+
run: bun install --frozen-lockfile
30+
31+
- name: Run vitest unit & component tests
32+
if: ${{ vars.CI_DRY_RUN != 'true' }}
33+
run: bun run test
34+
working-directory: js-packages/web-console
35+
36+
- name: Show Kubernetes node
37+
if: always()
38+
run: |
39+
echo "K8S node: ${K8S_NODE_NAME}"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ gh-pages
7070
# JavaScript
7171
node_modules/
7272

73+
# Vitest
74+
.vitest-attachments/
75+
7376
# Playwright
7477
playwright-artifacts/
7578
playwright-snapshots/

.vscode/settings.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

bun.lock

Lines changed: 99 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js-packages/web-console/package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"@hey-api/client-fetch": "0.13.1",
1313
"@hey-api/openapi-ts": "0.92.4",
1414
"@monaco-editor/loader": "1.7.0",
15-
"@playwright/experimental-ct-svelte": "1.58.2",
1615
"@playwright/test": "1.58.2",
1716
"@poppanator/sveltekit-svg": "6.0.1",
1817
"@revolist/svelte-datagrid": "4.20.2",
@@ -36,6 +35,7 @@
3635
"@types/nprogress": "0.2.3",
3736
"@types/vusion__webfonts-generator": "0.8.6",
3837
"@vincjo/datatables": "2.8.0",
38+
"@vitest/browser-playwright": "^4.0.18",
3939
"@vusion/webfonts-generator": "0.8.0",
4040
"add": "2.0.6",
4141
"args": "5.0.3",
@@ -65,13 +65,13 @@
6565
"oidc-client-ts-lumeris": "1.0.0",
6666
"oslllo-svg-fixer": "6.0.1",
6767
"paneforge": "1.0.2",
68+
"playwright": "^1.58.2",
6869
"posthog-js": "1.352.0",
6970
"prettier": "3.8.1",
7071
"prettier-plugin-svelte": "3.5.0",
7172
"prettier-plugin-tailwindcss": "0.7.2",
7273
"profiler-layout": "workspace:*",
7374
"profiler-lib": "workspace:*",
74-
"triage-types": "workspace:*",
7575
"runed": "0.37.1",
7676
"sass-embedded": "1.97.3",
7777
"semver": "7.7.4",
@@ -89,6 +89,7 @@
8989
"tailwind-scrollbar": "4.0.2",
9090
"tailwindcss": "4.2.0",
9191
"tiny-invariant": "1.3.3",
92+
"triage-types": "workspace:*",
9293
"true-json-bigint": "1.0.1",
9394
"ts-pattern": "5.9.0",
9495
"tslib": "2.8.1",
@@ -99,6 +100,8 @@
99100
"vite": "npm:rolldown-vite@7.3.1",
100101
"vite-plugin-devtools-json": "1.0.0",
101102
"vite-plugin-virtual": "0.5.0",
103+
"vitest": "^4.0.18",
104+
"vitest-browser-svelte": "^2.0.2",
102105
"worker-timers": "8.0.30"
103106
},
104107
"overrides": {
@@ -120,13 +123,16 @@
120123
"openapi": "openapi-ts -i path/to/openapi.json -o src/client",
121124
"generate-openapi": "openapi-ts && bun run format",
122125
"build-openapi": "cd ../.. && cargo run -p pipeline-manager -- --dump-openapi",
126+
"build-icons": "bun run scripts/build-webfont.ts -- -s src/assets/icons/feldera-material-icons -d src/assets/fonts/ -n feldera-material-icons -p fd --fix && bun run scripts/build-webfont.ts -- -s src/assets/icons/generic -d src/assets/fonts/ -n generic-icons -p gc && bun run format",
123127
"test-e2e": "PLAYWRIGHT_API_ORIGIN=http://localhost:8080/ PLAYWRIGHT_APP_ORIGIN=http://localhost:8080/ DISPLAY= bun playwright test",
124128
"test-e2e-ui": "PLAYWRIGHT_API_ORIGIN=http://localhost:8080/ PLAYWRIGHT_APP_ORIGIN=http://localhost:8080/ DISPLAY= bun playwright test --ui-host=0.0.0.0",
125129
"test-ct": "DISPLAY= bun playwright test -c playwright-ct.config.ts",
126130
"test-ct-ui": "DISPLAY= bun playwright test -c playwright-ct.config.ts --ui-host=0.0.0.0",
127131
"test-report": "bun playwright show-report",
128-
"test-prepare": "git clone --depth 1 https://github.com/feldera/playwright-snapshots.git",
129-
"build-icons": "bun run scripts/build-webfont.ts -- -s src/assets/icons/feldera-material-icons -d src/assets/fonts/ -n feldera-material-icons -p fd --fix && bun run scripts/build-webfont.ts -- -s src/assets/icons/generic -d src/assets/fonts/ -n generic-icons -p gc && bun run format"
132+
"test-prepare": "git clone --depth 1 https://github.com/feldera/playwright-snapshots.git || true && mkdir -p playwright-snapshots/e2e playwright-snapshots/component",
133+
"test-update-snapshots": "bun run test -- --update && bun playwright test --update-snapshots",
134+
"test-unit": "vitest",
135+
"test": "bun run test-unit -- --run"
130136
},
131137
"trustedDependencies": ["@axa-fr/oidc-client", "sk-oidc-oauth", "svelte-preprocess"],
132138
"type": "module"

js-packages/web-console/playwright.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ const config: PlaywrightTestConfig = {
66
port: 4173
77
},
88
testDir: 'tests',
9-
testMatch: /(.+\.)?(test|spec)\.[jt]s/
9+
testMatch: /(.+\.)?(test|spec)\.[jt]s/,
10+
snapshotDir: 'playwright-snapshots/e2e',
11+
expect: {
12+
toHaveScreenshot: {
13+
// Threshold for pixel-level comparison (0 = exact, 1 = any)
14+
maxDiffPixelRatio: 0.01
15+
}
16+
}
1017
}
1118

1219
export default config

js-packages/web-console/src/lib/CLAUDE.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)