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.waitForSelector('[data-testid="fit_view"]', {
timeout: 3000,
timeout: 5000,
});
if ((await page.getByTestId("update-all-button").count()) > 0) {
@ -109,11 +109,24 @@ test(
await page.getByTestId("icon-ChevronLeft").click();
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.waitForSelector(
'[data-testid="side_nav_options_all-templates"]',
{
timeout: 5000,
},
);
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").fill("chat output");
await page.waitForSelector('[data-testid="outputsChat Output"]', {
timeout: 30000,
});
await page
.getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 0, y: 0 },
});
await page
.getByTestId("outputsChat Output")
.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").fill("chat input");
await page.waitForSelector('[data-testid="inputsChat Input"]', {
timeout: 30000,
});
await page
.getByTestId("inputsChat Input")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up();
await page.mouse.down();
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 100, y: 100 },
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai");
await adjustScreenView(page, { numberOfZoomOut: 1 });
await page
.getByTestId("modelsOpenAI")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.down();
await page.mouse.up();
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 100, y: 200 },
});
await initialGPTsetup(page);
@ -73,70 +66,19 @@ test(
timeout: 5000,
state: "visible",
});
// This causes the Chat Input to be hidden
// await page.getByTestId("fit_view").click();
const elementsChatInput = await page
.locator('[data-testid="handle-chatinput-noshownode-message-source"]')
.all();
await page.getByTestId("fit_view").click();
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) {
if (await element.isVisible()) {
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
await page.getByTestId("handle-openaimodel-shownode-message-right").click();
await page
.getByTestId("handle-chatoutput-noshownode-text-target")
.all();
for (const element of elementsChatOutput) {
if (await element.isVisible()) {
visibleElementHandle = element;
break;
}
}
await visibleElementHandle.hover();
await page.mouse.up();
.last()
.click();
await page.getByTestId("fit_view").click();
await page.getByText("Playground", { exact: true }).last().click();