Skip to content

Commit 366b477

Browse files
committed
Enable Playwright unit tests (not component)
Signed-off-by: Karakatiza666 <bulakh.96@gmail.com>
1 parent 01272e9 commit 366b477

File tree

20 files changed

+335
-36
lines changed

20 files changed

+335
-36
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ RUN apt-get install -y \
3535
gcc clang libclang-dev python3-pip python3-plumbum \
3636
hub numactl openjdk-19-jre-headless maven
3737

38-
## Install nodejs and global packages
38+
## Install nodejs and global packages (optional)
3939
# - nodejs
4040
RUN mkdir -p /etc/apt/keyrings
4141
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
4242
ENV NODE_MAJOR=20
4343
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
4444
RUN apt update --fix-missing && apt install nodejs
4545
RUN npm install --global yarn
46-
RUN npm install --global openapi-typescript-codegen
46+
RUN npm install --global @hey-api/openapi-ts
4747

4848
## Install Redpanda rpk to enable preparing demos
4949

.devcontainer/postCreate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Install Playwright system dependencies
2-
cd ./web-console && yarn playwright install-deps
2+
cd ./web-console && bunx playwright install-deps
33
# Install Playwright browsers
4-
npx playwright install
4+
bunx playwright install

Earthfile

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ build-webui-deps:
129129

130130
COPY web-console/package.json ./web-console/
131131
COPY web-console/bun.lockb ./web-console/
132-
RUN cd web-console && bun install
132+
RUN cd web-console && bun run install-frozen
133133

134134
build-webui:
135135
FROM +build-webui-deps
@@ -498,6 +498,75 @@ integration-tests:
498498
exit $status
499499
END
500500

501+
ui-playwright-container:
502+
FROM +install-deps
503+
COPY web-console web-console
504+
# COPY web-console/playwright-ct.config.ts web-console
505+
COPY deploy/docker-compose.yml .
506+
COPY deploy/.env .
507+
508+
# Pull playwright-snapshots for visual regression testing
509+
# It was decided it's better to clone the snapshots repo during the build rather than have it as a submodule
510+
ARG PLAYWRIGHT_SNAPSHOTS_COMMIT
511+
RUN echo PLAYWRIGHT_SNAPSHOTS_COMMIT=$PLAYWRIGHT_SNAPSHOTS_COMMIT
512+
GIT CLONE --branch=$PLAYWRIGHT_SNAPSHOTS_COMMIT https://github.com/feldera/playwright-snapshots.git playwright-snapshots
513+
514+
WORKDIR web-console
515+
RUN bun run install-frozen
516+
# Generate .svelte-kit/tsconfig.json and .svelte-kit/types
517+
RUN bunx svelte-kit sync
518+
RUN bunx playwright install
519+
RUN bunx playwright install-deps
520+
ENV CI=true
521+
ENV PLAYWRIGHT_API_ORIGIN=http://localhost:8080/
522+
ENV PLAYWRIGHT_APP_ORIGIN=http://localhost:8080/
523+
ENV DISPLAY=
524+
525+
# Install docker compose - earthly can do this automatically, but it installs an older version
526+
ENV DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
527+
RUN mkdir -p $DOCKER_CONFIG/cli-plugins
528+
RUN curl -SL https://github.com/docker/compose/releases/download/v2.24.0-birthday.10/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
529+
RUN chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
530+
531+
# Install zip to prepare test artifacts for export
532+
RUN apt-get install -y zip
533+
534+
# ui-playwright-tests-e2e:
535+
# FROM +ui-playwright-container
536+
# ENV FELDERA_VERSION=latest
537+
538+
# TRY
539+
# WITH DOCKER --load ghcr.io/feldera/pipeline-manager:latest=+pipeline-manager-container-cors-all \
540+
# --compose ../docker-compose.yml \
541+
# --service pipeline-manager
542+
# # We zip artifacts regardless of test success or error, and then we complete the command preserving test's exit_code
543+
# RUN sleep 10 && if bunx playwright test -c playwright-e2e.config.ts; then exit_code=0; else exit_code=$?; fi \
544+
# && cd /dbsp \
545+
# && zip -r playwright-report-e2e.zip playwright-report-e2e \
546+
# && zip -r test-results-e2e.zip test-results-e2e \
547+
# && exit $exit_code
548+
# END
549+
# FINALLY
550+
# SAVE ARTIFACT --if-exists /dbsp/playwright-report-e2e.zip AS LOCAL ./playwright-artifacts/
551+
# SAVE ARTIFACT --if-exists /dbsp/test-results-e2e.zip AS LOCAL ./playwright-artifacts/
552+
# END
553+
554+
ui-playwright-tests-ct:
555+
FROM +ui-playwright-container
556+
ENV FELDERA_VERSION=latest
557+
558+
TRY
559+
# We zip artifacts regardless of test success or error, and then we complete the command preserving test's exit_code
560+
RUN if bunx playwright test -c playwright-ct.config.ts; then exit_code=0; else exit_code=$?; fi \
561+
&& cd /dbsp/web-console \
562+
&& zip -r playwright-report-ct.zip playwright-report-ct \
563+
&& zip -r test-results-ct.zip test-results-ct \
564+
&& exit $exit_code
565+
FINALLY
566+
SAVE ARTIFACT --if-exists /dbsp/web-console/playwright-report-ct.zip AS LOCAL ./playwright-artifacts/
567+
SAVE ARTIFACT --if-exists /dbsp/web-console/test-results-ct.zip AS LOCAL ./playwright-artifacts/
568+
END
569+
501570
benchmark:
502571
FROM +build-manager
503572
COPY demo/project_demo12-HopsworksTikTokRecSys/tiktok-gen demo/project_demo12-HopsworksTikTokRecSys/tiktok-gen
@@ -562,6 +631,7 @@ ci-tests:
562631
BUILD +openapi-checker
563632
BUILD +test-sql
564633
BUILD +integration-tests
634+
BUILD +ui-playwright-tests-ct
565635
# BUILD +test-docker-compose-stable
566636
# TODO: Temporarily disabled while we port the demo script
567637
# BUILD +test-snowflake
@@ -574,3 +644,4 @@ nightly-tests:
574644
BUILD +test-debezium-mysql
575645
BUILD +test-docker-compose
576646
BUILD +test-service-related
647+
# BUILD +ui-playwright-tests-e2e

