fix all the tests

This commit is contained in:
cristhianzl 2024-02-29 18:42:24 -03:00
commit 066a5969e7
2 changed files with 23 additions and 50 deletions

View file

@ -25,49 +25,23 @@ test.describe("group node test", () => {
page.waitForTimeout(2000); page.waitForTimeout(2000);
await page.dispatchEvent('//*[@id="react-flow-id"]', "drop", { // Now dispatch
dataTransfer, await page.dispatchEvent(
}); "//*[@id='react-flow-id']/div[1]/div[1]/div",
"drop",
await page.locator('//*[@id="new-project-btn"]').click(); {
await page.waitForTimeout(2000); dataTransfer,
}
await page.getByPlaceholder("Search").click(); );
await page.getByPlaceholder("Search").fill("PythonFunctionTool");
await page.waitForTimeout(2000);
await page
.getByTestId("toolsPythonFunctionTool")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("ChatOpenAI");
await page.waitForTimeout(2000);
await page
.getByTestId("model_specsChatOpenAI")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("AgentInitializer");
await page.waitForTimeout(2000);
await page
.getByTestId("agentsAgent Initializer")
.first()
.dragTo(page.locator('//*[@id="react-flow-id"]'));
const genericNoda = page.getByTestId("div-generic-node"); const genericNoda = page.getByTestId("div-generic-node");
const elementCount = await genericNoda.count(); const elementCount = await genericNoda.count();
if (elementCount > 0) { if (elementCount > 0) {
expect(true).toBeTruthy(); expect(true).toBeTruthy();
} }
page.locator('//*[@id="react-flow-id"]').click(); await page
.locator('//*[@id="react-flow-id"]/div[1]/div[2]/button[3]')
.click();
await page.getByTestId("title-Agent Initializer").click({ await page.getByTestId("title-Agent Initializer").click({
modifiers: ["Control"], modifiers: ["Control"],

View file

@ -12,10 +12,11 @@ test.describe("save component tests", () => {
/// <reference lib="dom"/> /// <reference lib="dom"/>
test("save group component tests", async ({ page }) => { test("save group component tests", async ({ page }) => {
await page.goto("http:localhost:3000/"); await page.goto("http:localhost:3000/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); await page.locator('//*[@id="new-project-btn"]').click();
// Read your file into a buffer. // Read your file into a buffer.
const jsonContent = readFileSync( const jsonContent = readFileSync(
"tests/onlyFront/assets/collection.json", "tests/end-to-end/assets/flow_group_test.json",
"utf-8" "utf-8"
); );
@ -23,32 +24,32 @@ test.describe("save component tests", () => {
const dataTransfer = await page.evaluateHandle((data) => { const dataTransfer = await page.evaluateHandle((data) => {
const dt = new DataTransfer(); const dt = new DataTransfer();
// Convert the buffer to a hex array // Convert the buffer to a hex array
const file = new File([data], "flowtest.json", { const file = new File([data], "flow_group_test.json", {
type: "application/json", type: "application/json",
}); });
dt.items.add(file); dt.items.add(file);
return dt; return dt;
}, jsonContent); }, jsonContent);
page.waitForTimeout(2000);
// Now dispatch // Now dispatch
await page.dispatchEvent( await page.dispatchEvent(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div', "//*[@id='react-flow-id']/div[1]/div[1]/div",
"drop", "drop",
{ {
dataTransfer, dataTransfer,
} }
); );
await page
.getByTestId("edit-flow-button-e9ac1bdc-429b-475d-ac03-d26f9a2a3210-0")
.click();
await page.waitForTimeout(2000);
const genericNoda = page.getByTestId("div-generic-node"); const genericNoda = page.getByTestId("div-generic-node");
const elementCount = await genericNoda.count(); const elementCount = await genericNoda.count();
if (elementCount > 0) { if (elementCount > 0) {
expect(true).toBeTruthy(); expect(true).toBeTruthy();
} }
await page
.locator('//*[@id="react-flow-id"]/div[1]/div[2]/button[3]')
.click();
await page.getByTestId("title-PythonFunctionTool").click({ await page.getByTestId("title-PythonFunctionTool").click({
modifiers: ["Control"], modifiers: ["Control"],
@ -57,7 +58,7 @@ test.describe("save component tests", () => {
modifiers: ["Control"], modifiers: ["Control"],
}); });
await page.getByTestId("title-AgentInitializer").click({ await page.getByTestId("title-Agent Initializer").click({
modifiers: ["Control"], modifiers: ["Control"],
}); });
@ -76,9 +77,7 @@ test.describe("save component tests", () => {
} }
await page.getByTestId("title-Group").click(); await page.getByTestId("title-Group").click();
await page.getByTestId("more-options-modal").click(); await page.getByTestId("icon-SaveAll").click();
await page.getByTestId("save-button-modal").click();
await page.getByTestId("delete-button-modal").click();
await page.getByPlaceholder("Search").click(); await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("group"); await page.getByPlaceholder("Search").fill("group");