test: enhance drag-and-drop reliability and update test asset paths (#5186)

 (dragAndDrop.spec.ts): Update file paths for drag and drop tests to use the correct directory structure
🐛 (generalBugs-shard-12.spec.ts): Adjust mouse movement coordinates to fix drag and drop functionality
🐛 (generalBugs-shard-12.spec.ts): Update drag and drop logic to use hover and click actions for better test accuracy
🐛 (generalBugs-shard-3.spec.ts): Modify adjustScreenView function to include zoom level parameter for better control
🐛 (generalBugs-shard-3.spec.ts): Add missing waitForSelector for fit_view element to ensure visibility before clicking
🐛 (generalBugs-shard-7.spec.ts): Reduce timeout for blank-flow element to improve test speed
🐛 (generalBugs-shard-7.spec.ts): Add waitForSelector for fit_view and zoom_out elements to ensure visibility before interacting with them
This commit is contained in:
Cristhian Zanforlin Lousa 2024-12-10 12:45:18 -03:00 committed by GitHub
commit 22d8ac1da8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 19 deletions

View file

@ -12,7 +12,11 @@ test(
await page.locator("span").filter({ hasText: "My Projects" }).isVisible();
await simulateDragAndDrop(page, "assets/collection.json", "cards-wrapper");
await simulateDragAndDrop(
page,
"tests/assets/collection.json",
"cards-wrapper",
);
await page.waitForSelector("text=uploaded successfully", {
timeout: 60000 * 2,
@ -45,7 +49,7 @@ test(
// Read your file into a buffer.
const jsonContent = readFileSync(
"assets/flow_test_drag_and_drop.json",
"tests/assets/flow_test_drag_and_drop.json",
"utf-8",
);
@ -57,7 +61,7 @@ test(
await simulateDragAndDrop(
page,
"assets/flow_test_drag_and_drop.json",
"tests/assets/flow_test_drag_and_drop.json",
"cards-wrapper",
jsonContentWithNewName,
);

View file

@ -44,7 +44,7 @@ test(
.hover()
.then(async () => {
await page.mouse.down();
await page.mouse.move(-300, 300);
await page.mouse.move(-300, 100);
});
await page.mouse.up();
@ -59,16 +59,24 @@ test(
},
);
modelElement = page.getByTestId(
"vectorstoresVectara Self Query Retriever for Vectara Vector Store",
);
targetElement = page.locator('//*[@id="react-flow-id"]');
await modelElement.dragTo(targetElement);
await page
.getByTestId(
"vectorstoresVectara Self Query Retriever for Vectara Vector Store",
)
.hover()
.then(async () => {
await page
.getByTestId(
"add-component-button-vectara-self-query-retriever-for-vectara-vector-store",
)
.click();
});
await page.mouse.up();
await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 5000,
state: "visible",
});
await page.getByTestId("fit_view").click();
await page.getByTestId("fit_view").click();
//connection

View file

@ -42,7 +42,7 @@ test(
await page.mouse.up();
await page.mouse.down();
await adjustScreenView(page);
await adjustScreenView(page, { numberOfZoomOut: 1 });
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input");
@ -59,7 +59,7 @@ test(
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await adjustScreenView(page);
await adjustScreenView(page, { numberOfZoomOut: 1 });
await page
.getByTestId("modelsOpenAI")
@ -69,6 +69,13 @@ test(
await initialGPTsetup(page);
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 5000,
state: "visible",
});
await page.getByTestId("fit_view").click();
const elementsChatInput = await page
.locator('[data-testid="handle-chatinput-shownode-message-right"]')
.all();
@ -82,10 +89,6 @@ test(
}
}
// Click and hold on the first element
await page.getByTestId("zoom_in").click();
await page.getByTestId("zoom_in").click();
await page.locator(".react-flow__pane").click();
await visibleElementHandle.hover();

View file

@ -9,11 +9,21 @@ test(
await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
timeout: 10000,
});
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 5000,
state: "visible",
});
await page.waitForSelector('[data-testid="zoom_out"]', {
timeout: 5000,
state: "visible",
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("ollama");
await page.waitForSelector('[data-testid="embeddingsOllama Embeddings"]', {
@ -28,6 +38,11 @@ test(
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForSelector('[data-testid="div-generic-node"]', {
timeout: 5000,
state: "visible",
});
await page.getByTestId("div-generic-node").click();
await page.keyboard.press(`ControlOrMeta+Shift+A`);