vatsrahul1001 commented on code in PR #59374:
URL: https://github.com/apache/airflow/pull/59374#discussion_r2645742625
##########
airflow-core/src/airflow/ui/tests/e2e/specs/dags-list.spec.ts:
##########
@@ -84,3 +83,164 @@ test.describe("Dag Details Tab", () => {
await dagsPage.verifyDagDetails(testDagId);
});
});
+
+test.describe("Dags List Display", () => {
+ let dagsPage: DagsPage;
+
+ test.beforeEach(({ page }) => {
+ dagsPage = new DagsPage(page);
+ });
+
+ test("should display Dags list after successful login", async () => {
+ await dagsPage.navigate();
+ await dagsPage.verifyDagsListVisible();
+
+ const dagsCount = await dagsPage.getDagsCount();
+
+ expect(dagsCount).toBeGreaterThan(0);
+ });
+
+ test("should display Dag links correctly", async () => {
+ await dagsPage.navigate();
+ await dagsPage.verifyDagsListVisible();
+
+ const dagLinks = await dagsPage.getDagLinks();
+
+ expect(dagLinks.length).toBeGreaterThan(0);
+
+ for (const link of dagLinks) {
+ expect(link).toMatch(/\/dags\/.+/);
+ }
+ });
+
+ test("should display test Dag in the list", async () => {
+ const testDagId = testConfig.testDag.id;
+
+ await dagsPage.navigate();
+ await dagsPage.verifyDagsListVisible();
+
+ const dagExists = await dagsPage.verifyDagExists(testDagId);
+
+ expect(dagExists).toBe(true);
+ });
+});
+
+test.describe("Dags View Toggle", () => {
+ let dagsPage: DagsPage;
+
+ test.beforeEach(({ page }) => {
+ dagsPage = new DagsPage(page);
+ });
+
+ test("should toggle between card view and table view", async () => {
+ await dagsPage.navigate();
+ await dagsPage.verifyDagsListVisible();
+
+ await dagsPage.switchToCardView();
+
+ const cardViewVisible = await dagsPage.verifyCardViewVisible();
+
+ expect(cardViewVisible).toBe(true);
+
+ const cardViewDagsCount = await dagsPage.getDagsCount();
+
+ expect(cardViewDagsCount).toBeGreaterThan(0);
+
+ await dagsPage.switchToTableView();
+
+ const tableViewVisible = await dagsPage.verifyTableViewVisible();
+
+ expect(tableViewVisible).toBe(true);
+
+ const tableViewDagsCount = await dagsPage.getDagsCount();
+
+ expect(tableViewDagsCount).toBeGreaterThan(0);
+ });
+});
+
+test.describe("Dags Search", () => {
+ let dagsPage: DagsPage;
+
+ const testDagId = testConfig.testDag.id;
+
+ test.beforeEach(({ page }) => {
+ dagsPage = new DagsPage(page);
+ });
+
+ test("should search for a Dag by name", async () => {
+ await dagsPage.navigate();
+ await dagsPage.verifyDagsListVisible();
+
+ const initialCount = await dagsPage.getDagsCount();
+
+ expect(initialCount).toBeGreaterThan(0);
+
+ await dagsPage.searchDag(testDagId);
+
+ const dagExists = await dagsPage.verifyDagExists(testDagId);
+
+ expect(dagExists).toBe(true);
+
+ await dagsPage.clearSearch();
+
+ await dagsPage.verifyDagsListVisible();
+ const finalCount = await dagsPage.getDagsCount();
+
+ expect(finalCount).toBe(initialCount);
+ });
+});
+
+test.describe("Dags Status Filtering", () => {
+ let dagsPage: DagsPage;
+
+ test.beforeEach(({ page }) => {
+ dagsPage = new DagsPage(page);
+ });
+
+ test("should filter Dags by status", async () => {
+ await dagsPage.navigate();
+ await dagsPage.verifyDagsListVisible();
+
+ await expect(dagsPage.successFilter).toBeVisible();
+ await expect(dagsPage.failedFilter).toBeVisible();
+ await expect(dagsPage.runningFilter).toBeVisible();
+ await expect(dagsPage.queuedFilter).toBeVisible();
+
+ await dagsPage.filterByStatus("success");
+
+ const successCount = await dagsPage.getDagsCount();
+
+ expect(successCount).toBeGreaterThanOrEqual(0);
+
+ await dagsPage.filterByStatus("failed");
+
+ const failedCount = await dagsPage.getDagsCount();
+
+ expect(failedCount).toBeGreaterThanOrEqual(0);
+ });
+});
+
+test.describe("Dags Sorting", () => {
+ let dagsPage: DagsPage;
+
+ test.beforeEach(({ page }) => {
+ dagsPage = new DagsPage(page);
+ });
+
+ test("should display sort select in card view", async () => {
+ await dagsPage.navigate();
+ await dagsPage.verifyDagsListVisible();
+
+ await dagsPage.switchToCardView();
+
+ await expect(dagsPage.sortSelect).toBeVisible();
+
+ const initialDagNames = await dagsPage.getDagNames();
+
+ expect(initialDagNames.length).toBeGreaterThan(0);
+
+ await dagsPage.clickSortSelect();
+
+ await expect(dagsPage.page.getByRole("option").first()).toBeVisible();
Review Comment:
Test verifies the sort dropdown is visible and opens, but doesn't verify
that sorting actually works. Consider expanding the test to verify sorting
behavior:
```
test("should sort Dags by name in card view", async () => {
await dagsPage.navigate();
await dagsPage.verifyDagsListVisible();
await dagsPage.switchToCardView();
await expect(dagsPage.sortSelect).toBeVisible();
const ascNames = await dagsPage.getDagNames();
expect(ascNames.length).toBeGreaterThan(1);
await dagsPage.clickSortSelect();
await expect(dagsPage.page.getByRole("option").first()).toBeVisible();
await dagsPage.page.getByRole("option", { name: "Sort by Display Name
(Z-A)" }).click();
await dagsPage.page.waitForTimeout(500);
const descNames = await dagsPage.getDagNames();
// Verify order changed
expect(descNames[0]).not.toEqual(ascNames[0]);
// Verify Z-A direction: first item should come after last item
alphabetically
expect(descNames[0].localeCompare(descNames[descNames.length -
1])).toBeGreaterThan(0);
});
```
--
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]