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);
await page.dispatchEvent('//*[@id="react-flow-id"]', "drop", {
dataTransfer,
});
await page.locator('//*[@id="new-project-btn"]').click();
await page.waitForTimeout(2000);
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"]'));
// Now dispatch
await page.dispatchEvent(
"//*[@id='react-flow-id']/div[1]/div[1]/div",
"drop",
{
dataTransfer,
}
);
const genericNoda = page.getByTestId("div-generic-node");
const elementCount = await genericNoda.count();
if (elementCount > 0) {
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({
modifiers: ["Control"],

View file

@ -12,10 +12,11 @@ test.describe("save component tests", () => {
/// <reference lib="dom"/>
test("save group component tests", async ({ page }) => {
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.
const jsonContent = readFileSync(
"tests/onlyFront/assets/collection.json",
"tests/end-to-end/assets/flow_group_test.json",
"utf-8"
);
@ -23,32 +24,32 @@ test.describe("save component tests", () => {
const dataTransfer = await page.evaluateHandle((data) => {
const dt = new DataTransfer();
// 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",
});
dt.items.add(file);
return dt;
}, jsonContent);
page.waitForTimeout(2000);
// Now dispatch
await page.dispatchEvent(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div',
"//*[@id='react-flow-id']/div[1]/div[1]/div",
"drop",
{
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 elementCount = await genericNoda.count();
if (elementCount > 0) {
expect(true).toBeTruthy();
}
await page
.locator('//*[@id="react-flow-id"]/div[1]/div[2]/button[3]')
.click();
await page.getByTestId("title-PythonFunctionTool").click({
modifiers: ["Control"],
@ -57,7 +58,7 @@ test.describe("save component tests", () => {
modifiers: ["Control"],
});
await page.getByTestId("title-AgentInitializer").click({
await page.getByTestId("title-Agent Initializer").click({
modifiers: ["Control"],
});
@ -76,9 +77,7 @@ test.describe("save component tests", () => {
}
await page.getByTestId("title-Group").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("save-button-modal").click();
await page.getByTestId("delete-button-modal").click();
await page.getByTestId("icon-SaveAll").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("group");