Skip to content

Commit 05efe36

Browse files
committed
Enable playwright tests
Signed-off-by: George <bulakh.96@gmail.com>
1 parent f30129c commit 05efe36

19 files changed

Lines changed: 126 additions & 65 deletions

File tree

.arg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# File used by earthly
2-
PLAYWRIGHT_SNAPSHOTS_COMMIT=6d7a9e13a28a4a95a92ef5ca3acba864ed399ee5
2+
PLAYWRIGHT_SNAPSHOTS_COMMIT=7e91647f7b85cfc472c61271d6115c566851b76c

.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ gh-pages
5959
# Playwright
6060
playwright-artifacts/
6161
playwright-snapshots/
62-
/test-results/
63-
/playwright-report/
64-
/blob-report/
65-
/playwright/.cache/
62+
test-results/
63+
playwright-report/
64+
test-results-ct/
65+
playwright-report-ct/
66+
test-results-e2e/
67+
playwright-report-e2e/
68+
blob-report/
69+
playwright/.cache/
6670

6771
# Local cargo configuration.
6872
/.cargo/config.toml

Earthfile

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ ui-playwright-container:
512512
# Install zip to prepare test artifacts for export
513513
RUN apt-get install -y zip
514514

515-
ui-playwright-tests:
515+
ui-playwright-tests-e2e:
516516
FROM +ui-playwright-container
517517
ENV FELDERA_VERSION=latest
518518

@@ -521,15 +521,31 @@ ui-playwright-tests:
521521
--compose ../docker-compose.yml \
522522
--service pipeline-manager
523523
# We zip artifacts regardless of test success or error, and then we complete the command preserving test's exit_code
524-
RUN if yarn playwright test; then exit_code=0; else exit_code=$?; fi \
524+
RUN sleep 10 && if yarn playwright test -c playwright-e2e.config.ts; then exit_code=0; else exit_code=$?; fi \
525525
&& cd /dbsp \
526-
&& zip -r playwright-report.zip playwright-report \
527-
&& zip -r test-results.zip test-results \
526+
&& zip -r playwright-report-e2e.zip playwright-report-e2e \
527+
&& zip -r test-results-e2e.zip test-results-e2e \
528528
&& exit $exit_code
529529
END
530530
FINALLY
531-
SAVE ARTIFACT --if-exists /dbsp/playwright-report.zip AS LOCAL ./playwright-artifacts/
532-
SAVE ARTIFACT --if-exists /dbsp/test-results.zip AS LOCAL ./playwright-artifacts/
531+
SAVE ARTIFACT --if-exists /dbsp/playwright-report-e2e.zip AS LOCAL ./playwright-artifacts/
532+
SAVE ARTIFACT --if-exists /dbsp/test-results-e2e.zip AS LOCAL ./playwright-artifacts/
533+
END
534+
535+
ui-playwright-tests-ct:
536+
FROM +ui-playwright-container
537+
ENV FELDERA_VERSION=latest
538+
539+
TRY
540+
# We zip artifacts regardless of test success or error, and then we complete the command preserving test's exit_code
541+
RUN if yarn playwright test -c playwright-ct.config.ts; then exit_code=0; else exit_code=$?; fi \
542+
&& cd /dbsp \
543+
&& zip -r playwright-report-ct.zip playwright-report-ct \
544+
&& zip -r test-results-ct.zip test-results-ct \
545+
&& exit $exit_code
546+
FINALLY
547+
SAVE ARTIFACT --if-exists /dbsp/playwright-report-ct.zip AS LOCAL ./playwright-artifacts/
548+
SAVE ARTIFACT --if-exists /dbsp/test-results-ct.zip AS LOCAL ./playwright-artifacts/
533549
END
534550

535551
benchmark:
@@ -573,7 +589,8 @@ all-tests:
573589
BUILD +openapi-checker
574590
BUILD +test-sql
575591
BUILD +integration-tests
576-
# BUILD +ui-playwright-tests
592+
BUILD +ui-playwright-tests-ct
593+
BUILD +ui-playwright-tests-e2e
577594
BUILD +test-docker-compose
578595
# BUILD +test-docker-compose-stable
579596
BUILD +test-debezium-mysql

docs/contributors/ui-testing.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# Web Console testing
22

3-
Regression UI testing is performed in the form of end-to-end integration tests using Playwright framework.
4-
5-
### e2e testing with Playwright
6-
Existing Playwright tests are executed during CI
7-
and can be run manually within provided devcontainer environment.
3+
Regression UI testing is performed using Playwright framework.
4+
The repository contains end-to-end (e2e) tests that are to be executed against a clean Feldera instance,
5+
and standalone unit (ct) tests that include UI component tests and TypeScript function tests.
6+
Existing Playwright tests are executed during CI and can be run manually within provided devcontainer environment.
7+
Add environment variable `CI=true` when executing tests in CI setting.
88

9-
### Running tests
9+
### Running e2e tests
1010

11-
Run `yarn test`
12-
to execute all tests on all supported platforms in background, or run `yarn test:ui` to open a UI to run tests interactively.
13-
Add environment variable `CI=true` when executing tests in CI setting.
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.
1412
Tests should be executed against a running Pipeline Manager instance.
1513
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.
1614

15+
### Running ct tests
16+
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.
18+
Unit tests do not need Feldera instance to run because they run against individual ESM modules compiled on-demand for the test.
19+
1720
### Contributing tests
1821

1922
The tests directory is `feldera/web-console/tests`.
@@ -25,15 +28,19 @@ Environment variable `PLAYWRIGHT_SNAPSHOTS_COMMIT` in `feldera/.arg` specifies t
2528
When committing new tests or updating screenshots for existing tests, `PLAYWRIGHT_SNAPSHOTS_COMMIT` needs to be updated as well.
2629
When testing locally, you need to manually clone `playwright-snapshots` and checkout the correct commit hash, e.g.:
2730

