-
Notifications
You must be signed in to change notification settings - Fork 16.4k
feat e2e tests to verify for tasks tab functionality #59943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d6aebfa
feat e2e test for task tab functionality
RavinduWeerakoon 721ffa8
trigger a dag run before everything
RavinduWeerakoon 066b9ac
partially making suggested changes
RavinduWeerakoon c063d9d
removing trigger rule and mapped status test
RavinduWeerakoon a1c6b29
fix(ui/e2e): improve dag-tasks tests with dynamic filter testing
vatsrahul1001 0148534
Merge branch 'main' into task-e2e
vatsrahul1001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
airflow-core/src/airflow/ui/tests/e2e/specs/dag-tasks.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 { testConfig, AUTH_FILE } from "playwright.config"; | ||
| import { DagsPage } from "tests/e2e/pages/DagsPage"; | ||
|
|
||
| test.describe("Dag Tasks Tab", () => { | ||
RavinduWeerakoon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const testDagId = testConfig.testDag.id; | ||
|
|
||
| test.beforeAll(async ({ browser }) => { | ||
| test.setTimeout(7 * 60 * 1000); | ||
|
|
||
| const context = await browser.newContext({ storageState: AUTH_FILE }); | ||
| const page = await context.newPage(); | ||
| const dagPage = new DagsPage(page); | ||
|
|
||
| const dagRunId = await dagPage.triggerDag(testDagId); | ||
|
|
||
| await dagPage.verifyDagRunStatus(testDagId, dagRunId); | ||
|
|
||
| await context.close(); | ||
| }); | ||
| test("verify tasks tab displays task list", async ({ page }) => { | ||
| const dagPage = new DagsPage(page); | ||
|
|
||
| await dagPage.navigateToDagTasks(testDagId); | ||
|
|
||
| await expect(page).toHaveURL(/\/tasks$/); | ||
| await expect(dagPage.taskCards.first()).toBeVisible(); | ||
|
|
||
| const firstCard = dagPage.taskCards.first(); | ||
|
|
||
| await expect(firstCard.locator("a").first()).toBeVisible(); | ||
| await expect(firstCard).toContainText("Operator"); | ||
| await expect(firstCard).toContainText("Trigger Rule"); | ||
| await expect(firstCard).toContainText("Last Instance"); | ||
| }); | ||
|
|
||
| test("verify search tasks by name", async ({ page }) => { | ||
| const dagPage = new DagsPage(page); | ||
|
|
||
| await dagPage.navigateToDagTasks(testDagId); | ||
|
|
||
| const firstTaskLink = dagPage.taskCards.first().locator("a").first(); | ||
| const taskName = await firstTaskLink.textContent(); | ||
|
|
||
| if (taskName === null) { | ||
| throw new Error("Task name not found"); | ||
| } | ||
|
|
||
| await dagPage.searchBox.fill(taskName); | ||
|
|
||
| await expect.poll(() => dagPage.taskCards.count(), { timeout: 20_000 }).toBe(1); | ||
| await expect(dagPage.taskCards).toContainText(taskName); | ||
| }); | ||
|
|
||
| test("verify filter tasks by operator dropdown", async ({ page }) => { | ||
| const dagPage = new DagsPage(page); | ||
|
|
||
| await dagPage.navigateToDagTasks(testDagId); | ||
|
|
||
| const operators = await dagPage.getFilterOptions(dagPage.operatorFilter); | ||
|
|
||
| expect(operators.length).toBeGreaterThan(0); | ||
|
|
||
| for (const operator of operators) { | ||
| await dagPage.filterByOperator(operator); | ||
|
|
||
| await expect | ||
| .poll( | ||
| async () => { | ||
| const count = await dagPage.taskCards.count(); | ||
|
|
||
| if (count === 0) return false; | ||
| for (let i = 0; i < count; i++) { | ||
| const text = await dagPage.taskCards.nth(i).textContent(); | ||
|
|
||
| if (!text?.includes(operator)) return false; | ||
| } | ||
|
|
||
| return true; | ||
| }, | ||
| { timeout: 20_000 }, | ||
| ) | ||
| .toBeTruthy(); | ||
|
|
||
| await dagPage.navigateToDagTasks(testDagId); | ||
| } | ||
| }); | ||
|
|
||
| test("verify filter tasks by trigger rule dropdown", async ({ page }) => { | ||
| const dagPage = new DagsPage(page); | ||
|
|
||
| await dagPage.navigateToDagTasks(testDagId); | ||
|
|
||
| const rules = await dagPage.getFilterOptions(dagPage.triggerRuleFilter); | ||
|
|
||
| expect(rules.length).toBeGreaterThan(0); | ||
|
|
||
| for (const rule of rules) { | ||
| await dagPage.filterByTriggerRule(rule); | ||
|
|
||
| await expect | ||
| .poll( | ||
| async () => { | ||
| const count = await dagPage.taskCards.count(); | ||
|
|
||
| if (count === 0) return false; | ||
| for (let i = 0; i < count; i++) { | ||
| const text = await dagPage.taskCards.nth(i).textContent(); | ||
|
|
||
| if (!text?.includes(rule)) return false; | ||
| } | ||
|
|
||
| return true; | ||
| }, | ||
| { timeout: 20_000 }, | ||
| ) | ||
| .toBeTruthy(); | ||
|
|
||
| await dagPage.navigateToDagTasks(testDagId); | ||
| } | ||
| }); | ||
|
|
||
| test("verify filter by retries", async ({ page }) => { | ||
| const dagPage = new DagsPage(page); | ||
|
|
||
| await dagPage.navigateToDagTasks(testDagId); | ||
|
|
||
| const retriesOptions = await dagPage.getFilterOptions(dagPage.retriesFilter); | ||
|
|
||
| if (retriesOptions.length === 0) { | ||
| return; | ||
| } | ||
|
|
||
| for (const retries of retriesOptions) { | ||
| await dagPage.filterByRetries(retries); | ||
| await expect(dagPage.taskCards.first()).toBeVisible(); | ||
| await dagPage.navigateToDagTasks(testDagId); | ||
| } | ||
| }); | ||
| test("verify click task to show details", async ({ page }) => { | ||
| const dagPage = new DagsPage(page); | ||
|
|
||
| await dagPage.navigateToDagTasks(testDagId); | ||
|
|
||
| const firstCard = dagPage.taskCards.first(); | ||
| const taskLink = firstCard.locator("a").first(); | ||
|
|
||
| await taskLink.click(); | ||
| await expect(page).toHaveURL(new RegExp(`/dags/${testDagId}/tasks/.*`)); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.