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