Refactor: add data test id and improve wait times for element selectors in regression tests (#5138)
* fix: Improve wait times for element selectors in regression tests * refactor: add data test id
This commit is contained in:
parent
65ec6fd1e1
commit
b3e06aa215
2 changed files with 12 additions and 13 deletions
|
|
@ -36,7 +36,9 @@ const EditNodeModal = ({
|
||||||
<></>
|
<></>
|
||||||
</BaseModal.Trigger>
|
</BaseModal.Trigger>
|
||||||
<BaseModal.Header description={data.node?.description!}>
|
<BaseModal.Header description={data.node?.description!}>
|
||||||
<span className="pr-2">{data.node?.display_name ?? data.type}</span>
|
<span data-testid="node-modal-title" className="pr-2">
|
||||||
|
{data.node?.display_name ?? data.type}
|
||||||
|
</span>
|
||||||
<div>
|
<div>
|
||||||
<Badge size="sm" variant={isDark ? "gray" : "secondary"}>
|
<Badge size="sm" variant={isDark ? "gray" : "secondary"}>
|
||||||
ID: {data.id}
|
ID: {data.id}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,7 +35,9 @@ test(
|
||||||
|
|
||||||
await page.getByTestId("sidebar-search-input").click();
|
await page.getByTestId("sidebar-search-input").click();
|
||||||
await page.getByTestId("sidebar-search-input").fill("ollama");
|
await page.getByTestId("sidebar-search-input").fill("ollama");
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForSelector('[data-testid="embeddingsOllama Embeddings"]', {
|
||||||
|
timeout: 3000,
|
||||||
|
});
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByTestId("embeddingsOllama Embeddings")
|
.getByTestId("embeddingsOllama Embeddings")
|
||||||
|
|
@ -50,7 +54,9 @@ test(
|
||||||
|
|
||||||
await page.keyboard.press(`ControlOrMeta+Shift+A`);
|
await page.keyboard.press(`ControlOrMeta+Shift+A`);
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForSelector('[data-testid="node-modal-title"]', {
|
||||||
|
timeout: 3000,
|
||||||
|
});
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByPlaceholder("Type something...")
|
.getByPlaceholder("Type something...")
|
||||||
|
|
@ -73,24 +79,15 @@ test(
|
||||||
expect(secondValue).toBe("ollama_test_ctrl_a_second_input");
|
expect(secondValue).toBe("ollama_test_ctrl_a_second_input");
|
||||||
|
|
||||||
await page.getByPlaceholder("Type something...").last().click();
|
await page.getByPlaceholder("Type something...").last().click();
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
await page.keyboard.press("ControlOrMeta+a");
|
await page.keyboard.press("ControlOrMeta+a");
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
await page.keyboard.press("ControlOrMeta+c");
|
await page.keyboard.press("ControlOrMeta+c");
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
await page.getByPlaceholder("Type something...").nth(2).click();
|
await page.getByPlaceholder("Type something...").nth(2).click();
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
await page.keyboard.press("ControlOrMeta+a");
|
await page.keyboard.press("ControlOrMeta+a");
|
||||||
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
await page.keyboard.press("ControlOrMeta+v");
|
await page.keyboard.press("ControlOrMeta+v");
|
||||||
|
|
||||||
value = await page
|
value = await page
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue