Refactor: Remove unnecessary wait timeouts in limit-file-size-upload test (#5076)

* fix: Remove unnecessary wait timeouts in limit-file-size-upload test
This commit is contained in:
anovazzi1 2024-12-05 21:56:29 -03:00 • committed by GitHub
commit 5924fa3c7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,8 +32,6 @@ test(
await page.goto("/"); await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0; let modalCount = 0;
try { try {
const modalTitleElement = await page?.getByTestId("modal-title"); const modalTitleElement = await page?.getByTestId("modal-title");
@ -46,7 +44,9 @@ test(
while (modalCount === 0) { while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click(); 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(); modalCount = await page.getByTestId("modal-title")?.count();
} }
@ -67,14 +67,12 @@ test(
while (outdatedComponents > 0) { while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click(); await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count(); outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
} }
let filledApiKey = await page.getByTestId("remove-icon-badge").count(); let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) { while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click(); await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count(); filledApiKey = await page.getByTestId("remove-icon-badge").count();
} }
@ -128,8 +126,6 @@ test(
// Dispatch the drop event on the target element // Dispatch the drop event on the target element
await element.dispatchEvent("drop", { dataTransfer }); await element.dispatchEvent("drop", { dataTransfer });
await page.waitForTimeout(1000);
await page.waitForSelector("text=The file size is too large", { await page.waitForSelector("text=The file size is too large", {
timeout: 10000, timeout: 10000,
}); });