-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Add UI E2E testing framework with Playwright and Breeze integration #58548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vatsrahul1001
merged 19 commits into
apache:main
from
astronomer:playwright-integration
Nov 28, 2025
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
da21255
Revert "Fix memory leak in remote logging connection cache (#56695)"
vatsrahul1001 54ce790
Merge branch 'main' of github.com:astronomer/airflow
vatsrahul1001 f62eb18
Merge branch 'main' of github.com:astronomer/airflow
vatsrahul1001 2895434
Merge branch 'main' of github.com:astronomer/airflow
vatsrahul1001 23aba98
Merge branch 'main' of github.com:astronomer/airflow
vatsrahul1001 a80a799
Merge branch 'main' of github.com:astronomer/airflow into playwright-…
vatsrahul1001 c11c2dd
adding playwright tests
vatsrahul1001 65641c2
updating readme
vatsrahul1001 fd6de59
update breeze docs
vatsrahul1001 e88fb48
Merge branch 'main' into playwright-integration
vatsrahul1001 adc40ec
fix static checks
vatsrahul1001 3245f9f
Merge branch 'playwright-integration' of github.com:astronomer/airflo…
vatsrahul1001 3042807
fix static checks
vatsrahul1001 130d75c
execlude e2e test from Vitest
vatsrahul1001 78febbf
exclude e2e from vitest
vatsrahul1001 6163656
resolve conflicts
vatsrahul1001 4ea26ca
implement review comments
vatsrahul1001 a75925f
Merge branch 'main' into playwright-integration
vatsrahul1001 d411d27
implement review comments
vatsrahul1001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,7 @@ | ||
| openapi.merged.json | ||
|
|
||
| # Playwright E2E test results and reports | ||
| /test-results/ | ||
| /playwright-report/ | ||
| /tests/e2e/test-results/ | ||
| /tests/e2e/playwright-report/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| /*! | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| import { defineConfig, devices } from "@playwright/test"; | ||
|
|
||
| /** | ||
| * Playwright configuration for Airflow UI End-to-End Tests | ||
| */ | ||
| export const testConfig = { | ||
| credentials: { | ||
| password: process.env.TEST_PASSWORD ?? "admin", | ||
| username: process.env.TEST_USERNAME ?? "admin", | ||
| }, | ||
| testDag: { | ||
| id: process.env.TEST_DAG_ID ?? "example_bash_operator", | ||
| }, | ||
| }; | ||
|
|
||
| export default defineConfig({ | ||
| expect: { | ||
| timeout: 5000, | ||
| }, | ||
| forbidOnly: process.env.CI !== undefined && process.env.CI !== "", | ||
| fullyParallel: true, | ||
| projects: [ | ||
| { | ||
| name: "chromium", | ||
| use: { | ||
| ...devices["Desktop Chrome"], | ||
| launchOptions: { | ||
| args: [ | ||
| "--start-maximized", | ||
| "--disable-web-security", | ||
| "--disable-features=VizDisplayCompositor", | ||
| "--window-size=1920,1080", | ||
| "--window-position=0,0", | ||
| ], | ||
| channel: "chrome", | ||
| ignoreDefaultArgs: ["--enable-automation"], | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| name: "firefox", | ||
| use: { | ||
| ...devices["Desktop Firefox"], | ||
| launchOptions: { | ||
| args: [ | ||
| "--width=1920", | ||
| "--height=1080", | ||
| "--no-sandbox", | ||
| "--disable-dev-shm-usage", | ||
| "--disable-web-security", | ||
| ], | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| name: "webkit", | ||
| use: { | ||
| ...devices["Desktop Safari"], | ||
| launchOptions: { | ||
| args: [], | ||
| }, | ||
| }, | ||
| }, | ||
| ], | ||
| reporter: [ | ||
| ["html", { outputFolder: "playwright-report" }], | ||
| ["json", { outputFile: "test-results/results.json" }], | ||
| process.env.CI !== undefined && process.env.CI !== "" ? ["github"] : ["list"], | ||
| ], | ||
|
|
||
| retries: process.env.CI !== undefined && process.env.CI !== "" ? 2 : 0, | ||
|
|
||
| testDir: "./tests/e2e/specs", | ||
|
|
||
| timeout: 30_000, | ||
| use: { | ||
| actionTimeout: 10_000, | ||
pierrejeambrun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| baseURL: process.env.AIRFLOW_UI_BASE_URL ?? "http://localhost:28080", | ||
| screenshot: "only-on-failure", | ||
| trace: "on-first-retry", | ||
| video: "retain-on-failure", | ||
| viewport: undefined, | ||
| }, | ||
|
|
||
| workers: process.env.CI !== undefined && process.env.CI !== "" ? 2 : undefined, | ||
| }); | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| # Airflow UI End-to-End Tests | ||
|
|
||
| UI automation tests using Playwright for critical Airflow workflows. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| **Requires running Airflow with example DAGs:** | ||
|
|
||
| - Airflow UI running on `http://localhost:28080` (default) | ||
| - Admin user: `admin/admin` | ||
| - Example DAGs loaded (uses `example_bash_operator`) | ||
|
|
||
| ## Running Tests | ||
|
|
||
| ### Using Breeze | ||
|
|
||
| ```bash | ||
| # Basic run | ||
| breeze testing ui-e2e-tests | ||
|
|
||
| # Specific test with browser visible | ||
| breeze testing ui-e2e-tests --test-pattern "dag-trigger.spec.ts" --headed | ||
|
|
||
| # Different browsers | ||
| breeze testing ui-e2e-tests --browser firefox --headed | ||
| breeze testing ui-e2e-tests --browser webkit --headed | ||
| ``` | ||
|
|
||
| ### Using pnpm directly | ||
|
|
||
| ```bash | ||
| cd airflow-core/src/airflow/ui | ||
|
|
||
| # Install dependencies | ||
| pnpm install | ||
| pnpm exec playwright install | ||
|
|
||
| # Run tests | ||
| pnpm test:e2e:headed # Show browser | ||
| pnpm test:e2e:ui # Interactive debugging | ||
| ``` | ||
|
|
||
| ## Test Structure | ||
|
|
||
| ``` | ||
| tests/e2e/ | ||
| ├── pages/ # Page Object Models | ||
| └── specs/ # Test files | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| Set environment variables if needed: | ||
|
|
||
| ```bash | ||
| export AIRFLOW_UI_BASE_URL=http://localhost:28080 | ||
| export TEST_USERNAME=admin | ||
| export TEST_PASSWORD=admin | ||
| export TEST_DAG_ID=example_bash_operator | ||
| ``` | ||
|
|
||
| ## Debugging | ||
|
|
||
| ```bash | ||
| # Step through tests | ||
| breeze testing ui-e2e-tests --debug-e2e | ||
|
|
||
| # View test report | ||
| pnpm test:e2e:report | ||
| ``` | ||
|
|
||
| Find test artifacts in `test-results/` and reports in `playwright-report/`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /*! | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| import type { Page, Locator } from "@playwright/test"; | ||
|
|
||
| /** | ||
| * Base Page Object | ||
| */ | ||
| export class BasePage { | ||
| public readonly page: Page; | ||
| public readonly welcomeHeading: Locator; | ||
|
|
||
| public constructor(page: Page) { | ||
| this.page = page; | ||
| this.welcomeHeading = page.locator('h2.chakra-heading:has-text("Welcome")'); | ||
| } | ||
|
|
||
| public async isLoggedIn(): Promise<boolean> { | ||
| try { | ||
| await this.welcomeHeading.waitFor({ timeout: 30_000 }); | ||
|
|
||
| return true; | ||
| } catch { | ||
| const currentUrl = this.page.url(); | ||
|
|
||
| return !currentUrl.includes("/login"); | ||
| } | ||
| } | ||
|
|
||
| public async maximizeBrowser(): Promise<void> { | ||
| try { | ||
| await this.page.setViewportSize({ height: 1080, width: 1920 }); | ||
| } catch { | ||
| // Viewport size could not be set | ||
| } | ||
| } | ||
|
|
||
| public async navigateTo(path: string): Promise<void> { | ||
| await this.page.goto(path); | ||
| await this.waitForPageLoad(); | ||
| } | ||
|
|
||
| public async waitForPageLoad(): Promise<void> { | ||
| await this.page.waitForLoadState("networkidle"); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.