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
|
||||
.getByTestId("toolsMCP Server")
|
||||
.hover()
|
||||
.then(async () => {
|
||||
await page.getByTestId("add-component-button-mcp-server").click();
|
||||
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
|
||||
targetPosition: { x: 0, y: 0 },
|
||||
});
|
||||
|
||||
await page.getByTestId("fit_view").click();
|
||||
|
|
@ -32,14 +31,34 @@ test(
|
|||
|
||||
await page.getByTestId("dropdown_str_tool").isDisabled();
|
||||
|
||||
await page.getByTestId("refresh-button-command").click();
|
||||
let attempts = 0;
|
||||
const maxAttempts = 3;
|
||||
let dropdownEnabled = false;
|
||||
|
||||
await page.waitForSelector(
|
||||
'[data-testid="dropdown_str_tool"]:not([disabled])',
|
||||
{
|
||||
timeout: 30000,
|
||||
},
|
||||
);
|
||||
while (attempts < maxAttempts && !dropdownEnabled) {
|
||||
await page.getByTestId("refresh-button-command").click();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
try {
|
||||
await page.waitForSelector(
|
||||
'[data-testid="dropdown_str_tool"]:not([disabled])',
|
||||
{
|
||||
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();
|
||||
|
||||
|
|
@ -49,6 +68,10 @@ test(
|
|||
|
||||
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"]', {
|
||||
state: "visible",
|
||||
timeout: 30000,
|
||||
|
|
@ -83,14 +106,37 @@ test(
|
|||
|
||||
await page.getByTestId("tab_0_stdio").click();
|
||||
|
||||
await page.getByTestId("refresh-button-command").click();
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await page.waitForSelector(
|
||||
'[data-testid="dropdown_str_tool"]:not([disabled])',
|
||||
{
|
||||
timeout: 30000,
|
||||
},
|
||||
);
|
||||
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(
|
||||
'[data-testid="dropdown_str_tool"]:not([disabled])',
|
||||
{
|
||||
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();
|
||||
|
||||
|
|
@ -98,6 +144,10 @@ test(
|
|||
|
||||
await page.getByTestId("fetch-0-option").click();
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await page.getByTestId("fit_view").click();
|
||||
|
||||
expect(fetchOptionCount).toBeGreaterThan(0);
|
||||
|
||||
await page.waitForSelector('[data-testid="int_int_max_length"]', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue