Refactor: Improve wait times in regression test (#5137)

* fix: Improve wait times in regression test

Improve the wait times in the regression test to ensure that the necessary elements are loaded before interacting with them. This prevents potential timing issues and improves the reliability of the test.

Refactor the test code to use `waitForSelector` instead of `waitForTimeout` to wait for the modal title and sidebar custom component button to appear. Increase the timeout for the sidebar custom component button to 30 seconds to allow for slower loading times.

Also, add a comment to indicate that the wait for the animation to propagate is intentional.

This commit addresses the issues identified in the regression test and improves the overall stability of the test suite.
This commit is contained in:
anovazzi1 2024-12-07 13:54:27 -03:00 committed by GitHub
commit c26a2d82e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,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();
}
@ -29,7 +31,12 @@ test(
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(1000);
await page.waitForSelector(
'[data-testid="sidebar-custom-component-button"]',
{
timeout: 30000,
},
);
await page.getByTestId("sidebar-custom-component-button").click();
@ -72,6 +79,7 @@ class CustomComponent(Component):
await page.getByText("Check & Save").last().click();
//wait for the animation to propagate
await page.waitForTimeout(1000);
const error = await page