tests: update node/edge IDs and properties in starter project (nightly fix) (#7099)

✨ (starter-projects.spec.ts): Increase timeout for waiting for elements to load to prevent test failures due to slow loading times
♻️ (starter-projects.spec.ts): Refactor code to use explicit wait times and improve readability
✨ (generalBugs-shard-3.spec.ts): Update drag and drop actions to include target positions for more accurate testing
♻️ (generalBugs-shard-3.spec.ts): Refactor code to remove unnecessary comments and improve test flow and readability
This commit is contained in:
Cristhian Zanforlin Lousa 2025-03-17 10:05:47 -03:00 • committed by GitHub
commit 4d9138fde2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 96 additions and 132 deletions

File diff suppressed because one or more lines are too long

View file

@ -95,7 +95,7 @@ test(
await page.getByTestId("text_card_container").nth(i).click(); await page.getByTestId("text_card_container").nth(i).click();
await page.waitForSelector('[data-testid="fit_view"]', { await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 3000, timeout: 5000,
}); });
if ((await page.getByTestId("update-all-button").count()) > 0) { if ((await page.getByTestId("update-all-button").count()) > 0) {
@ -109,11 +109,24 @@ test(
await page.getByTestId("icon-ChevronLeft").click(); await page.getByTestId("icon-ChevronLeft").click();
await page.waitForSelector('[data-testid="mainpage_title"]', { await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 3000, timeout: 5000,
});
await page.waitForTimeout(500);
await page.waitForSelector('[data-testid="new-project-btn"]', {
timeout: 5000,
}); });
await page.getByTestId("new-project-btn").first().click(); await page.getByTestId("new-project-btn").first().click();
await page.waitForSelector(
'[data-testid="side_nav_options_all-templates"]',
{
timeout: 5000,
},
);
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
} }

View file

@ -32,40 +32,33 @@ test(
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output"); await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForSelector('[data-testid="outputsChat Output"]', { await page
timeout: 30000, .getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 0, y: 0 },
}); });
await page await page
.getByTestId("outputsChat Output") .getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
await adjustScreenView(page, { numberOfZoomOut: 1 });
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input"); await page.getByTestId("sidebar-search-input").fill("chat input");
await page.waitForSelector('[data-testid="inputsChat Input"]', {
timeout: 30000,
});
await page await page
.getByTestId("inputsChat Input") .getByTestId("inputsChat Input")
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'), {
await page.mouse.up(); targetPosition: { x: 100, y: 100 },
await page.mouse.down(); });
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai"); await page.getByTestId("sidebar-search-input").fill("openai");
await adjustScreenView(page, { numberOfZoomOut: 1 });
await page await page
.getByTestId("modelsOpenAI") .getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'), {
await page.mouse.down(); targetPosition: { x: 100, y: 200 },
await page.mouse.up(); });
await initialGPTsetup(page); await initialGPTsetup(page);
@ -73,70 +66,19 @@ test(
timeout: 5000, timeout: 5000,
state: "visible", state: "visible",
}); });
// This causes the Chat Input to be hidden
// await page.getByTestId("fit_view").click();
const elementsChatInput = await page await page.getByTestId("fit_view").click();
.locator('[data-testid="handle-chatinput-noshownode-message-source"]')
.all();
let visibleElementHandle; await page
.getByTestId("handle-chatinput-noshownode-message-source")
.click();
await page.getByTestId("handle-openaimodel-shownode-input-left").click();
for (const element of elementsChatInput) { await page.getByTestId("handle-openaimodel-shownode-message-right").click();
if (await element.isVisible()) { await page
visibleElementHandle = element;
break;
}
}
await page.locator(".react-flow__pane").click();
await adjustScreenView(page, { numberOfZoomOut: 1 });
await visibleElementHandle.hover();
await page.mouse.down();
const elementsOpenAiInput = await page
.locator('[data-testid="handle-openaimodel-shownode-input-left"]')
.all();
for (const element of elementsOpenAiInput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.hover();
await page.mouse.up();
const elementsOpenAiOutput = await page
.locator('[data-testid="handle-openaimodel-shownode-message-right"]')
.all();
for (const element of elementsOpenAiOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
// Click and hold on the first element
await visibleElementHandle.hover();
await page.mouse.down();
// Move to the second element
const elementsChatOutput = await page
.getByTestId("handle-chatoutput-noshownode-text-target") .getByTestId("handle-chatoutput-noshownode-text-target")
.all(); .last()
.click();
for (const element of elementsChatOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.hover();
await page.mouse.up();
await page.getByTestId("fit_view").click(); await page.getByTestId("fit_view").click();
await page.getByText("Playground", { exact: true }).last().click(); await page.getByText("Playground", { exact: true }).last().click();