Skip to content

fix: fix e2e tests #19076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ export const createWorkspace = async (
const name = randomName();
await page.getByLabel("name").fill(name);

if (buildParameters.length > 0) {
await page.waitForSelector("form", { state: "visible" });
}

await fillParameters(page, richParameters, buildParameters);

if (useExternalAuth) {
Expand Down Expand Up @@ -898,28 +902,29 @@ const fillParameters = async (
);
}

const parameterLabel = await page.waitForSelector(
`[data-testid='parameter-field-${richParameter.name}']`,
{ state: "visible" },
// Use modern locator approach instead of waitForSelector
const parameterLabel = page.getByTestId(
`parameter-field-${richParameter.name}`,
);
await expect(parameterLabel).toBeVisible();

if (richParameter.type === "bool") {
const parameterField = await parameterLabel.waitForSelector(
`[data-testid='parameter-field-bool'] .MuiRadio-root input[value='${buildParameter.value}']`,
);
const parameterField = parameterLabel
.getByTestId("parameter-field-bool")
.locator(`.MuiRadio-root input[value='${buildParameter.value}']`);
await parameterField.click();
} else if (richParameter.options.length > 0) {
const parameterField = await parameterLabel.waitForSelector(
`[data-testid='parameter-field-options'] .MuiRadio-root input[value='${buildParameter.value}']`,
);
const parameterField = parameterLabel
.getByTestId("parameter-field-options")
.locator(`.MuiRadio-root input[value='${buildParameter.value}']`);
await parameterField.click();
} else if (richParameter.type === "list(string)") {
throw new Error("not implemented yet"); // FIXME
} else {
// text or number
const parameterField = await parameterLabel.waitForSelector(
"[data-testid='parameter-field-text'] input",
);
const parameterField = parameterLabel
.getByTestId("parameter-field-text")
.locator("input");
await parameterField.fill(buildParameter.value);
}
}
Expand Down Expand Up @@ -1217,22 +1222,34 @@ export const disableDynamicParameters = async (
waitUntil: "domcontentloaded",
});

await page.waitForSelector("form", { state: "visible" });

// Find and uncheck the "Enable dynamic parameters" checkbox
const dynamicParamsCheckbox = page.getByRole("checkbox", {
name: /Enable dynamic parameters for workspace creation/,
});

await dynamicParamsCheckbox.waitFor({ state: "visible" });

// If the checkbox is checked, uncheck it
if (await dynamicParamsCheckbox.isChecked()) {
await dynamicParamsCheckbox.click();
}

// Save the changes
await page.getByRole("button", { name: /save/i }).click();
const saveButton = page.getByRole("button", { name: /save/i });
await saveButton.waitFor({ state: "visible" });
await saveButton.click();

// Wait for the success message or page to update
await page.waitForSelector("text=Template updated successfully", {
state: "visible",
timeout: 10000,
});
await page
.locator("[role='alert']:has-text('Template updated successfully')")
.first()
.waitFor({
state: "visible",
timeout: 15000,
});

// Additional wait to ensure the changes are persisted
await page.waitForTimeout(500);
};
Loading