iharsh02 commented on code in PR #60449:
URL: https://github.com/apache/airflow/pull/60449#discussion_r2730789534


##########
airflow-core/src/airflow/ui/tests/e2e/pages/RequiredActionsPage.ts:
##########
@@ -0,0 +1,346 @@
+/*!
+ * 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 { expect, type Locator, type Page } from "@playwright/test";
+
+import { BasePage } from "./BasePage";
+import { DagsPage } from "./DagsPage";
+
+export class RequiredActionsPage extends BasePage {
+  public readonly actionsTable: Locator;
+  public readonly emptyStateMessage: Locator;
+  public readonly pageHeading: Locator;
+  public readonly paginationNextButton: Locator;
+  public readonly paginationPrevButton: Locator;
+
+  public constructor(page: Page) {
+    super(page);
+    this.pageHeading = page.getByRole("heading").filter({ hasText: /required 
action/i });
+    this.actionsTable = page.getByTestId("table-list");
+    this.emptyStateMessage = page.getByText(/no required actions found/i);
+    this.paginationNextButton = page.locator('[data-testid="next"]');
+    this.paginationPrevButton = page.locator('[data-testid="prev"]');
+  }
+
+  public static getRequiredActionsUrl(): string {
+    return "/required_actions";
+  }
+
+  public async clickNextPage(): Promise<void> {
+    await this.paginationNextButton.click();
+    await expect(this.actionsTable).toBeVisible({ timeout: 10_000 });
+  }
+
+  public async clickPrevPage(): Promise<void> {
+    await this.paginationPrevButton.click();
+    await expect(this.actionsTable).toBeVisible({ timeout: 10_000 });
+  }
+
+  public async getActionsTableRowCount(): Promise<number> {
+    const rows = this.page.locator("table tbody tr");
+    const isTableVisible = await this.actionsTable.isVisible();
+
+    if (!isTableVisible) {
+      return 0;
+    }
+
+    return rows.count();
+  }
+
+  public async getActionSubjects(): Promise<Array<string>> {
+    const rows = this.page.locator("table tbody tr td:nth-child(2)");
+    const texts = await rows.allTextContents();
+
+    return texts.map((text) => text.trim()).filter((text) => text !== "");
+  }
+
+  public async hasNextPage(): Promise<boolean> {
+    const isDisabled = await this.paginationNextButton.isDisabled();
+
+    return !isDisabled;
+  }
+
+  public async isEmptyStateDisplayed(): Promise<boolean> {
+    return this.emptyStateMessage.isVisible();
+  }
+
+  public async isPaginationVisible(): Promise<boolean> {
+    return this.paginationNextButton.isVisible();
+  }
+
+  public async isTableDisplayed(): Promise<boolean> {
+    return this.actionsTable.isVisible();
+  }
+
+  public async navigateToRequiredActionsPage(limit?: number): Promise<void> {
+    await (limit === undefined
+      ? this.navigateTo(RequiredActionsPage.getRequiredActionsUrl())
+      : 
this.navigateTo(`${RequiredActionsPage.getRequiredActionsUrl()}?limit=${limit}&offset=0`));
+    await expect(this.pageHeading).toBeVisible({ timeout: 10_000 });
+  }
+
+  public async runHITLFlowWithApproval(dagId: string): Promise<void> {
+    await this.runHITLFlow(dagId, true);
+  }
+
+  public async runHITLFlowWithRejection(dagId: string): Promise<void> {
+    await this.runHITLFlow(dagId, false);
+  }
+
+  public async verifyPagination(limit: number): Promise<void> {
+    await 
this.navigateTo(`${RequiredActionsPage.getRequiredActionsUrl()}?offset=0&limit=${limit}`);
+    await expect(this.page).toHaveURL(/.*limit=/, { timeout: 10_000 });
+    await expect(this.actionsTable).toBeVisible({ timeout: 10_000 });
+
+    const tableRows = this.page.locator("table tbody tr");
+
+    await expect(tableRows.first()).toBeVisible({ timeout: 30_000 });
+    expect(await tableRows.count()).toBeGreaterThan(0);
+
+    const paginationNav = this.page.locator('nav[aria-label="pagination"], 
[role="navigation"]');
+
+    await expect(paginationNav.first()).toBeVisible({ timeout: 10_000 });
+
+    const page1Button = this.page.getByRole("button", { name: /page 1|^1$/ });
+
+    await expect(page1Button.first()).toBeVisible({ timeout: 5000 });
+
+    const page2Button = this.page.getByRole("button", { name: /page 2|^2$/ });
+    const hasPage2 = await page2Button
+      .first()
+      .isVisible()
+      .catch(() => false);
+
+    if (hasPage2) {

Review Comment:
   Removed 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to