Refactor group.spec.ts test case
This commit is contained in:
parent
dfc733be7d
commit
7ea25b52f1
1 changed files with 16 additions and 71 deletions
|
|
@ -1,80 +1,25 @@
|
||||||
import { expect, test } from "@playwright/test";
|
import { expect, test } from "@playwright/test";
|
||||||
import { readFileSync } from "fs";
|
|
||||||
test.beforeEach(async ({ page }) => {
|
|
||||||
// await page.waitForTimeout(7000);
|
|
||||||
// test.setTimeout(120000);
|
|
||||||
});
|
|
||||||
test.describe("group node test", () => {
|
test.describe("group node test", () => {
|
||||||
/// <reference lib="dom"/>
|
/// <reference lib="dom"/>
|
||||||
test("group and ungroup updating values", async ({ page }) => {
|
test("group and ungroup updating values", async ({ page }) => {
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
await page.locator('//*[@id="new-project-btn"]').click();
|
await page.locator('//*[@id="new-project-btn"]').click();
|
||||||
|
|
||||||
await page.getByTestId("blank-flow").click();
|
await page.getByRole('heading', { name: 'Data Ingestion' }).click();
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
await page.getByLabel('fit view').click();
|
||||||
// Read your file into a buffer.
|
await page.keyboard.down('Control');
|
||||||
const jsonContent = readFileSync(
|
await page.getByTestId("title-OpenAIEmbeddings").click({modifiers: ['Control']});
|
||||||
"tests/end-to-end/assets/flow_group_test.json",
|
await page.getByTestId("title-URL").click({modifiers: ['Control']});
|
||||||
"utf-8"
|
await page.getByTestId("title-Recursive Character Text Splitter").click({modifiers: ['Control']});
|
||||||
);
|
await page.keyboard.up('Control');
|
||||||
|
await page.getByRole('button', { name: 'Group' }).click();
|
||||||
// Create the DataTransfer and File
|
await page.getByTestId(/input-collection_name_Chroma-.*/).click();
|
||||||
const dataTransfer = await page.evaluateHandle((data) => {
|
await page.getByTestId(/input-collection_name_Chroma-.*/).fill('test');
|
||||||
const dt = new DataTransfer();
|
await page.getByTestId("title-Group").click();
|
||||||
// Convert the buffer to a hex array
|
await page.keyboard.press("Control+g")
|
||||||
const file = new File([data], "flow_group_test.json", {
|
const value = await page.getByTestId('input-collection_name').inputValue()
|
||||||
type: "application/json",
|
expect(value).toBe('test');
|
||||||
});
|
})
|
||||||
dt.items.add(file);
|
|
||||||
return dt;
|
|
||||||
}, jsonContent);
|
|
||||||
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
|
|
||||||
// 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();
|
|
||||||
}
|
|
||||||
await page
|
|
||||||
.locator('//*[@id="react-flow-id"]/div[1]/div[2]/button[3]')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await page.getByTestId("title-Agent Initializer").click({
|
|
||||||
modifiers: ["Control"],
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.getByTestId("title-PythonFunctionTool").click({
|
|
||||||
modifiers: ["Control"],
|
|
||||||
});
|
|
||||||
await page.getByTestId("title-ChatOpenAI").click({
|
|
||||||
modifiers: ["Control"],
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Group" }).click();
|
|
||||||
|
|
||||||
const textArea = page.getByTestId("div-textarea-description");
|
|
||||||
const elementCountText = await textArea.count();
|
|
||||||
if (elementCountText > 0) {
|
|
||||||
expect(true).toBeTruthy();
|
|
||||||
}
|
|
||||||
|
|
||||||
const groupNode = page.getByTestId("title-Group");
|
|
||||||
const elementGroup = await groupNode.count();
|
|
||||||
if (elementGroup > 0) {
|
|
||||||
expect(true).toBeTruthy();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now dispatch
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue