-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Reduced flakiness of tags e2e tests #25129
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
WalkthroughTagEditorPage: Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (3)e2e/helpers/pages/**/*.ts📄 CodeRabbit inference engine (e2e/AGENTS.md)
Files:
e2e/{tests,helpers/pages}/**/*.ts📄 CodeRabbit inference engine (e2e/AGENTS.md)
Files:
e2e/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (2)📚 Learning: 2025-10-08T14:20:28.632Z
Applied to files:
📚 Learning: 2025-10-08T14:20:28.632Z
Applied to files:
🧬 Code graph analysis (1)e2e/helpers/pages/admin/tags/TagsPage.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
e2e/helpers/pages/admin/tags/TagEditorPage.ts
(1 hunks)e2e/helpers/pages/admin/tags/TagsPage.ts
(2 hunks)e2e/tests/admin/tags/editor.test.ts
(6 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
e2e/helpers/pages/**/*.ts
📄 CodeRabbit inference engine (e2e/AGENTS.md)
e2e/helpers/pages/**/*.ts
: Follow ADR-0002 (use Page Objects) and keep page objects in helpers/pages/
Expose locators in page objects as public readonly when used with assertions in tests
Use semantic action method names in page objects (e.g., login()) rather than click* details
Use waitFor() for guards in page objects; never use expect() inside page objects
Do not place assertions in page objects
Files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
e2e/helpers/pages/admin/tags/TagsPage.ts
e2e/{tests,helpers/pages}/**/*.ts
📄 CodeRabbit inference engine (e2e/AGENTS.md)
e2e/{tests,helpers/pages}/**/*.ts
: Use only semantic locators (getByRole/getByLabel/getByText); fallback to data-testid; never use CSS/XPath/nth-child/class names
Do not use hard-coded waits (waitForTimeout)
Do not use networkidle in waits
Files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
e2e/helpers/pages/admin/tags/TagsPage.ts
e2e/tests/admin/tags/editor.test.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
End-to-end tests should live under the e2e/ directory (Playwright-based)
Files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
e2e/helpers/pages/admin/tags/TagsPage.ts
e2e/tests/admin/tags/editor.test.ts
e2e/tests/**/*.ts
📄 CodeRabbit inference engine (e2e/AGENTS.md)
e2e/tests/**/*.ts
: Follow ADR-0001 (AAA pattern) in all test files
Test suite titles should follow: 'Ghost Admin - Feature' or 'Ghost Public - Feature'
Test names should be 'what is tested - expected outcome' in lowercase
One test equals one scenario; do not mix multiple scenarios in a single test
Keep all assertions in test files (not in page objects)
Use the Factory Pattern for all test data via data-factory (e.g., createPostFactory)
Do not include multiple scenarios in a single test
Do not perform manual login in tests (auto-auth via fixture)
Files:
e2e/tests/admin/tags/editor.test.ts
e2e/tests/admin/**/*.ts
📄 CodeRabbit inference engine (e2e/AGENTS.md)
Admin area end-to-end tests should reside under tests/admin/
Files:
e2e/tests/admin/tags/editor.test.ts
🧬 Code graph analysis (2)
e2e/helpers/pages/admin/tags/TagsPage.ts (1)
e2e/helpers/pages/BasePage.ts (1)
pageGotoOptions
(5-9)
e2e/tests/admin/tags/editor.test.ts (2)
e2e/helpers/pages/admin/tags/TagsPage.ts (1)
TagsPage
(5-67)e2e/helpers/pages/admin/tags/TagEditorPage.ts (1)
TagEditorPage
(4-82)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Unit tests (Node 22.13.1)
- GitHub Check: Build & Push
🔇 Additional comments (5)
e2e/helpers/pages/admin/tags/TagsPage.ts (1)
53-66
: LGTM! Well-structured synchronization improvements.The new
goto
method properly delegates to the base implementation and ensures a full page load before proceeding. The enhancedwaitForPageToFullyLoad
method usesdomcontentloaded
(which complies with guidelines), verifies content visibility, and elegantly handles both populated and empty states viaPromise.race
. This should significantly reduce test flakiness.e2e/tests/admin/tags/editor.test.ts (4)
15-18
: LGTM! Element caching reduces flakiness.Storing the
newTagRow
element and reusing it for multiple assertions is a good practice that prevents stale element issues and reduces repeated DOM queries.
41-43
: LGTM! Consistent element caching pattern.Same beneficial element caching pattern applied here as in the earlier test.
77-77
: LGTM! Improved synchronization in delete flows.The updated wait patterns properly ensure the page is fully loaded after delete operations, which should reduce timing-related flakiness.
Also applies to: 93-94
109-109
: LGTM! Direct navigation for 404 test is appropriate.Using
page.goto
directly for the non-existent tag test is cleaner than going through the page object, as the intent is to trigger a 404 response rather than simulate user navigation.
Can confirm this has addressed the flakiness locally. I've got a few small tweaks to make, I'll just push them here in a few if you don't mind? |
9larsons commented: |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
e2e/helpers/pages/admin/tags/TagEditorPage.ts (1)
1-1
: Remove unusedexpect
import.The
expect
import is not used in this file and should be removed. Additionally, per the coding guidelines, page objects should not useexpect()
for assertions.As per coding guidelines.
Apply this diff to remove the unused import:
-import {expect, Locator, Page} from '@playwright/test'; +import {Locator, Page} from '@playwright/test';
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
e2e/helpers/pages/admin/tags/TagEditorPage.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
e2e/helpers/pages/**/*.ts
📄 CodeRabbit inference engine (e2e/AGENTS.md)
e2e/helpers/pages/**/*.ts
: Follow ADR-0002 (use Page Objects) and keep page objects in helpers/pages/
Expose locators in page objects as public readonly when used with assertions in tests
Use semantic action method names in page objects (e.g., login()) rather than click* details
Use waitFor() for guards in page objects; never use expect() inside page objects
Do not place assertions in page objects
Files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
e2e/{tests,helpers/pages}/**/*.ts
📄 CodeRabbit inference engine (e2e/AGENTS.md)
e2e/{tests,helpers/pages}/**/*.ts
: Use only semantic locators (getByRole/getByLabel/getByText); fallback to data-testid; never use CSS/XPath/nth-child/class names
Do not use hard-coded waits (waitForTimeout)
Do not use networkidle in waits
Files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
End-to-end tests should live under the e2e/ directory (Playwright-based)
Files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
🧠 Learnings (3)
📚 Learning: 2025-10-08T14:20:28.632Z
Learnt from: CR
PR: TryGhost/Ghost#0
File: e2e/AGENTS.md:0-0
Timestamp: 2025-10-08T14:20:28.632Z
Learning: Applies to e2e/{tests,helpers/pages}/**/*.ts : Do not use networkidle in waits
Applied to files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
📚 Learning: 2025-10-08T14:20:28.632Z
Learnt from: CR
PR: TryGhost/Ghost#0
File: e2e/AGENTS.md:0-0
Timestamp: 2025-10-08T14:20:28.632Z
Learning: Applies to e2e/{tests,helpers/pages}/**/*.ts : Do not use hard-coded waits (waitForTimeout)
Applied to files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
📚 Learning: 2025-10-08T14:20:28.632Z
Learnt from: CR
PR: TryGhost/Ghost#0
File: e2e/AGENTS.md:0-0
Timestamp: 2025-10-08T14:20:28.632Z
Learning: Applies to e2e/helpers/pages/**/*.ts : Expose locators in page objects as public readonly when used with assertions in tests
Applied to files:
e2e/helpers/pages/admin/tags/TagEditorPage.ts
🪛 ESLint
e2e/helpers/pages/admin/tags/TagEditorPage.ts
[error] 1-1: 'expect' is defined but never used.
(@typescript-eslint/no-unused-vars)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Unit tests (Node 22.13.1)
- GitHub Check: Build & Push
🔇 Additional comments (1)
e2e/helpers/pages/admin/tags/TagEditorPage.ts (1)
64-70
: Excellent improvement to save synchronization!The new implementation properly waits for the save button to transition through "running" and "success" states, which is a much more robust approach than the previous
networkidle
wait. This directly addresses the flakiness issues mentioned in the PR objectives and follows the coding guidelines by usingwaitFor()
guards instead of prohibited patterns.
ref ecb0f3d
A few tests were failing locally. Specifically, the save action was occurring too quickly for the remaining actions in some tests.