@app-vitals/agent-admin 1.107.5 → 1.108.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/e2e/real/admin-access.real.e2e.ts +77 -68
- package/e2e/real/agent-management.real.e2e.ts +165 -143
- package/e2e/real/owner-access.real.e2e.ts +228 -212
- package/openapi.platform.json +127 -6
- package/package.json +2 -2
- package/src/account-created-notifier.ts +1 -1
- package/src/account-onboarding.integration.test.ts +69 -0
- package/src/account-onboarding.ts +29 -3
- package/src/account-repo-lookup-api.integration.test.ts +163 -0
- package/src/account-repo-lookup-api.ts +106 -0
- package/src/account-repo-lookup.ts +89 -0
- package/src/account-trial-expiry-sweeper.ts +1 -1
- package/src/accounts-api.integration.test.ts +5 -2
- package/src/accounts-api.smoke.test.ts +21 -5
- package/src/accounts-api.ts +12 -15
- package/src/admin-boot-config.ts +2 -0
- package/src/admin-boot-config.unit.test.ts +27 -0
- package/src/admin-boot.ts +18 -10
- package/src/admin-spec.ts +6 -0
- package/src/admin-ui-account.smoke.test.ts +7 -3
- package/src/admin-ui-account.ts +10 -15
- package/src/admin-ui-accounts.smoke.test.ts +4 -4
- package/src/admin-ui-accounts.ts +7 -11
- package/src/admin-ui-settings-nav-context.smoke.test.ts +24 -0
- package/src/admin-ui-settings.smoke.test.ts +17 -1
- package/src/admin-ui.smoke.test.ts +168 -2
- package/src/admin-ui.ts +39 -26
- package/src/agent-management-access.integration.test.ts +18 -6
- package/src/agent-manifest.ts +2 -1
- package/src/agent-provisioner.integration.test.ts +10 -10
- package/src/agent-provisioner.ts +10 -1
- package/src/agent-provisioner.unit.test.ts +110 -36
- package/src/agent-templates-api.integration.test.ts +23 -5
- package/src/agent-templates-api.ts +11 -8
- package/src/caller-scope.integration.test.ts +8 -6
- package/src/caller-scope.ts +32 -26
- package/src/caller-scope.unit.test.ts +15 -11
- package/src/openapi-schemas.ts +22 -0
- package/src/platform-routes.ts +14 -2
- package/src/platform-routes.unit.test.ts +2 -0
|
@@ -1,88 +1,97 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* admin/e2e/real/admin-access.real.e2e.ts
|
|
3
3
|
*
|
|
4
|
-
* Real-service e2e, self-serve OFF (matches production): the platform
|
|
5
|
-
* (on the allowlist, in no account) sees agents from both accounts,
|
|
6
|
-
* platform Settings item, and can open the agent
|
|
4
|
+
* Real-service e2e, self-serve OFF (matches production) and ON: the platform
|
|
5
|
+
* admin (on the allowlist, in no account) sees agents from both accounts,
|
|
6
|
+
* every platform Settings item including Accounts, and can open the agent
|
|
7
|
+
* creation form.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import { expect, test } from "@playwright/test";
|
|
10
11
|
import { AGENTS, EMAILS } from "./constants.ts";
|
|
11
12
|
import { RealHarness } from "./fixture.ts";
|
|
12
13
|
|
|
13
|
-
const harness = new RealHarness({
|
|
14
|
-
selfServe: false,
|
|
15
|
-
adminPort: 3518,
|
|
16
|
-
chatPort: 3519,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
14
|
test.describe.configure({ mode: "serial" });
|
|
20
15
|
|
|
21
|
-
test.beforeAll(async () => {
|
|
22
|
-
test.setTimeout(240_000);
|
|
23
|
-
await harness.start();
|
|
24
|
-
});
|
|
25
|
-
test.afterAll(async () => {
|
|
26
|
-
await harness.stop();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
16
|
const SETTINGS_ITEMS = [
|
|
30
17
|
"/admin/settings/github-enterprise",
|
|
31
18
|
"/admin/settings/templates",
|
|
32
19
|
"/admin/settings/slack-config-token",
|
|
20
|
+
"/admin/accounts",
|
|
33
21
|
];
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
await harness.signIn(context, EMAILS.admin);
|
|
41
|
-
await page.goto(`${harness.adminUrl}/admin/agents`);
|
|
42
|
-
for (const agent of Object.values(AGENTS)) {
|
|
43
|
-
await expect(page.getByText(agent.name).first()).toBeVisible();
|
|
44
|
-
}
|
|
45
|
-
const res = await context.request.get(`${harness.adminUrl}/agents`);
|
|
46
|
-
const ids = ((await res.json()) as { id: string }[]).map((a) => a.id);
|
|
47
|
-
expect(ids.sort()).toEqual(
|
|
48
|
-
Object.values(AGENTS)
|
|
49
|
-
.map((a) => a.id)
|
|
50
|
-
.sort(),
|
|
51
|
-
);
|
|
52
|
-
});
|
|
23
|
+
/** The self-serve setting must not change any of this. */
|
|
24
|
+
const MODES = [
|
|
25
|
+
{ selfServe: false, adminPort: 3518, chatPort: 3519 },
|
|
26
|
+
{ selfServe: true, adminPort: 3530, chatPort: 3531 },
|
|
27
|
+
];
|
|
53
28
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
await
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
29
|
+
for (const mode of MODES) {
|
|
30
|
+
test.describe(`self-serve ${mode.selfServe ? "on" : "off"}`, () => {
|
|
31
|
+
test.describe.configure({ mode: "serial" });
|
|
32
|
+
const harness = new RealHarness(mode);
|
|
33
|
+
|
|
34
|
+
test.beforeAll(async () => {
|
|
35
|
+
test.setTimeout(240_000);
|
|
36
|
+
await harness.start();
|
|
37
|
+
});
|
|
38
|
+
test.afterAll(async () => {
|
|
39
|
+
await harness.stop();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test.describe("platform admin", () => {
|
|
43
|
+
test("Agents list shows agents from both accounts", async ({
|
|
44
|
+
page,
|
|
45
|
+
context,
|
|
46
|
+
}) => {
|
|
47
|
+
await harness.signIn(context, EMAILS.admin);
|
|
48
|
+
await page.goto(`${harness.adminUrl}/admin/agents`);
|
|
49
|
+
for (const agent of Object.values(AGENTS)) {
|
|
50
|
+
await expect(page.getByText(agent.name).first()).toBeVisible();
|
|
51
|
+
}
|
|
52
|
+
const res = await context.request.get(`${harness.adminUrl}/agents`);
|
|
53
|
+
const ids = ((await res.json()) as { id: string }[]).map((a) => a.id);
|
|
54
|
+
expect(ids.sort()).toEqual(
|
|
55
|
+
Object.values(AGENTS)
|
|
56
|
+
.map((a) => a.id)
|
|
57
|
+
.sort(),
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("every platform Settings item is in the nav and opens", async ({
|
|
62
|
+
page,
|
|
63
|
+
context,
|
|
64
|
+
}) => {
|
|
65
|
+
await harness.signIn(context, EMAILS.admin);
|
|
66
|
+
const base = harness.adminUrl;
|
|
67
|
+
const landing = await page.goto(`${base}/admin/settings`);
|
|
68
|
+
expect(landing?.status()).toBe(200);
|
|
69
|
+
await expect(page.locator("nav.settings-sidebar")).toBeVisible();
|
|
70
|
+
for (const href of SETTINGS_ITEMS) {
|
|
71
|
+
await expect(
|
|
72
|
+
page.locator(`nav.settings-sidebar a[href^="${href}"]`),
|
|
73
|
+
href,
|
|
74
|
+
).toHaveCount(1);
|
|
75
|
+
}
|
|
76
|
+
for (const path of SETTINGS_ITEMS) {
|
|
77
|
+
const res = await page.goto(`${base}${path}`);
|
|
78
|
+
expect(res?.status(), path).toBe(200);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
74
81
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
test("the admin can open the agent creation form", async ({
|
|
83
|
+
page,
|
|
84
|
+
context,
|
|
85
|
+
}) => {
|
|
86
|
+
await harness.signIn(context, EMAILS.admin);
|
|
87
|
+
await page.goto(`${harness.adminUrl}/admin/agents`);
|
|
88
|
+
await expect(
|
|
89
|
+
page.locator('a[href="/admin/agents/new"]').first(),
|
|
90
|
+
).toBeVisible();
|
|
91
|
+
const form = await page.goto(`${harness.adminUrl}/admin/agents/new`);
|
|
92
|
+
expect(form?.status()).toBe(200);
|
|
93
|
+
await expect(page.locator("form").first()).toBeVisible();
|
|
94
|
+
});
|
|
95
|
+
});
|
|
87
96
|
});
|
|
88
|
-
}
|
|
97
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* admin/e2e/real/agent-management.real.e2e.ts
|
|
3
3
|
*
|
|
4
|
-
* Real-service e2e, self-serve ON
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Real-service e2e, self-serve OFF and ON (the setting must not change it):
|
|
5
|
+
* who may MANAGE an agent (settings, members, credentials, tools, crons,
|
|
6
|
+
* tokens, delete). Only platform admins and the owner of the agent's own
|
|
7
|
+
* account may. A member of the agent keeps using it
|
|
7
8
|
* (pages, JSON reads) but every management action is 403 and the controls are
|
|
8
9
|
* not rendered; an owner of another account is refused entirely.
|
|
9
10
|
*
|
|
@@ -15,22 +16,8 @@ import { expect, test } from "@playwright/test";
|
|
|
15
16
|
import { AGENTS, EMAILS } from "./constants.ts";
|
|
16
17
|
import { RealHarness } from "./fixture.ts";
|
|
17
18
|
|
|
18
|
-
const harness = new RealHarness({
|
|
19
|
-
selfServe: true,
|
|
20
|
-
adminPort: 3524,
|
|
21
|
-
chatPort: 3525,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
19
|
test.describe.configure({ mode: "serial" });
|
|
25
20
|
|
|
26
|
-
test.beforeAll(async () => {
|
|
27
|
-
test.setTimeout(240_000);
|
|
28
|
-
await harness.start();
|
|
29
|
-
});
|
|
30
|
-
test.afterAll(async () => {
|
|
31
|
-
await harness.stop();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
21
|
const alpha = AGENTS.alpha;
|
|
35
22
|
const REFUSED = [403, 404];
|
|
36
23
|
|
|
@@ -61,135 +48,170 @@ const uiWrites = [
|
|
|
61
48
|
"delete",
|
|
62
49
|
].map((p) => `/admin/agents/${alpha.id}/${p}`);
|
|
63
50
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
await harness.signIn(context, EMAILS.member1);
|
|
70
|
-
const base = harness.adminUrl;
|
|
71
|
-
const res = await page.goto(`${base}/admin/agents/${alpha.id}`);
|
|
72
|
-
expect(res?.status()).toBe(200);
|
|
73
|
-
await expect(page.getByText(alpha.name).first()).toBeVisible();
|
|
74
|
-
await expect(page.getByText("Danger Zone")).toHaveCount(0);
|
|
75
|
-
await expect(page.locator(`form[action$="/delete"]`)).toHaveCount(0);
|
|
76
|
-
|
|
77
|
-
const access = await page.goto(`${base}/admin/agents/${alpha.id}/access`);
|
|
78
|
-
expect(access?.status()).toBe(200);
|
|
79
|
-
await expect(
|
|
80
|
-
page.locator(`form[action="/admin/agents/${alpha.id}/members"]`),
|
|
81
|
-
).toHaveCount(0);
|
|
82
|
-
await expect(
|
|
83
|
-
page.locator(`form[action="/admin/agents/${alpha.id}/tokens"]`),
|
|
84
|
-
).toHaveCount(0);
|
|
85
|
-
|
|
86
|
-
for (const path of [`/agents/${alpha.id}`, `/agents/${alpha.id}/envs`]) {
|
|
87
|
-
expect((await context.request.get(`${base}${path}`)).status()).toBe(200);
|
|
88
|
-
}
|
|
89
|
-
const chat = await page.goto(`${base}/admin/chat?agentId=${alpha.id}`);
|
|
90
|
-
expect(chat?.status()).toBe(200);
|
|
91
|
-
});
|
|
51
|
+
/** The self-serve setting must not change any of this. */
|
|
52
|
+
const MODES = [
|
|
53
|
+
{ selfServe: false, adminPort: 3528, chatPort: 3529 },
|
|
54
|
+
{ selfServe: true, adminPort: 3524, chatPort: 3525 },
|
|
55
|
+
];
|
|
92
56
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
57
|
+
for (const mode of MODES) {
|
|
58
|
+
test.describe(`self-serve ${mode.selfServe ? "on" : "off"}`, () => {
|
|
59
|
+
test.describe.configure({ mode: "serial" });
|
|
60
|
+
const harness = new RealHarness(mode);
|
|
61
|
+
|
|
62
|
+
test.beforeAll(async () => {
|
|
63
|
+
test.setTimeout(240_000);
|
|
64
|
+
await harness.start();
|
|
65
|
+
});
|
|
66
|
+
test.afterAll(async () => {
|
|
67
|
+
await harness.stop();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test.describe("member of the agent: uses it, cannot manage it", () => {
|
|
71
|
+
test("reads and pages still work; management controls are not shown", async ({
|
|
72
|
+
page,
|
|
73
|
+
context,
|
|
74
|
+
}) => {
|
|
75
|
+
await harness.signIn(context, EMAILS.member1);
|
|
76
|
+
const base = harness.adminUrl;
|
|
77
|
+
const res = await page.goto(`${base}/admin/agents/${alpha.id}`);
|
|
78
|
+
expect(res?.status()).toBe(200);
|
|
79
|
+
await expect(page.getByText(alpha.name).first()).toBeVisible();
|
|
80
|
+
await expect(page.getByText("Danger Zone")).toHaveCount(0);
|
|
81
|
+
await expect(page.locator(`form[action$="/delete"]`)).toHaveCount(0);
|
|
82
|
+
|
|
83
|
+
const access = await page.goto(
|
|
84
|
+
`${base}/admin/agents/${alpha.id}/access`,
|
|
85
|
+
);
|
|
86
|
+
expect(access?.status()).toBe(200);
|
|
87
|
+
await expect(
|
|
88
|
+
page.locator(`form[action="/admin/agents/${alpha.id}/members"]`),
|
|
89
|
+
).toHaveCount(0);
|
|
90
|
+
await expect(
|
|
91
|
+
page.locator(`form[action="/admin/agents/${alpha.id}/tokens"]`),
|
|
92
|
+
).toHaveCount(0);
|
|
93
|
+
|
|
94
|
+
for (const path of [
|
|
95
|
+
`/agents/${alpha.id}`,
|
|
96
|
+
`/agents/${alpha.id}/envs`,
|
|
97
|
+
]) {
|
|
98
|
+
expect((await context.request.get(`${base}${path}`)).status()).toBe(
|
|
99
|
+
200,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
const chat = await page.goto(`${base}/admin/chat?agentId=${alpha.id}`);
|
|
103
|
+
expect(chat?.status()).toBe(200);
|
|
107
104
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
...(data ? { data } : {}),
|
|
105
|
+
|
|
106
|
+
test("every JSON and UI management action is 403", async ({
|
|
107
|
+
context,
|
|
108
|
+
}) => {
|
|
109
|
+
await harness.signIn(context, EMAILS.member1);
|
|
110
|
+
const base = harness.adminUrl;
|
|
111
|
+
for (const [method, path, data] of jsonWrites) {
|
|
112
|
+
const res = await context.request.fetch(`${base}${path}`, {
|
|
113
|
+
method,
|
|
114
|
+
...(data ? { data } : {}),
|
|
115
|
+
});
|
|
116
|
+
expect(res.status(), `${method} ${path}`).toBe(403);
|
|
117
|
+
}
|
|
118
|
+
for (const path of uiWrites) {
|
|
119
|
+
const res = await context.request.post(`${base}${path}`, {
|
|
120
|
+
form: { email: "n@example.com", key: "K", value: "V" },
|
|
121
|
+
maxRedirects: 0,
|
|
122
|
+
});
|
|
123
|
+
expect(res.status(), `POST ${path}`).toBe(403);
|
|
124
|
+
}
|
|
125
|
+
const setup = await context.request.get(
|
|
126
|
+
`${base}/admin/agents/${alpha.id}/setup`,
|
|
127
|
+
);
|
|
128
|
+
expect(setup.status()).toBe(403);
|
|
133
129
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test.describe("owner of another account: refused entirely", () => {
|
|
133
|
+
test("pages, reads and every management action are refused", async ({
|
|
134
|
+
page,
|
|
135
|
+
context,
|
|
136
|
+
}) => {
|
|
137
|
+
await harness.signIn(context, EMAILS.owner2);
|
|
138
|
+
const base = harness.adminUrl;
|
|
139
|
+
const res = await page.goto(`${base}/admin/agents/${alpha.id}`);
|
|
140
|
+
expect(REFUSED).toContain(res?.status());
|
|
141
|
+
await expect(page.getByText(alpha.name)).toHaveCount(0);
|
|
142
|
+
const read = await context.request.get(`${base}/agents/${alpha.id}`);
|
|
143
|
+
expect(REFUSED).toContain(read.status());
|
|
144
|
+
for (const [method, path, data] of jsonWrites) {
|
|
145
|
+
const w = await context.request.fetch(`${base}${path}`, {
|
|
146
|
+
method,
|
|
147
|
+
...(data ? { data } : {}),
|
|
148
|
+
});
|
|
149
|
+
expect(REFUSED, `${method} ${path}`).toContain(w.status());
|
|
150
|
+
}
|
|
151
|
+
for (const path of uiWrites) {
|
|
152
|
+
const w = await context.request.post(`${base}${path}`, {
|
|
153
|
+
form: { email: "n@example.com", key: "K", value: "V" },
|
|
154
|
+
maxRedirects: 0,
|
|
155
|
+
});
|
|
156
|
+
expect(REFUSED, `POST ${path}`).toContain(w.status());
|
|
157
|
+
}
|
|
140
158
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
expect(row.name).toBe(alpha.name);
|
|
159
|
-
expect(row.repos).toEqual([...alpha.repos]);
|
|
160
|
-
expect(row.cleanupAfterDays).not.toBe(20);
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test.describe("owner of the agent's account and platform admin manage it", () => {
|
|
165
|
-
for (const [label, email] of [
|
|
166
|
-
["account owner", EMAILS.owner1],
|
|
167
|
-
["platform admin", EMAILS.admin],
|
|
168
|
-
] as const) {
|
|
169
|
-
test(`${label}: controls shown, settings change succeeds`, async ({
|
|
170
|
-
page,
|
|
171
|
-
context,
|
|
172
|
-
}) => {
|
|
173
|
-
await harness.signIn(context, email);
|
|
174
|
-
const base = harness.adminUrl;
|
|
175
|
-
const res = await page.goto(`${base}/admin/agents/${alpha.id}`);
|
|
176
|
-
expect(res?.status()).toBe(200);
|
|
177
|
-
await expect(page.getByText("Danger Zone").first()).toBeVisible();
|
|
178
|
-
const access = await page.goto(`${base}/admin/agents/${alpha.id}/access`);
|
|
179
|
-
expect(access?.status()).toBe(200);
|
|
180
|
-
await expect(
|
|
181
|
-
page.locator(`form[action="/admin/agents/${alpha.id}/members"]`),
|
|
182
|
-
).toHaveCount(1);
|
|
183
|
-
|
|
184
|
-
const patch = await context.request.patch(`${base}/agents/${alpha.id}`, {
|
|
185
|
-
data: { cleanupAfterDays: label === "account owner" ? 21 : 22 },
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test.describe("nothing changed by refused requests", () => {
|
|
162
|
+
test("agent record is untouched", async ({ context }) => {
|
|
163
|
+
await harness.signIn(context, EMAILS.admin);
|
|
164
|
+
const res = await context.request.get(
|
|
165
|
+
`${harness.adminUrl}/agents/${alpha.id}`,
|
|
166
|
+
);
|
|
167
|
+
expect(res.status()).toBe(200);
|
|
168
|
+
const row = (await res.json()) as {
|
|
169
|
+
name: string;
|
|
170
|
+
repos: string[];
|
|
171
|
+
cleanupAfterDays: number | null;
|
|
172
|
+
};
|
|
173
|
+
expect(row.name).toBe(alpha.name);
|
|
174
|
+
expect(row.repos).toEqual([...alpha.repos]);
|
|
175
|
+
expect(row.cleanupAfterDays).not.toBe(20);
|
|
186
176
|
});
|
|
187
|
-
expect(patch.status()).toBe(200);
|
|
188
|
-
const env = await context.request.post(
|
|
189
|
-
`${base}/admin/agents/${alpha.id}/envs`,
|
|
190
|
-
{ form: { key: "E2E_KEY", value: "v" }, maxRedirects: 0 },
|
|
191
|
-
);
|
|
192
|
-
expect(env.status()).toBe(302);
|
|
193
177
|
});
|
|
194
|
-
|
|
195
|
-
|
|
178
|
+
|
|
179
|
+
test.describe("owner of the agent's account and platform admin manage it", () => {
|
|
180
|
+
for (const [label, email] of [
|
|
181
|
+
["account owner", EMAILS.owner1],
|
|
182
|
+
["platform admin", EMAILS.admin],
|
|
183
|
+
] as const) {
|
|
184
|
+
test(`${label}: controls shown, settings change succeeds`, async ({
|
|
185
|
+
page,
|
|
186
|
+
context,
|
|
187
|
+
}) => {
|
|
188
|
+
await harness.signIn(context, email);
|
|
189
|
+
const base = harness.adminUrl;
|
|
190
|
+
const res = await page.goto(`${base}/admin/agents/${alpha.id}`);
|
|
191
|
+
expect(res?.status()).toBe(200);
|
|
192
|
+
await expect(page.getByText("Danger Zone").first()).toBeVisible();
|
|
193
|
+
const access = await page.goto(
|
|
194
|
+
`${base}/admin/agents/${alpha.id}/access`,
|
|
195
|
+
);
|
|
196
|
+
expect(access?.status()).toBe(200);
|
|
197
|
+
await expect(
|
|
198
|
+
page.locator(`form[action="/admin/agents/${alpha.id}/members"]`),
|
|
199
|
+
).toHaveCount(1);
|
|
200
|
+
|
|
201
|
+
const patch = await context.request.patch(
|
|
202
|
+
`${base}/agents/${alpha.id}`,
|
|
203
|
+
{
|
|
204
|
+
data: { cleanupAfterDays: label === "account owner" ? 21 : 22 },
|
|
205
|
+
},
|
|
206
|
+
);
|
|
207
|
+
expect(patch.status()).toBe(200);
|
|
208
|
+
const env = await context.request.post(
|
|
209
|
+
`${base}/admin/agents/${alpha.id}/envs`,
|
|
210
|
+
{ form: { key: "E2E_KEY", value: "v" }, maxRedirects: 0 },
|
|
211
|
+
);
|
|
212
|
+
expect(env.status()).toBe(302);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
}
|