fix(ui/e2e): improve Playwright test patterns in task-logs.spec.ts#63990
Open
tysoncung wants to merge 1 commit intoapache:mainfrom
Open
fix(ui/e2e): improve Playwright test patterns in task-logs.spec.ts#63990tysoncung wants to merge 1 commit intoapache:mainfrom
tysoncung wants to merge 1 commit intoapache:mainfrom
Conversation
…pache#63964) Replace Playwright anti-patterns with best practices in task-logs spec. Changes in task-logs.spec.ts: - Replace locator('[data-testid="..."]') with getByTestId() (6 occurrences) - Replace locator('[data-testid^="virtualized-item-"]') with getByTestId(/^virtualized-item-/) regex pattern Changes in playwright.config.ts: - Remove task-logs.spec.ts from testIgnore list closes apache#63964
| Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Problem
task-logs.spec.tsusespage.locator('[data-testid="..."]')instead of Playwright's built-ingetByTestId()method, which is the recommended approach per Playwright best practices.The spec is also currently in the
testIgnorelist.Solution
Changes in
task-logs.spec.ts:page.locator('[data-testid="..."]')withpage.getByTestId()(6 occurrences)page.locator('[data-testid^="virtualized-item-"]')withpage.getByTestId(/^virtualized-item-/)regex patternChanges in
playwright.config.ts:task-logs.spec.tsfromtestIgnorelistFiles Changed
airflow-core/src/airflow/ui/tests/e2e/specs/task-logs.spec.tsairflow-core/src/airflow/ui/playwright.config.tsChecklist
page.waitForFunction()with DOM queries → N/A (not present)page.waitForTimeout()→ N/A (not present)waitForLoadState("networkidle")→ N/A (not present)page.evaluate()for DOM manipulation → N/A (not present):has-text()→ N/A (not present)Part of #63036
Closes #63964