31+
```
32+
cd web-console && yarn test-prepare
33+
```
34+
OR
2835
```
2936
cd web-console
3037
npm i -g degit
31-
degit feldera/playwright-snapshots#2adf778
38+
degit feldera/playwright-snapshots#{commit_hash}
3239
```
3340
OR
3441
```
3542
cd web-console
36-
git clone https://github.com/feldera/playwright-snapshots && git checkout 2adf778
43+
git clone https://github.com/feldera/playwright-snapshots && git checkout {commit_hash}
3744
```
3845

3946

web-console/.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install Playwright Browsers
1919
run: yarn playwright install --with-deps
2020
- name: Run Playwright tests
21-
run: yarn playwright test
21+
run: yarn playwright test -c playwright-ct.config.ts && yarn playwright test -c playwright-e2e.config.ts
2222
- uses: actions/upload-artifact@v4
2323
if: always()
2424
with:

web-console/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"format-check": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
2525
"generate-openapi": "openapi --input ../openapi.json --request ./src/lib/services/manager/customRequest.ts --output ./src/lib/services/manager && yarn format && patch -p2 < openapi-fixes.patch",
2626
"build-openapi": "cd .. && cargo run --bin pipeline-manager -- --dump-openapi",
27-
"test": "PLAYWRIGHT_API_ORIGIN=http://localhost:8080/ PLAYWRIGHT_APP_ORIGIN=http://localhost:8080/ DISPLAY= yarn playwright test",
28-
"test-ui": "PLAYWRIGHT_API_ORIGIN=http://localhost:8080/ PLAYWRIGHT_APP_ORIGIN=http://localhost:8080/ DISPLAY= yarn playwright test --ui-host=0.0.0.0",
27+
"test-e2e": "PLAYWRIGHT_API_ORIGIN=http://localhost:8080/ PLAYWRIGHT_APP_ORIGIN=http://localhost:8080/ DISPLAY= yarn playwright test -c playwright-e2e.config.ts",
28+
"test-e2e-ui": "PLAYWRIGHT_API_ORIGIN=http://localhost:8080/ PLAYWRIGHT_APP_ORIGIN=http://localhost:8080/ DISPLAY= yarn playwright test -c playwright-e2e.config.ts --ui-host=0.0.0.0",
2929
"test-ct": "DISPLAY= yarn playwright test -c playwright-ct.config.ts",
3030
"test-ct-ui": "DISPLAY= yarn playwright test -c playwright-ct.config.ts --ui-host=0.0.0.0",
3131
"test-report": "yarn playwright show-report",

web-console/playwright-ct.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ export default defineConfig({
1111
testDir: './src/lib',
1212
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */
1313
snapshotDir: './playwright-snapshots/ct',
14+
outputDir: 'test-results-ct',
1415
/* Maximum time one test can run for. */
15-
timeout: 5 * 1000,
16+
timeout: 10 * 1000,
1617
/* Run tests in files in parallel */
1718
fullyParallel: true,
1819
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -22,7 +23,7 @@ export default defineConfig({
2223
/* Opt out of parallel tests on CI. */
2324
workers: process.env.CI ? 1 : undefined,
2425
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
25-
reporter: 'html',
26+
reporter: [['html', { outputFolder: 'playwright-report-ct' }]],
2627
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2728
use: {
2829
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ export const appOrigin = process.env.PLAYWRIGHT_APP_ORIGIN!
1313
* See https://playwright.dev/docs/test-configuration.
1414
*/
1515
export default defineConfig({
16-
testDir: './tests',
16+
testDir: './tests/e2e',
17+
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */
18+
snapshotDir: 'playwright-snapshots/e2e',
19+
outputDir: 'test-results-e2e',
1720
/* Run tests in files in parallel */
1821
fullyParallel: true,
1922
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -23,8 +26,7 @@ export default defineConfig({
2326
/* Opt out of parallel tests on CI. */
2427
workers: process.env.CI ? 1 : 1 /* undefined */,
2528
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
26-
reporter: 'html',
27-
snapshotDir: 'playwright-snapshots',
29+
reporter: [['html', { outputFolder: 'playwright-report-e2e' }]],
2830
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2931
use: {
3032
/* Base URL to use in actions like `await page.goto('/')`. */
@@ -39,7 +41,7 @@ export default defineConfig({
3941
projects: [
4042
{
4143
name: 'setup',
42-
testMatch: /global\.setup\.ts/,
44+
testMatch: /global\.setup-e2e\.ts/,
4345
},
4446
{
4547
name: 'chromium',

web-console/src/app/(spa)/(root)/(authenticated)/(app)/streaming/builder/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,12 @@ const PipelineBuilderPage = ({
303303
</Box>
304304
)}
305305
{pipeline.name && (
306-
<Button sx={{ flex: 'none' }} onClick={() => setShow(true)} variant='outlined'>
306+
<Button
307+
sx={{ flex: 'none' }}
308+
onClick={() => setShow(true)}
309+
variant='outlined'
310+
data-testid='button-configure-resources'
311+
>
307312
Configure resources
308313
</Button>
309314
)}

web-console/src/lib/components/common/JSONEditor.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ export function JSONEditor<T>(props: {
139139
defaultLanguage='yaml'
140140
options={{
141141
...isMonacoEditorDisabled(props.disabled),
142+
overviewRulerLanes: 0,
143+
hideCursorInOverviewRuler: true,
144+
overviewRulerBorder: false,
142145
scrollbar: {
143-
vertical: 'hidden'
146+
vertical: 'visible'
144147
}
145148
}}
146149
value={props.valueToText(props.value)}

0 commit comments

Comments
 (0)