fix: Improve wait time in saveComponents.spec.ts (#4673)

Improve the wait time in the saveComponents.spec.ts file to ensure that the necessary elements are loaded before interacting with them. This helps prevent potential errors and improves the reliability of the test.
This commit is contained in:
anovazzi1 2024-11-21 21:40:39 -03:00 • committed by GitHub
commit 6737368073
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,14 +17,15 @@ test.describe("save component tests", () => {
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();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(1000);
// Read your file into a buffer.
const jsonContent = readFileSync(
@ -43,8 +44,6 @@ test.describe("save component tests", () => {
return dt;
}, jsonContent);
page.waitForTimeout(1000);
// Now dispatch
await page.dispatchEvent(
"//*[@id='react-flow-id']/div[1]/div[1]/div",
@ -95,7 +94,7 @@ test.describe("save component tests", () => {
await page.getByTestId("more-options-modal").click();
await page.getByTestId("icon-SaveAll").click();
// timeout to handle case where there is already a saved component with the same name
await page.waitForTimeout(1000);
const replaceButton = await page.getByTestId("replace-button").isVisible();
@ -105,7 +104,6 @@ test.describe("save component tests", () => {
}
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("group");
await page.waitForTimeout(1000);
await page
.getByText("Group")