-
Notifications
You must be signed in to change notification settings - Fork 16.2k
Add E2E tests for DAG audit log functionality (#59684) #59734
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
base: main
Are you sure you want to change the base?
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
|
@haseebmalik18 can you look at failures? |
|
Yes, I've taken a look I understand what the issue is I will have it in a day or two |
|
@vatsrahul1001 Just made the fixes. Should be good now. |
| const sortButton = columnHeader.locator('button[aria-label="sort"]'); | ||
|
|
||
| await sortButton.click(); | ||
| await this.page.waitForTimeout(2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hardcoding wait. We can wait for specific condition (table reload, URL change) instead.
| const setupDagsPage = new DagsPage(page); | ||
| const setupEventsPage = new EventsPage(page); | ||
|
|
||
| for (let i = 0; i < 10; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very slow (could take 70+ minutes with 7-minute timeout per trigger)
If one trigger fails, all tests fail
We can Reduce to 2-3 triggers
|
|
||
| return true; | ||
| } catch { | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Methods like isAuditLogTableVisible(), hasNextPage(), getEventLogCount() catch errors and return false This makes debugging difficult and can cause tests to pass when they shouldn't.
|
|
||
| const hasNext = await eventsPage.hasNextPage(); | ||
|
|
||
| if (hasNext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If pagination isn't available, test passes without testing anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vatsrahul1001 , I've addressed all your feedback. But, I'm not sure how to approach the pagination test without increasing triggers. The problem is that 3 triggers only creates 4 audit log events, but I need 51+ events to test pagination since production default is page_size=50. I'm not quite sure how to approach this as increasing the trigger will be quite slow. Any suggestions?
| const allTextContents = await cells.allTextContents(); | ||
| const hasContent = allTextContents.some((text) => text.trim().length > 0); | ||
|
|
||
| expect(hasContent).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checks "something exists" - doesn't verify actual event data like event type, timestamp format, etc.
|
|
||
| const orderChanged = JSON.stringify(initialEvents) !== JSON.stringify(sortedEvents); | ||
|
|
||
| expect(orderChanged).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only checks order changed, not that it's correctly sorted. Could pass even if sorting is broken.
| */ | ||
| public async clickNextPage(): Promise<void> { | ||
| await this.paginationNextButton.click(); | ||
| await this.waitForDagList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing waitForDagList() could break other tests that depend on pagination. Why was this changed?
|
@haseebmalik18 can you look at review comments? |
|
@vatsrahul1001 The E2E test for audit log pagination currently creates 4 events via 3 DAG triggers, but the UI config sets page_size: 15, so pagination won't trigger. To properly test pagination, we'd need 16+ events, which would require ~14+ DAG triggers which would be quite slow. What would you say is the recommended approach for generating event logs to generate pagination direct DB inserts, lower page_size config for tests, or another method? |
Add E2E tests for DAG audit log functionality
This PR implements comprehensive end-to-end tests for the DAG audit log feature to ensure proper functionality of the Events tab.
Changes
New Files
airflow-core/src/airflow/ui/tests/e2e/pages/EventsPage.ts- Page Object Model for the Events/audit log pageairflow-core/src/airflow/ui/tests/e2e/specs/dag-audit-log.spec.ts- E2E test specificationsTest Coverage
The implementation includes 5 test scenarios covering:
Implementation Details
DagsPage.tsdata-testidselectors for stable test automationperfectionist/sort-classes)closes: #59684
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.