fix: Test Stability Enhancements (nightly fix) (#7207)
* ✨ (PageComponent/index.tsx): Update maxZoom value to 3 for better user experience 🔧 (globalVariables.spec.ts): Refactor code to use hover and click methods for better readability and maintainability ♻️ (publish-flow.spec.ts): Refactor adjustScreenView function to accept parameters for better flexibility and update zoom out value to 3 * ✨ (globalVariables.spec.ts): update the selector for clicking the last element with the test ID "add-component-button-openai" to ensure the correct element is clicked ✨ (publish-flow.spec.ts): update the selector for clicking the last element with the test ID "add-component-button-chat-input" to ensure the correct element is clicked
This commit is contained in:
parent
ddda5970aa
commit
905ea02779
4 changed files with 16 additions and 28 deletions
|
|
@ -578,7 +578,7 @@ export default function Page({
|
||||||
}}
|
}}
|
||||||
className="theme-attribution"
|
className="theme-attribution"
|
||||||
minZoom={0.2}
|
minZoom={0.2}
|
||||||
maxZoom={8}
|
maxZoom={3}
|
||||||
zoomOnScroll={!view}
|
zoomOnScroll={!view}
|
||||||
zoomOnPinch={!view}
|
zoomOnPinch={!view}
|
||||||
panOnDrag={!view}
|
panOnDrag={!view}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,8 @@ test(
|
||||||
.getByTestId("handle-retrievalqa-shownode-language model-left")
|
.getByTestId("handle-retrievalqa-shownode-language model-left")
|
||||||
.all();
|
.all();
|
||||||
|
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
for (const element of rqaChainInputElements1) {
|
for (const element of rqaChainInputElements1) {
|
||||||
if (await element.isVisible()) {
|
if (await element.isVisible()) {
|
||||||
visibleElementHandle = element;
|
visibleElementHandle = element;
|
||||||
|
|
@ -71,6 +73,8 @@ test(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
await visibleElementHandle.hover().then(async () => {
|
await visibleElementHandle.hover().then(async () => {
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText("Drag to connect compatible outputs").first(),
|
page.getByText("Drag to connect compatible outputs").first(),
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ test(
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByTestId("modelsOpenAI")
|
.getByTestId("modelsOpenAI")
|
||||||
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
.hover()
|
||||||
await page.mouse.up();
|
.then(async () => {
|
||||||
await page.mouse.down();
|
await page.getByTestId("add-component-button-openai").last().click();
|
||||||
|
});
|
||||||
|
|
||||||
await adjustScreenView(page);
|
await page.getByTestId("fit_view").click();
|
||||||
|
|
||||||
const genericName = Math.random().toString();
|
const genericName = Math.random().toString();
|
||||||
const credentialName = Math.random().toString();
|
const credentialName = Math.random().toString();
|
||||||
|
|
|
||||||
|
|
@ -12,27 +12,6 @@ test(
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
});
|
});
|
||||||
|
|
||||||
let flowId = "";
|
|
||||||
let retries = 0;
|
|
||||||
const maxRetries = 3;
|
|
||||||
|
|
||||||
while (flowId.length === 0 && retries < maxRetries) {
|
|
||||||
const url = page.url();
|
|
||||||
flowId = url.split("/").pop() || "";
|
|
||||||
|
|
||||||
if (flowId.length === 0) {
|
|
||||||
console.log(
|
|
||||||
`Empty flowId detected (attempt ${retries + 1}/${maxRetries}), waiting and retrying...`,
|
|
||||||
);
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
retries++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(flowId).toBeDefined();
|
|
||||||
expect(flowId).not.toBeNull();
|
|
||||||
expect(flowId.length).toBeGreaterThan(0);
|
|
||||||
|
|
||||||
await page.getByTestId("blank-flow").click();
|
await page.getByTestId("blank-flow").click();
|
||||||
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
|
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
|
|
@ -44,16 +23,20 @@ test(
|
||||||
await page.waitForSelector('[data-testid="inputsChat Input"]', {
|
await page.waitForSelector('[data-testid="inputsChat Input"]', {
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
});
|
});
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByTestId("inputsChat Input")
|
.getByTestId("inputsChat Input")
|
||||||
.hover({ timeout: 3000 })
|
.hover({ timeout: 3000 })
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await page.getByTestId("add-component-button-chat-input").click();
|
await page
|
||||||
|
.getByTestId("add-component-button-chat-input")
|
||||||
|
.last()
|
||||||
|
.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
await adjustScreenView(page);
|
await adjustScreenView(page, { numberOfZoomOut: 3 });
|
||||||
await page.getByTestId("publish-button").click();
|
await page.getByTestId("publish-button").click();
|
||||||
|
|
||||||
await page.waitForTimeout(3000);
|
await page.waitForTimeout(3000);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue