refactor: improve freeze-path.spec.ts and freeze.spec.ts files (#4618)
* refactor: Improve time and use waitForSelector in freeze-path.spec.ts * refactor: Improve time and use waitForSelector in freeze-path.spec.ts * fromat code * Refactor freeze.spec.ts: Remove unnecessary code
This commit is contained in:
parent
d0c3ed165e
commit
8ebe1086d2
2 changed files with 80 additions and 32 deletions
|
|
@ -33,7 +33,9 @@ test("user must be able to freeze a path", async ({ page }) => {
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -57,10 +59,10 @@ test("user must be able to freeze a path", async ({ page }) => {
|
|||
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
||||
}
|
||||
|
||||
//remove all saved api keys
|
||||
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
|
||||
while (filledApiKey > 0) {
|
||||
await page.getByTestId("remove-icon-badge").first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
filledApiKey = await page.getByTestId("remove-icon-badge").count();
|
||||
}
|
||||
|
||||
|
|
@ -81,11 +83,15 @@ test("user must be able to freeze a path", async ({ page }) => {
|
|||
await page.getByTestId("dropdown_str_model_name").click();
|
||||
await page.getByTestId("gpt-4o-1-option").click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="float_float_temperature"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("float_float_temperature").fill("1.0");
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("button_run_chat output").click();
|
||||
|
||||
|
|
@ -104,12 +110,16 @@ test("user must be able to freeze a path", async ({ page }) => {
|
|||
|
||||
await page.getByText("Close").first().click();
|
||||
|
||||
await page.waitForTimeout(3000);
|
||||
await page.waitForSelector('[data-testid="float_float_temperature"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
await page.getByTestId("float_float_temperature").fill("");
|
||||
await page.getByTestId("float_float_temperature").fill("1.2");
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("button_run_chat output").click();
|
||||
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
||||
|
|
@ -127,23 +137,34 @@ test("user must be able to freeze a path", async ({ page }) => {
|
|||
|
||||
await page.getByText("Close").first().click();
|
||||
|
||||
await page.waitForTimeout(3000);
|
||||
await page.waitForSelector("text=OpenAI", {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByText("OpenAI", { exact: true }).last().click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="more-options-modal"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("more-options-modal").click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="freeze-path-button"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("freeze-path-button").click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
expect(await page.getByTestId("icon-Snowflake").count()).toBeGreaterThan(0);
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("button_run_chat output").click();
|
||||
|
||||
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +34,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("text input");
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="inputsText Input"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("inputsText Input")
|
||||
|
|
@ -53,7 +57,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("url");
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="dataURL"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("dataURL")
|
||||
|
|
@ -74,7 +80,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("split text");
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="processingSplit Text"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("processingSplit Text")
|
||||
|
|
@ -95,7 +103,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("parse data");
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="processingParse Data"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("processingParse Data")
|
||||
|
|
@ -116,7 +126,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("chat output");
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="outputsChat Output"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("outputsChat Output")
|
||||
|
|
@ -137,14 +149,15 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
while (outdatedComponents > 0) {
|
||||
await page.getByTestId("icon-AlertTriangle").first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="icon-AlertTriangle"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
||||
}
|
||||
|
||||
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
|
||||
while (filledApiKey > 0) {
|
||||
await page.getByTestId("remove-icon-badge").first().click();
|
||||
await page.waitForTimeout(1000);
|
||||
filledApiKey = await page.getByTestId("remove-icon-badge").count();
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +232,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
timeout: 15000,
|
||||
});
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="output-inspection-message"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("output-inspection-message").first().click();
|
||||
|
||||
|
|
@ -242,7 +257,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
timeout: 15000,
|
||||
});
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="output-inspection-message"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("output-inspection-message").first().click();
|
||||
|
||||
|
|
@ -257,16 +274,18 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
await page.getByText("Split Text", { exact: true }).last().click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="more-options-modal"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("more-options-modal").click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("icon-Snowflake").click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
await page.locator('//*[@id="react-flow-id"]').click();
|
||||
|
|
@ -276,7 +295,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
.first()
|
||||
.fill("lorem ipsum");
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("button_run_chat output").click();
|
||||
|
||||
|
|
@ -286,7 +307,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
timeout: 15000,
|
||||
});
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="output-inspection-message"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("output-inspection-message").first().click();
|
||||
|
||||
|
|
@ -299,16 +322,18 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
|
||||
await page.getByText("Split Text", { exact: true }).click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="more-options-modal"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("more-options-modal").click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByText("Freeze", { exact: true }).click();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
await page.locator('//*[@id="react-flow-id"]').click();
|
||||
|
|
@ -321,7 +346,9 @@ test("user must be able to freeze a component", async ({ page }) => {
|
|||
timeout: 15000,
|
||||
});
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="output-inspection-message"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page.getByTestId("output-inspection-message").first().click();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue