Refactor: Improve test stability and reliability (#5135)

fix: Improve test stability and reliability

Improve the stability and reliability of the tests in the generalBugs-shard-2.spec.ts file.
- Use waitForSelector instead of waitForTimeout to ensure that the modal and data elements are present before proceeding.
- Increase the timeout value to 3000 milliseconds for better reliability.
- Add a comment to indicate the purpose of the timeout.

This commit addresses the issue of intermittent failures in the tests and enhances the overall test stability.
This commit is contained in:
anovazzi1 2024-12-07 00:19:17 -03:00 committed by GitHub
commit 47d7004fc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,7 +36,9 @@ test(
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
@ -45,7 +47,9 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("webhook");
await page.waitForTimeout(1000);
await page.waitForSelector('[data-testid="dataWebhook"]', {
timeout: 3000,
});
await page
.getByTestId("dataWebhook")
@ -62,7 +66,9 @@ test(
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
// wait for the update to be applied
await page.waitForTimeout(1000);
await page.getByText("API", { exact: true }).click();
await page.getByText("Webhook cURL", { exact: true }).click();