Refactor: improve generalBugsShard test code and improve test reliability (#4835)
This commit is contained in:
parent
97fe69c12c
commit
52b302233b
1 changed files with 45 additions and 110 deletions
|
|
@ -12,7 +12,7 @@ test(
|
|||
const thirdRandomName = Math.random().toString(36).substring(2);
|
||||
|
||||
try {
|
||||
const modalTitleElement = await page?.getByTestId("modal-title");
|
||||
const modalTitleElement = page?.getByTestId("modal-title");
|
||||
if (modalTitleElement) {
|
||||
modalCount = await modalTitleElement.count();
|
||||
}
|
||||
|
|
@ -22,7 +22,9 @@ test(
|
|||
|
||||
while (modalCount === 0) {
|
||||
await page.getByText("New Flow", { exact: true }).click();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.waitForSelector('[data-testid="modal-title"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
modalCount = await page.getByTestId("modal-title")?.count();
|
||||
}
|
||||
|
||||
|
|
@ -34,149 +36,101 @@ test(
|
|||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("text input");
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForSelector('[data-testid="inputsText Input"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("inputsText Input")
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'), {});
|
||||
|
||||
await page.getByTestId("zoom_out").click();
|
||||
await page.getByTestId("zoom_out").click();
|
||||
await page.getByTestId("zoom_out").click();
|
||||
await page.getByTestId("zoom_out").click();
|
||||
|
||||
await page
|
||||
.locator('//*[@id="react-flow-id"]')
|
||||
.hover()
|
||||
.then(async () => {
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(-200, 100);
|
||||
await page.waitForTimeout(400);
|
||||
.getByTestId("inputsText Input")
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
||||
targetPosition: { x: 500, y: 150 },
|
||||
});
|
||||
|
||||
await page.mouse.up();
|
||||
|
||||
await page
|
||||
.getByTestId("inputsText Input")
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
||||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("combine text");
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page
|
||||
.locator('//*[@id="react-flow-id"]')
|
||||
.hover()
|
||||
.then(async () => {
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(-200, 100);
|
||||
await page.waitForTimeout(400);
|
||||
});
|
||||
|
||||
await page.mouse.up();
|
||||
await page.waitForSelector('[data-testid="processingCombine Text"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("processingCombine Text")
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
||||
|
||||
await page
|
||||
.locator('//*[@id="react-flow-id"]')
|
||||
.hover()
|
||||
.then(async () => {
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(-200, 100);
|
||||
await page.waitForTimeout(400);
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
||||
targetPosition: { x: 10, y: 10 },
|
||||
});
|
||||
|
||||
await page.mouse.up();
|
||||
|
||||
await page
|
||||
.getByTestId("processingCombine Text")
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
||||
|
||||
await page
|
||||
.locator('//*[@id="react-flow-id"]')
|
||||
.hover()
|
||||
.then(async () => {
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(-200, 100);
|
||||
await page.waitForTimeout(200);
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
||||
targetPosition: { x: 200, y: 10 },
|
||||
});
|
||||
|
||||
await page.mouse.up();
|
||||
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("text output");
|
||||
await page.waitForTimeout(1000);
|
||||
await page.getByTestId("sidebar-search-input").fill("text");
|
||||
|
||||
await page
|
||||
.locator('//*[@id="react-flow-id"]')
|
||||
.hover()
|
||||
.then(async () => {
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(-200, 100);
|
||||
});
|
||||
|
||||
await page.mouse.up();
|
||||
await page.waitForSelector('[data-testid="outputsText Output"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("outputsText Output")
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
||||
|
||||
await page.getByTestId("fit_view").click({
|
||||
force: true,
|
||||
});
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
||||
targetPosition: { x: 10, y: 400 },
|
||||
});
|
||||
//connection 1
|
||||
const elementCombineTextOutput0 = await page
|
||||
const elementCombineTextOutput0 = page
|
||||
.getByTestId("div-handle-combinetext-shownode-combined text-right")
|
||||
.nth(0);
|
||||
await elementCombineTextOutput0.click();
|
||||
|
||||
const blockedHandle = await page
|
||||
const blockedHandle = page
|
||||
.getByTestId("div-handle-textinput-shownode-text-right")
|
||||
.nth(2);
|
||||
const secondBlockedHandle = await page
|
||||
.first();
|
||||
const secondBlockedHandle = page
|
||||
.getByTestId("div-handle-combinetext-shownode-combined text-right")
|
||||
.nth(2);
|
||||
const thirdBlockedHandle = await page
|
||||
.nth(3);
|
||||
const thirdBlockedHandle = page
|
||||
.getByTestId("div-handle-textoutput-shownode-text-right")
|
||||
.nth(0);
|
||||
.first();
|
||||
|
||||
const hasGradient = await blockedHandle?.evaluate((el) => {
|
||||
const style = window.getComputedStyle(el);
|
||||
return style.backgroundColor === "rgb(228, 228, 231)";
|
||||
});
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const secondHasGradient = await secondBlockedHandle?.evaluate((el) => {
|
||||
const style = window.getComputedStyle(el);
|
||||
return style.backgroundColor === "rgb(228, 228, 231)";
|
||||
});
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const thirdHasGradient = await thirdBlockedHandle?.evaluate((el) => {
|
||||
const style = window.getComputedStyle(el);
|
||||
return style.backgroundColor === "rgb(228, 228, 231)";
|
||||
});
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
expect(hasGradient).toBe(true);
|
||||
expect(secondHasGradient).toBe(true);
|
||||
expect(thirdHasGradient).toBe(true);
|
||||
|
||||
const unlockedHandle = await page
|
||||
const unlockedHandle = page
|
||||
.getByTestId("div-handle-textinput-shownode-text-left")
|
||||
.last();
|
||||
const secondUnlockedHandle = await page
|
||||
const secondUnlockedHandle = page
|
||||
.getByTestId("div-handle-combinetext-shownode-second text-left")
|
||||
.last();
|
||||
const thirdUnlockedHandle = await page
|
||||
const thirdUnlockedHandle = page
|
||||
.getByTestId("div-handle-combinetext-shownode-second text-left")
|
||||
.first();
|
||||
const fourthUnlockedHandle = await page
|
||||
const fourthUnlockedHandle = page
|
||||
.getByTestId("div-handle-textoutput-shownode-text-left")
|
||||
.first();
|
||||
|
||||
|
|
@ -188,8 +142,6 @@ test(
|
|||
);
|
||||
});
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const secondHasGradientUnlocked = await secondUnlockedHandle?.evaluate(
|
||||
(el) => {
|
||||
const style = window.getComputedStyle(el);
|
||||
|
|
@ -200,15 +152,11 @@ test(
|
|||
},
|
||||
);
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const thirdHasGradientLocked = await thirdUnlockedHandle?.evaluate((el) => {
|
||||
const style = window.getComputedStyle(el);
|
||||
return style.backgroundColor === "rgb(228, 228, 231)";
|
||||
});
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const fourthHasGradientUnlocked = await fourthUnlockedHandle?.evaluate(
|
||||
(el) => {
|
||||
const style = window.getComputedStyle(el);
|
||||
|
|
@ -219,8 +167,6 @@ test(
|
|||
},
|
||||
);
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
expect(hasGradientUnlocked).toBe(true);
|
||||
expect(secondHasGradientUnlocked).toBe(true);
|
||||
expect(thirdHasGradientLocked).toBe(true);
|
||||
|
|
@ -242,38 +188,35 @@ test(
|
|||
|
||||
await page.getByRole("button", { name: "Group" }).click();
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await page.getByTitle("fit view").click();
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
//connection 2
|
||||
const elementTextOutput0 = await page
|
||||
const elementTextOutput0 = page
|
||||
.getByTestId("handle-textinput-shownode-text-right")
|
||||
.nth(0);
|
||||
await elementTextOutput0.click();
|
||||
const elementGroupInput0 = await page.getByTestId(
|
||||
const elementGroupInput0 = page.getByTestId(
|
||||
"handle-groupnode-shownode-first text-left",
|
||||
);
|
||||
await elementGroupInput0.click();
|
||||
|
||||
//connection 3
|
||||
const elementTextOutput1 = await page
|
||||
const elementTextOutput1 = page
|
||||
.getByTestId("handle-textinput-shownode-text-right")
|
||||
.nth(2);
|
||||
await elementTextOutput1.click();
|
||||
const elementGroupInput1 = await page
|
||||
|
||||
const elementGroupInput1 = page
|
||||
.getByTestId("handle-groupnode-shownode-second text-left")
|
||||
.nth(1);
|
||||
await elementGroupInput1.click();
|
||||
|
||||
//connection 4
|
||||
const elementGroupOutput = await page
|
||||
const elementGroupOutput = page
|
||||
.getByTestId("handle-groupnode-shownode-combined text-right")
|
||||
.nth(0);
|
||||
await elementGroupOutput.click();
|
||||
const elementTextOutputInput = await page
|
||||
const elementTextOutputInput = page
|
||||
.getByTestId("handle-textoutput-shownode-text-left")
|
||||
.nth(0);
|
||||
|
||||
|
|
@ -281,32 +224,26 @@ test(
|
|||
|
||||
await page.getByTestId("textarea_str_input_value").nth(0).fill(randomName);
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
await page
|
||||
.getByTestId("textarea_str_input_value")
|
||||
.nth(1)
|
||||
.fill(secondRandomName);
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await page
|
||||
.getByPlaceholder("Type something...", { exact: true })
|
||||
.nth(4)
|
||||
.fill(thirdRandomName);
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await page
|
||||
.getByPlaceholder("Type something...", { exact: true })
|
||||
.nth(3)
|
||||
.fill("-");
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await page
|
||||
.getByPlaceholder("Type something...", { exact: true })
|
||||
.nth(2)
|
||||
.fill("-");
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await page.getByTestId("button_run_text output").last().click();
|
||||
|
||||
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
||||
|
|
@ -314,13 +251,11 @@ test(
|
|||
await page.getByText("built successfully").last().click({
|
||||
timeout: 15000,
|
||||
});
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
expect(
|
||||
await page.getByTestId("output-inspection-combined text").first(),
|
||||
).not.toBeDisabled();
|
||||
await page.getByTestId("output-inspection-combined text").first().click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await page.getByText("Component Output").isVisible();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue