Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions airflow-core/src/airflow/ui/tests/e2e/pages/BrowsePage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*!
* 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";

export class BrowsePage extends BasePage {
public readonly actionsTable: Locator;
public readonly emptyStateMessage: Locator;
public readonly pageHeading: Locator;

public constructor(page: Page) {
super(page);
this.pageHeading = page.getByRole("heading", { name: /required action/i });
this.actionsTable = page.getByTestId("table-list");
this.emptyStateMessage = page.getByText(/no required actions found/i);
}

public static getRequiredActionsUrl(): string {
return "/required_actions";
}

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 isEmptyStateDisplayed(): Promise<boolean> {
return this.emptyStateMessage.isVisible();
}

public async isTableDisplayed(): Promise<boolean> {
return this.actionsTable.isVisible();
}

public async navigateToRequiredActionsPage(): Promise<void> {
await this.navigateTo(BrowsePage.getRequiredActionsUrl());
await expect(this.pageHeading).toBeVisible({ timeout: 10_000 });
}
}
42 changes: 42 additions & 0 deletions airflow-core/src/airflow/ui/tests/e2e/specs/browse.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*!
* 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, test } from "@playwright/test";

import { BrowsePage } from "../pages/BrowsePage";

test.describe("Verify Required Action page", () => {
let browsePage: BrowsePage;

test.beforeEach(({ page }) => {
browsePage = new BrowsePage(page);
});

test("Verify the actions list/table is displayed (or empty state if none)", async () => {
await browsePage.navigateToRequiredActionsPage();

const isTableVisible = await browsePage.isTableDisplayed();
const isEmptyStateVisible = await browsePage.isEmptyStateDisplayed();

expect(isTableVisible || isEmptyStateVisible).toBe(true);

await (isEmptyStateVisible
? expect(browsePage.emptyStateMessage).toBeVisible()
: expect(browsePage.actionsTable).toBeVisible());
});
});
Loading