crates/pipeline-manager/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ fn main() {
5454
let asset_path: PathBuf = Path::new("../../web-console/").join(rel_build_dir);
5555
let mut resource_dir = NpmBuild::new("../../web-console")
5656
.executable("bun")
57-
.install()
57+
.run("install-frozen")
5858
.expect(
59-
"Could not run `bun install`. Follow set-up instructions in web-console/README.md",
59+
"Could not run `bun install --frozen-lockfile`. Follow set-up instructions in web-console/README.md",
6060
)
61-
.run("build")
61+
.run("build --frozen-lockfile")
6262
.expect("Could not run `bun run build`. Run it manually in web-console/ to debug.")
6363
.target(asset_path.clone())
6464
.to_resource_dir();

deploy/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ RUN ln -s $HOME/.bun/bin/bun /usr/bin/bun
5656
# sveltekit
5757
COPY web-console/package.json web-console/
5858
COPY web-console/bun.lockb web-console/
59-
RUN cd web-console && bun install
59+
RUN cd web-console && bun run install-frozen
6060

6161
COPY web-console/static web-console/static
6262
COPY web-console/src web-console/src

docs/contributors/ui-testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Add environment variable `CI=true` when executing tests in CI setting.
88

99
### Running e2e tests
1010

11-
Run `yarn test-e2e` to execute all e2e tests on all supported platforms in background, or run `yarn test-e2e-ui` to open a UI to run tests interactively.
11+
Run `bun run test-e2e` to execute all e2e tests on all supported platforms in background, or run `bun run test-e2e-ui` to open a UI to run tests interactively.
1212
Tests should be executed against a running Pipeline Manager instance.
1313
As an artificial limitation of scope, currently no services for Kafka, Debezium, Snowflake and other similar connector types are available for tests in the CI, so only HTTP connectors and API is available along with the UI itself.
1414

1515
### Running ct tests
1616

17-
Run `yarn test-ct` to execute all ct tests on all supported platforms in background, or run `yarn test-ct-ui` to open a UI to run tests interactively.
17+
Run `bun run test-ct` to execute all ct tests on all supported platforms in background, or run `bun run test-ct-ui` to open a UI to run tests interactively.
1818
Unit tests do not need Feldera instance to run because they run against individual ESM modules compiled on-demand for the test.
1919

2020
### Contributing tests
@@ -29,7 +29,7 @@ When committing new tests or updating screenshots for existing tests, `PLAYWRIGH
2929
When testing locally, you need to manually clone `playwright-snapshots` and checkout the correct commit hash, e.g.:
3030

3131
```
32-
cd web-console && yarn test-prepare
32+
cd web-console && bun run test-prepare
3333
```
3434
OR
3535
```
@@ -51,7 +51,7 @@ install Playwright on your host system: https://playwright.dev/docs/intro
5151

5252
Execute Playwright Codegen with:
5353
```bash
54-
yarn playwright codegen http://localhost:8080/
54+
bunx playwright codegen http://localhost:8080/
5555
```
5656

5757
Keep in mind that codegen is not designed to produce production-ready code,

web-console/.gitignore

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1+
# dependencies
12
/node_modules
23

3-
# Output
4+
# build
45
.output
56
.vercel
67
/.svelte-kit
78
/build
9+
/pipeline-manager-*
810

911
# OS
1012
.DS_Store
1113
Thumbs.db
1214

13-
# Env
15+
# misc
16+
*.pem
17+
18+
# debug
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*
22+
23+
# local env files
1424
.env
1525
.env.*
1626
!.env.example
@@ -20,5 +30,16 @@ Thumbs.db
2030
vite.config.js.timestamp-*
2131
vite.config.ts.timestamp-*
2232

33+
# TypeScript
34+
*.tsbuildinfo
35+
36+
# Playwright
37+
/playwright-report-ct/
38+
/test-results-ct/
39+
/blob-report-ct/
40+
/playwright-report-e2e/
41+
/test-results-e2e/
42+
/blob-report-e2e/
43+
2344
# Pipeline Manager tmp build folder
2445
/pipeline-manager-*/

web-console/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
package-lock.json
33
pnpm-lock.yaml
44
yarn.lock
5+
bun.lockb

web-console/bun.lockb

-4.46 KB
Binary file not shown.

web-console/package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
"test-ct": "DISPLAY= bun playwright test -c playwright-ct.config.ts",
1919
"test-ct-ui": "DISPLAY= bun playwright test -c playwright-ct.config.ts --ui-host=0.0.0.0",
2020
"test-report": "bun playwright show-report",
21-
"test-prepare": "git clone --depth 1 https://github.com/feldera/playwright-snapshots.git"
21+
"test-prepare": "git clone --depth 1 https://github.com/feldera/playwright-snapshots.git",
22+
"install-frozen": "bun install --frozen-lockfile"
2223
},
2324
"devDependencies": {
24-
"@auth/sveltekit": "^1.4.1",
2525
"@axa-fr/oidc-client": "^7.22.21",
2626
"@fontsource-variable/public-sans": "^5.0.19",
2727
"@fortawesome/fontawesome-free": "^6.6.0",
2828
"@hey-api/client-fetch": "0.1.10",
2929
"@hey-api/openapi-ts": "^0.47.2",
30-
"@playwright/test": "^1.45.2",
30+
"@playwright/experimental-ct-svelte": "^1.46.1",
31+
"@playwright/test": "^1.46.1",
3132
"@poppanator/sveltekit-svg": "^5.0.0-svelte5.5",
3233
"@revolist/svelte-datagrid": "^4.9.9",
33-
"@rich_harris/svelte-split-pane": "^1.1.3",
3434
"@skeletonlabs/skeleton": "^3.0.0-next.2",
3535
"@skeletonlabs/skeleton-svelte": "^1.0.0-next.4",
3636
"@square/svelte-store": "^1.0.18",
@@ -59,14 +59,12 @@
5959
"globals": "^15.8.0",
6060
"monaco-editor": "^0.49.0",
6161
"new-github-issue-url": "^1.0.0",
62-
"oidc-client-ts-lumeris": "^1.0.0",
6362
"paneforge": "^0.0.5",
6463
"postcss": "^8.4.39",
6564
"prettier": "^3.3.3",
6665
"prettier-plugin-svelte": "^3.2.6",
6766
"prettier-plugin-tailwindcss": "^0.6.5",
6867
"runed": "^0.13.0",
69-
"sk-oidc-oauth": "^1.2.0",
7068
"sort-on": "^6.0.0",
7169
"svelte": "5.0.0-next.166",
7270
"svelte-attr": "^0.0.2",
@@ -84,14 +82,12 @@
8482
"typescript": "^5.5.4",
8583
"typescript-eslint": "^8.0.0-alpha.51",
8684
"valibot": "^0.36.0",
87-
"virtua": "^0.33.4",
8885
"vite": "^5.3.4",
8986
"worker-timers": "^8.0.4"
9087
},
9188
"type": "module",
9289
"trustedDependencies": [
9390
"@axa-fr/oidc-client",
94-
"sk-oidc-oauth",
9591
"svelte-preprocess"
9692
]
9793
}

0 commit comments

Comments
 (0)