Fix #237: plugin is activated failing #244
Open
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.
Description
Fixes #237
Implements a new retry logic into page Utils to address flakiness issues with Playwright operations like
page.goto,page.waitForFunction,page.waitForLoadState, andlocator.click.Type of change
Detailed scenario
What was tested
npm run test:smokeHow to test
npm run test:smokeTechnical description
Problem Addressed
E2E tests were experiencing flakiness due to unreliable network conditions, slow page loads, and timing issues with element interactions. Common failures included:
page.goto()locator.click()page.waitForLoadState()Solution
This PR introduces a comprehensive retry mechanism that automatically retries flaky operations with configurable options, improving test reliability without requiring manual intervention.
How to Use
Basic Usage
Documentation
This pull request introduces a retry utility to improve the reliability of Playwright tests and integrates it into various test steps and utility methods. The most important changes include adding the
retry-helper.tsmodule, refactoring test steps to use the retry logic, and updating utility methods for better error handling and retries.Retry Utility Implementation:
utils/retry-helper.ts: Added a new moduleretry-helper.tsthat provides awithRetryfunction for executing operations with retry logic, including configurable options like maximum attempts, delay, exponential backoff, and custom retry conditions. Also introduced common retry conditions such asnetworkErrorsandelementErrors.Integration of Retry Logic in Test Steps:
src/support/steps/general.ts: Refactored several test steps (plugin is activated,I go to {string},I visit {string}, andI click on {string}) to use thewithRetryutility for handling flaky operations. Added retry configurations with appropriate conditions and delays for each step. [1] [2]Updates to Utility Methods:
utils/page-utils.ts: Updated thevisitPageandsaveSettingsmethods to include retry logic using thewithRetryutility. Enhanced error handling for network and element-related issues, ensuring operations are retried as needed. [1] [2]Dependency Updates:
src/support/steps/general.tsandutils/page-utils.ts: ImportedwithRetryandRetryConditionsfrom the newretry-helper.tsmodule to enable retry functionality in test steps and utility methods. [1] [2]New dependencies
None
Risks
None
Mandatory Checklist
Code validation
Code style