Skip to content

chore: add e2e test for org groups #15853

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 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add a quota test
  • Loading branch information
aslilac committed Dec 13, 2024
commit bac9d8fa2a1b9c6d506d184adc65036ab7f0e9dd
35 changes: 34 additions & 1 deletion site/e2e/tests/organizationGroups.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { expect, test } from "@playwright/test";
import { createOrganization, createUser, setupApiCalls } from "../api";
import {
createGroup,
createOrganization,
createUser,
setupApiCalls,
} from "../api";
import { expectUrl } from "../expectUrl";
import { randomName, requiresLicense } from "../helpers";
import { beforeCoderTest } from "../hooks";
Expand Down Expand Up @@ -68,3 +73,31 @@ test("create group", async ({ page }) => {
await expectUrl(page).toHavePathName(`/organizations/${org.name}/groups`);
await expect(page).toHaveTitle(`Groups - Org ${org.name} - Coder`);
});

test("change quota settings", async ({ page }) => {
requiresLicense();

// Create a new organization and group
const org = await createOrganization();
const group = await createGroup(org.id);

// Go to settings
await page.goto(`/organizations/${org.name}/groups/${group.name}`);
await page.getByRole("button", { name: "Settings" }).click();
expectUrl(page).toHavePathName(
`/organizations/${org.name}/groups/${group.name}/settings`,
);

// Update Quota
await page.getByLabel("Quota Allowance").fill("100");
await page.getByRole("button", { name: "Submit" }).click();

// We should get sent back to the group page afterwards
expectUrl(page).toHavePathName(
`/organizations/${org.name}/groups/${group.name}`,
);

// ...and that setting should persist if we go back
await page.getByRole("button", { name: "Settings" }).click();
await expect(page.getByLabel("Quota Allowance")).toHaveValue("100");
});
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ export const GroupPage: FC = () => {
{canUpdateGroup && (
<Stack direction="row" spacing={2}>
<Button
role="button"
component={RouterLink}
startIcon={<SettingsOutlined />}
to="settings"
component={RouterLink}
>
Settings
</Button>
Expand Down
Loading