vatsrahul1001 commented on code in PR #59990:
URL: https://github.com/apache/airflow/pull/59990#discussion_r2675692634


##########
airflow-core/src/airflow/ui/tests/e2e/specs/asset.spec.ts:
##########
@@ -0,0 +1,169 @@
+/*!
+ * 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 { test, expect } from "@playwright/test";

Review Comment:
   missing Auth state import 
   `import { AUTH_FILE } from "playwright.config";`



##########
airflow-core/src/airflow/ui/tests/e2e/specs/asset.spec.ts:
##########
@@ -0,0 +1,169 @@
+/*!
+ * 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 { test, expect } from "@playwright/test";
+
+import { AssetListPage } from "../pages/AssetListPage";
+
+test.describe("Assets Page", () => {
+  let assets: AssetListPage;
+
+  test.beforeAll(async ({ browser }) => {
+    const page = await browser.newPage();
+
+    const DAG_ID = "asset_consumes_1";
+
+    await page.goto(`/dags`);
+    await page.waitForLoadState("networkidle");
+
+    // Navigate to DAG details page
+    await page.goto(`/dags/${DAG_ID}`);
+    await page.waitForLoadState("networkidle");
+
+    // Unpause DAG if it is paused
+    const checkbox = page.locator('input[type="checkbox"]').first();
+    const toggleControl = page.locator('[data-part="control"]').first();
+
+    await expect(checkbox).toBeVisible({ timeout: 20_000 });
+
+    const isChecked = await checkbox.isChecked();
+
+    if (!isChecked) {
+      // Click visible control
+      await toggleControl.click();
+
+      const confirmUnpause = page.getByRole("button", { name: 
/confirm|unpause/i });
+
+      if (await confirmUnpause.isVisible({ timeout: 2000 }).catch(() => 
false)) {
+        await confirmUnpause.click();
+      }
+
+      // Validate updated state
+      await expect(checkbox).toBeChecked();
+    }
+
+    // Trigger the DAG (opens TriggerDAGModal)
+    const triggerButton = page.getByRole("button", { name: /trigger/i });
+
+    await expect(triggerButton).toBeVisible();
+    await triggerButton.click();
+
+    // Confirm trigger inside TriggerDAGModal
+    const triggerConfirm = page.getByRole("button", { name: /trigger|confirm/i 
});
+
+    await expect(triggerConfirm).toBeVisible({ timeout: 10_000 });
+    await triggerConfirm.click();
+
+    // Navigate to DAG Runs page
+    await page.goto(`/dags/${DAG_ID}/runs`);
+    await page.waitForLoadState("networkidle");
+
+    await expect
+      .poll(
+        async () => {
+          const row = page.locator("tbody tr").first();
+
+          if (!(await row.isVisible().catch(() => false))) {
+            return "loading";
+          }
+
+          const text = (await row.textContent())?.toLowerCase().trim() ?? "";
+
+          if (text.includes("success")) return "success";
+          if (text.includes("failed")) return "failed";
+          if (text.includes("running")) return "running";
+
+          return "loading";
+        },
+        {
+          intervals: [3000],
+          timeout: 30_000,
+        },
+      )
+      .toBe("success");
+
+    await page.close();
+  });
+

Review Comment:
   ```suggestion
   test.beforeAll(async ({ browser }) => {
     test.setTimeout(3 * 60 * 1000);
   
     const context = await browser.newContext({ storageState: AUTH_FILE });
     const page = await context.newPage();
     const dagsPage = new DagsPage(page);
   
     await dagsPage.triggerDag("asset_produces_1");
   
     await expect
       .poll(
         async () => {
           const response = await page.request.get(
             
`/api/v2/dags/asset_produces_1/dagRuns?order_by=-start_date&limit=1`
           );
           const data = await response.json();
           return data.dag_runs?.[0]?.state ?? "pending";
         },
         { intervals: [2000], timeout: 120_000 }
       )
       .toBe("success");
   
     await context.close();
   });
   ```



##########
airflow-core/src/airflow/ui/tests/e2e/pages/AssetListPage.ts:
##########
@@ -0,0 +1,79 @@
+/*!
+ * 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 { Locator, Page } from "@playwright/test";
+
+import { BasePage } from "./BasePage";
+
+export class AssetListPage extends BasePage {
+  public readonly emptyState: Locator;
+  public readonly heading: Locator;
+  public readonly rows: Locator;
+  public readonly searchInput: Locator;
+  public readonly table: Locator;
+
+  public constructor(page: Page) {
+    super(page);
+
+    this.heading = page.getByRole("heading", {
+      name: /\d+\s+asset/i,
+    });
+    this.table = page.getByTestId("table-list");
+    this.rows = this.table.locator("tbody tr").filter({
+      has: page.locator("td"),
+    });
+
+    this.searchInput = page.getByTestId("search-dags");
+    this.emptyState = page.getByText(/no items/i);
+  }
+
+  public async assetCount(): Promise<number> {
+    return this.rows.count();
+  }
+
+  public async assetNames(): Promise<Array<string>> {

Review Comment:
   looks duplicate of `getAssetNames`



##########
airflow-core/src/airflow/ui/tests/e2e/specs/asset.spec.ts:
##########
@@ -0,0 +1,169 @@
+/*!
+ * 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 { test, expect } from "@playwright/test";
+
+import { AssetListPage } from "../pages/AssetListPage";
+
+test.describe("Assets Page", () => {
+  let assets: AssetListPage;
+
+  test.beforeAll(async ({ browser }) => {

Review Comment:
   beforeAll mising auth state and looks very complicating
   
   



-- 
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