Skip to content

Commit bac9d8f

Browse files
committed
add a quota test
1 parent 92b6cfa commit bac9d8f

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

site/e2e/tests/organizationGroups.spec.ts

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { expect, test } from "@playwright/test";
2-
import { createOrganization, createUser, setupApiCalls } from "../api";
2+
import {
3+
createGroup,
4+
createOrganization,
5+
createUser,
6+
setupApiCalls,
7+
} from "../api";
38
import { expectUrl } from "../expectUrl";
49
import { randomName, requiresLicense } from "../helpers";
510
import { beforeCoderTest } from "../hooks";
@@ -68,3 +73,31 @@ test("create group", async ({ page }) => {
6873
await expectUrl(page).toHavePathName(`/organizations/${org.name}/groups`);
6974
await expect(page).toHaveTitle(`Groups - Org ${org.name} - Coder`);
7075
});
76+
77+
test("change quota settings", async ({ page }) => {
78+
requiresLicense();
79+
80+
// Create a new organization and group
81+
const org = await createOrganization();
82+
const group = await createGroup(org.id);
83+
84+
// Go to settings
85+
await page.goto(`/organizations/${org.name}/groups/${group.name}`);
86+
await page.getByRole("button", { name: "Settings" }).click();
87+
expectUrl(page).toHavePathName(
88+
`/organizations/${org.name}/groups/${group.name}/settings`,
89+
);
90+
91+
// Update Quota
92+
await page.getByLabel("Quota Allowance").fill("100");
93+
await page.getByRole("button", { name: "Submit" }).click();
94+
95+
// We should get sent back to the group page afterwards
96+
expectUrl(page).toHavePathName(
97+
`/organizations/${org.name}/groups/${group.name}`,
98+
);
99+
100+
// ...and that setting should persist if we go back
101+
await page.getByRole("button", { name: "Settings" }).click();
102+
await expect(page.getByLabel("Quota Allowance")).toHaveValue("100");
103+
});

site/src/pages/ManagementSettingsPage/GroupsPage/GroupPage.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ export const GroupPage: FC = () => {
111111
{canUpdateGroup && (
112112
<Stack direction="row" spacing={2}>
113113
<Button
114+
role="button"
115+
component={RouterLink}
114116
startIcon={<SettingsOutlined />}
115117
to="settings"
116-
component={RouterLink}
117118
>
118119
Settings
119120
</Button>

0 commit comments

Comments
 (0)