test: Enhance MCP server test reliability with retry logic and improved interactions (nightly fix) (#7807)
This commit is contained in:
parent
eed7dee8bf
commit
5607ac9d8a
1 changed files with 67 additions and 17 deletions
|
|
@ -21,9 +21,8 @@ test(
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByTestId("toolsMCP Server")
|
.getByTestId("toolsMCP Server")
|
||||||
.hover()
|
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
||||||
.then(async () => {
|
targetPosition: { x: 0, y: 0 },
|
||||||
await page.getByTestId("add-component-button-mcp-server").click();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.getByTestId("fit_view").click();
|
await page.getByTestId("fit_view").click();
|
||||||
|
|
@ -32,14 +31,34 @@ test(
|
||||||
|
|
||||||
await page.getByTestId("dropdown_str_tool").isDisabled();
|
await page.getByTestId("dropdown_str_tool").isDisabled();
|
||||||
|
|
||||||
await page.getByTestId("refresh-button-command").click();
|
let attempts = 0;
|
||||||
|
const maxAttempts = 3;
|
||||||
|
let dropdownEnabled = false;
|
||||||
|
|
||||||
|
while (attempts < maxAttempts && !dropdownEnabled) {
|
||||||
|
await page.getByTestId("refresh-button-command").click();
|
||||||
|
await page.waitForTimeout(3000);
|
||||||
|
|
||||||
|
try {
|
||||||
await page.waitForSelector(
|
await page.waitForSelector(
|
||||||
'[data-testid="dropdown_str_tool"]:not([disabled])',
|
'[data-testid="dropdown_str_tool"]:not([disabled])',
|
||||||
{
|
{
|
||||||
timeout: 30000,
|
timeout: 10000,
|
||||||
|
state: "visible",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
dropdownEnabled = true;
|
||||||
|
} catch (error) {
|
||||||
|
attempts++;
|
||||||
|
console.log(`Retry attempt ${attempts} for refresh button`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dropdownEnabled) {
|
||||||
|
throw new Error(
|
||||||
|
"Dropdown did not become enabled after multiple refresh attempts",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await page.getByTestId("dropdown_str_tool").click();
|
await page.getByTestId("dropdown_str_tool").click();
|
||||||
|
|
||||||
|
|
@ -49,6 +68,10 @@ test(
|
||||||
|
|
||||||
await page.getByTestId("fetch-0-option").click();
|
await page.getByTestId("fetch-0-option").click();
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
await page.getByTestId("fit_view").click();
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="int_int_max_length"]', {
|
await page.waitForSelector('[data-testid="int_int_max_length"]', {
|
||||||
state: "visible",
|
state: "visible",
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
|
|
@ -83,14 +106,37 @@ test(
|
||||||
|
|
||||||
await page.getByTestId("tab_0_stdio").click();
|
await page.getByTestId("tab_0_stdio").click();
|
||||||
|
|
||||||
await page.getByTestId("refresh-button-command").click();
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
await page.getByTestId("fit_view").click();
|
||||||
|
|
||||||
|
attempts = 0;
|
||||||
|
dropdownEnabled = false;
|
||||||
|
|
||||||
|
while (attempts < maxAttempts && !dropdownEnabled) {
|
||||||
|
await page.getByTestId("refresh-button-command").click();
|
||||||
|
await page.waitForTimeout(3000);
|
||||||
|
|
||||||
|
try {
|
||||||
await page.waitForSelector(
|
await page.waitForSelector(
|
||||||
'[data-testid="dropdown_str_tool"]:not([disabled])',
|
'[data-testid="dropdown_str_tool"]:not([disabled])',
|
||||||
{
|
{
|
||||||
timeout: 30000,
|
timeout: 10000,
|
||||||
|
state: "visible",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
dropdownEnabled = true;
|
||||||
|
} catch (error) {
|
||||||
|
attempts++;
|
||||||
|
console.log(`Retry attempt ${attempts} for second refresh button`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dropdownEnabled) {
|
||||||
|
throw new Error(
|
||||||
|
"Dropdown did not become enabled after multiple refresh attempts",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await page.getByTestId("dropdown_str_tool").click();
|
await page.getByTestId("dropdown_str_tool").click();
|
||||||
|
|
||||||
|
|
@ -98,6 +144,10 @@ test(
|
||||||
|
|
||||||
await page.getByTestId("fetch-0-option").click();
|
await page.getByTestId("fetch-0-option").click();
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
await page.getByTestId("fit_view").click();
|
||||||
|
|
||||||
expect(fetchOptionCount).toBeGreaterThan(0);
|
expect(fetchOptionCount).toBeGreaterThan(0);
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="int_int_max_length"]', {
|
await page.waitForSelector('[data-testid="int_int_max_length"]', {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue