Skip to content

chore: enhance tests for TemplateSchedulePage #9801

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 8 commits into from
Sep 21, 2023
Prev Previous commit
Next Next commit
chore: add assertion that submit button is not disabled
  • Loading branch information
Parkreiner committed Sep 20, 2023
commit 62fe36c47b69471b973756722accc2fa798ebc3c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ const fillAndSubmitForm = async ({
}: FillAndSubmitConfig) => {
const user = userEvent.setup();

const submitButton = screen.getByRole("button", {
name: FooterFormLanguage.defaultSubmitLabel,
});

// This should be removed once we start removing disabled states from the UI;
// not worried about this getting forgotten, because it will trigger an error
// at some point once that migration starts
expect(submitButton).toBeDisabled();

if (default_ttl_ms) {
const defaultTtlField = await screen.findByLabelText(
"Default autostop (hours)",
Expand Down Expand Up @@ -93,9 +102,7 @@ const fillAndSubmitForm = async ({
);
}

const submitButton = await screen.findByText(
FooterFormLanguage.defaultSubmitLabel,
);
expect(submitButton).not.toBeDisabled();
await user.click(submitButton);

// User needs to confirm dormancy and auto-deletion fields.
Expand Down