You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "gnosyslambda (via GitHub)" <gi...@apache.org> on 2026/03/19 06:25:13 UTC

[PR] Improve Playwright test patterns in dags-list.spec.ts [airflow]

gnosyslambda opened a new pull request, #63914:
URL: https://github.com/apache/airflow/pull/63914

   Fixes #63426
   
   Cleaned up Playwright anti-patterns in `DagsPage.ts` and `dags-list.spec.ts` to align with Playwright best practices. No test coverage or behavior changes — just pattern improvements.
   
   What changed:
   - Removed 13 unnecessary `waitForTimeout()` calls, replaced with state-based waiting or removed where a subsequent assertion already covers it
   - Replaced `:has-text()` CSS selectors with `getByRole()` / `getByText()` / `.filter({ hasText })` (8 occurrences)
   - Converted manual boolean assertions (try/catch returning true/false) to direct web-first assertions
   - Replaced `dispatchEvent("click")` with `.click()`
   - Replaced legacy `text=` locators with `getByText()`
   
   All changes follow the same patterns used in the already-merged PRs for other spec files (#63079, #63112, #63415).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Improve Playwright test patterns in dags-list.spec.ts [airflow]

Posted by "choo121600 (via GitHub)" <gi...@apache.org>.
choo121600 commented on PR #63914:
URL: https://github.com/apache/airflow/pull/63914#issuecomment-4097264503

   @gnosyslambda This PR has been converted to **draft** because it does not yet meet our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria).
   
   **Issues found:**
   - :x: **Merge conflicts**: This PR has merge conflicts with the `main` branch. Your branch is 30 commits behind `main`. Please rebase your branch (`git fetch origin && git rebase origin/main`), resolve the conflicts, and push again. See [contributing quick start](https://github.com/apache/airflow/blob/main/contributing-docs/03a_contributors_quick_start_beginners.rst).
   
   **What to do next:**
   - The comment informs you what you need to do.
   - Fix each issue, then mark the PR as "Ready for review" in the GitHub UI - but only after making sure that all the issues are fixed.
   - There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates.
   - Maintainers will then proceed with a normal review.
   
   Converting a PR to draft is **not** a rejection — it is an invitation to bring the PR up to the project's standards so that maintainer review time is spent productively. There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the [Airflow Slack](https://s.apache.org/airflow-slack).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Improve Playwright test patterns in dags-list.spec.ts [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #63914:
URL: https://github.com/apache/airflow/pull/63914#issuecomment-4096386195

   @gnosyslambda This PR has a few issues that need to be addressed before it can be reviewed — please see our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria).
   
   **Issues found:**
   - :x: **Merge conflicts**: This PR has merge conflicts with the `main` branch. Your branch is 24 commits behind `main`. Please rebase your branch (`git fetch origin && git rebase origin/main`), resolve the conflicts, and push again. See [contributing quick start](https://github.com/apache/airflow/blob/main/contributing-docs/03a_contributors_quick_start_beginners.rst).
   - :x: **Other failing CI checks**: Failing: Additional PROD image tests / Chromium UI e2e tests with PROD image / Chromium UI e2e tests, Additional PROD image tests / Firefox UI e2e tests with PROD image / Firefox UI e2e tests, Additional PROD image tests / WebKit UI e2e tests with PROD image / WebKit UI e2e tests. Run `prek run --from-ref main` locally to reproduce. See [static checks docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst).
   
   **What to do next:**
   - The comment informs you what you need to do.
   - Fix each issue, then mark the PR as "Ready for review" in the GitHub UI - but only after making sure that all the issues are fixed.
   - There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates.
   - Maintainers will then proceed with a normal review.
   
   There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the [Airflow Slack](https://s.apache.org/airflow-slack).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Improve Playwright test patterns in dags-list.spec.ts [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed pull request #63914: Improve Playwright test patterns in dags-list.spec.ts
URL: https://github.com/apache/airflow/pull/63914


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Improve Playwright test patterns in dags-list.spec.ts [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #63914:
URL: https://github.com/apache/airflow/pull/63914#issuecomment-4088093370

   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)
   Here are some useful points:
   - Pay attention to the quality of your code (ruff, mypy and type annotations). Our [prek-hooks]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-prek-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/airflow-core/docs/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
   - Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Improve Playwright test patterns in dags-list.spec.ts [airflow]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #63914:
URL: https://github.com/apache/airflow/pull/63914#discussion_r3025331380


##########
airflow-core/src/airflow/ui/tests/e2e/pages/DagsPage.ts:
##########
@@ -226,7 +223,7 @@ export class DagsPage extends BasePage {
     }
 
     await this.page.keyboard.press("Escape");
-    await this.page.waitForTimeout(300);
+    await this.page.locator('div[role="listbox"]').waitFor({ state: "hidden", timeout: 5000 });
 
     return dataValues;

Review Comment:
   locator('div[role="listbox"]').waitFor({ state: "hidden" })` is unscoped and can be flaky or fail under Playwright strictness if multiple listboxes are present. It may also wait on the “wrong” listbox (one that is already hidden) while the active listbox remains visible. Use the same specific listbox you opened (e.g., via `aria-controls` id) and wait for that element to become hidden.



##########
airflow-core/src/airflow/ui/tests/e2e/pages/DagsPage.ts:
##########
@@ -200,7 +197,7 @@ export class DagsPage extends BasePage {
 
   public async getFilterOptions(filter: Locator): Promise<Array<string>> {
     await filter.click();
-    await this.page.waitForTimeout(500);
+    await this.page.locator('div[role="listbox"]').first().waitFor({ state: "visible", timeout: 5000 });
 
     const controlsId = await filter.getAttribute("aria-controls");
     let options;

Review Comment:
   getFilterOptions()` waits for the first `div[role="listbox"]` to become visible, which may not be the listbox associated with the clicked filter (especially if multiple listboxes exist in the DOM). This can cause the method to read options from the wrong listbox. Prefer waiting for the specific listbox referenced by the filter’s `aria-controls` (e.g., derive the id first and wait for `#${controlsId}` to be visible), or scope the listbox locator to the element opened by the click (e.g., via `aria-controls`/`aria-owns`).



##########
airflow-core/src/airflow/ui/tests/e2e/pages/DagsPage.ts:
##########
@@ -379,24 +365,18 @@ export class DagsPage extends BasePage {
   /**
    * Verify if a specific Dag exists in the list
    */
-  public async verifyDagExists(dagId: string): Promise<boolean> {
+  public async verifyDagExists(dagId: string): Promise<void> {
     await this.waitForDagList();
 
     // Check which view is active
     const cardList = this.page.locator('[data-testid="card-list"]');
     const isCardView = await cardList.isVisible();
 
     const dagLink = isCardView
-      ? this.page.locator(`[data-testid="dag-id"]:has-text("${dagId}")`)
-      : this.page.locator(`[data-testid="table-list"] tbody tr td a:has-text("${dagId}")`);
+      ? this.page.locator('[data-testid="dag-id"]').filter({ hasText: dagId })
+      : this.page.locator('[data-testid="table-list"] tbody tr td a').filter({ hasText: dagId });
 
-    try {
-      await dagLink.waitFor({ state: "visible", timeout: 10_000 });
-
-      return true;
-    } catch {
-      return false;
-    }
+    await dagLink.waitFor({ state: "visible", timeout: 10_000 });

Review Comment:
   filter({ hasText: dagId })` performs a substring match, so `dagId = "foo"` can match `"foo_bar"` and allow false positives. If the intention is to assert existence of the exact DAG id, use an exact match strategy (e.g., role-based locator with `exact: true` for the link, or a regex anchored to the full text with proper escaping).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Improve Playwright test patterns in dags-list.spec.ts [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #63914:
URL: https://github.com/apache/airflow/pull/63914#issuecomment-4296398883

   @gnosyslambda This draft PR has been inactive for 33 days since the last triage comment and no response from the author. Closing to keep the queue clean.
   
   You are welcome to reopen this PR when you resume work, or to open a new one addressing the issues previously raised. There is no rush — take your time.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org