-
Notifications
You must be signed in to change notification settings - Fork 7
Refactor UI helpers to use BasePage methods #349
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
Open
nhudinh0309
wants to merge
36
commits into
v17/dev
Choose a base branch
from
v17/update/refactor-code-2
base: v17/dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
- Add wait-related methods to BasePage (waitForEnabled, waitForText, waitForURL, etc.) - Add timeout and wait constants to ConstantHelper for consistent timing - Refactor UiBaseLocators to use BasePage methods (click, enterText, isVisible, etc.) - Replace hardcoded timeout values with ConstantHelper constants - Export BasePage from index.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…ation - Organize 160+ locators into 25 logical region groups - Organize 150+ methods into corresponding region groups - Group related functionality: Core Actions, Folders, Navigation, Modals, Document Types, Properties, Validation, Media, Block Elements, etc. - Improve code navigation and maintainability 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace #region/#endregion blocks with simple separator comments - Format all comments as '// Comment here' with proper spacing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…tion - Replace Playwright .click() with this.click() from BasePage - Add treeItem locator for tree item elements - Add getMenuItemByLabel() helper method to avoid repeated locator pattern - Use template literals for cleaner string interpolation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace direct Playwright calls with BasePage wrapper methods (click, enterText, hover) across all UI helpers for consistency and maintainability. Also standardizes hardcoded timeout values to use ConstantHelper constants. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace direct Playwright calls with BasePage wrapper methods (click, enterText, hover, waitForVisible) across all remaining UI helpers. Standardizes hardcoded timeout values to use ConstantHelper constants and uses template literals for string concatenation. Files refactored: - DataTypeUiHelper.ts - FormsUiHelper.ts - ContentUiHelper.ts - LogViewerUiHelper.ts - PublishedStatusUiHelper.ts - RedirectManagementUiHelper.ts - HealthCheckUiHelper.ts - ExamineManagementUiHelper.ts - ProfilingUiHelper.ts - ModelsBuilderUiHelper.ts - TelemetryDataUiHelper.ts - WelcomeDashboardUiHelper.ts - InstallUiHelper.ts - CurrentUserProfileUiHelper.ts - MediaTypeUiHelper.ts - WebhookUiHelper.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Further simplify text input methods by using enterText wrapper for remaining clear/fill patterns. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace clear/fill patterns with enterText wrapper for enterContentName, enterTextstring, and enterTextArea methods. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace expect().toBeVisible() calls with waitForVisible wrapper method for consistency. Also refactor ExternalLoginUiHelpers to use click and enterText methods. Files updated: - ExternalLoginUiHelpers.ts - ContentUiHelper.ts - UserGroupUiHelper.ts - DictionaryUiHelper.ts - MemberGroupUiHelper.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace hover + click patterns with the combined hoverAndClick wrapper method for cleaner code and consistent behavior when interacting with elements that appear on hover. Files updated: - ContentUiHelper.ts - DataTypeUiHelper.ts - FormsUiHelper.ts - LanguageUiHelper.ts - MediaUiHelper.ts - UiBaseLocators.ts - UserUiHelper.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace this.page.waitForLoadState() with this.waitForLoadState() - Replace locator.press() with this.pressKey() for locator-based key presses - Replace selectOption calls with selectByText/selectByValue/selectMultiple - Simplify enterText patterns that use clear() before fill() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace expect().toBeVisible() with isVisible()/waitForVisible() - Replace expect().toHaveText() with hasText() - Replace expect().toContainText() with containsText() - Replace expect().toHaveValue() with hasValue() - Remove unused expect imports 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace toHaveCount assertions with hasCount() wrapper method from BasePage and remove duplicate waitForCount method. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix isContentInTreeVisible to use getByLabel with exact match - Fix typo in isChildContentInTreeVisible selector (extra bracket) - Update doesBlockHaveIconColor to use color attribute selector - Add wait after clicking confirm to publish button 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces a significant refactoring of the UI test helpers to improve code maintainability, reduce duplication, and provide more consistent test behavior.
What's Changed
New BasePage class - A foundational class that provides reusable Playwright interaction methods:
Refactored architecture - UiBaseLocators now extends BasePage, meaning all UI helpers automatically inherit these common methods. This creates a cleaner inheritance chain:
BasePage → UiBaseLocators → [Domain]UiHelper
Standardized timeouts - Added time constants to ConstantHelper for consistent wait durations across all helpers, making it easier to tune for different CI environments.
Stability improvements - Fixed various locator selectors and added strategic waits to reduce flaky tests in CI pipelines.
Why This Matters
This refactoring makes it significantly easier to: