Refactor: floatComponent.spec.ts for improved readability, performance, and reliability (#4857)

Refactor floatComponent.spec.ts to improve readability, performance and reliability
This commit is contained in:
anovazzi1 2024-11-26 10:09:17 -03:00 committed by GitHub
commit f90e980cb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,7 +25,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();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
@ -35,7 +37,9 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForTimeout(1000);
await page.waitForSelector('[data-testid="modelsOllama"]', {
timeout: 30000,
});
await page
.getByTestId("modelsOllama")
@ -47,33 +51,25 @@ test(
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').click();
await page.locator('//*[@id="float_float_temperature"]').fill("");
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').fill("3");
let value = await page
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "2") {
expect(false).toBeTruthy();
}
expect(value).toBe("2");
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').click();
await page.locator('//*[@id="float_float_temperature"]').fill("");
await page.waitForTimeout(1000);
await page.locator('//*[@id="float_float_temperature"]').fill("-3");
value = await page
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "-2") {
expect(false).toBeTruthy();
}
expect(value).toBe("-2");
await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click();
@ -136,9 +132,7 @@ test(
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "1") {
expect(false).toBeTruthy();
}
expect(value).toBe("1");
await page.locator('//*[@id="float_float_temperature"]').click();
await page.getByTestId("float_float_temperature").fill("");
@ -149,9 +143,7 @@ test(
.locator('//*[@id="float_float_temperature"]')
.inputValue();
if (value != "-1") {
expect(false).toBeTruthy();
}
expect(value).toBe("-1");
}
},
);