@percepta/create 3.5.1 → 3.5.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
|
-
import { expect, test, type Page } from "@playwright/test";
|
|
3
|
+
import { expect, test, type Browser, type Page } from "@playwright/test";
|
|
4
4
|
|
|
5
5
|
const execFileAsync = promisify(execFile);
|
|
6
6
|
const password = "password";
|
|
@@ -13,7 +13,8 @@ const users = {
|
|
|
13
13
|
} as const;
|
|
14
14
|
|
|
15
15
|
test.describe("RBAC access", () => {
|
|
16
|
-
test("customer admin can manage role mappings
|
|
16
|
+
test("customer admin can manage role mappings and change app access", async ({
|
|
17
|
+
browser,
|
|
17
18
|
page,
|
|
18
19
|
}) => {
|
|
19
20
|
test.setTimeout(60_000);
|
|
@@ -46,6 +47,8 @@ test.describe("RBAC access", () => {
|
|
|
46
47
|
await expect(
|
|
47
48
|
page.getByRole("button", { name: "User assignments" }),
|
|
48
49
|
).toContainText("App Non User");
|
|
50
|
+
|
|
51
|
+
await expectAppAccess(browser, users.nonAppUser, true);
|
|
49
52
|
} finally {
|
|
50
53
|
if (shouldResetSeedData) {
|
|
51
54
|
await resetSeedData();
|
|
@@ -61,6 +64,8 @@ test.describe("RBAC access", () => {
|
|
|
61
64
|
})
|
|
62
65
|
.not.toContain("App Non User");
|
|
63
66
|
|
|
67
|
+
await expectAppAccess(browser, users.nonAppUser, false);
|
|
68
|
+
|
|
64
69
|
await page.goto("/");
|
|
65
70
|
await expect(page.getByRole("heading", { name: /Welcome to/ })).toHaveCount(
|
|
66
71
|
0,
|
|
@@ -135,6 +140,33 @@ async function expectNotFound(page: Page) {
|
|
|
135
140
|
).toBeVisible();
|
|
136
141
|
}
|
|
137
142
|
|
|
143
|
+
async function expectAppAccess(
|
|
144
|
+
browser: Browser,
|
|
145
|
+
email: string,
|
|
146
|
+
expectedAccess: boolean,
|
|
147
|
+
) {
|
|
148
|
+
const expectedHeadingCount = expectedAccess ? 1 : 0;
|
|
149
|
+
|
|
150
|
+
await expect
|
|
151
|
+
.poll(
|
|
152
|
+
async () => {
|
|
153
|
+
const context = await browser.newContext();
|
|
154
|
+
const page = await context.newPage();
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
await signIn(page, email, "/");
|
|
158
|
+
return await page
|
|
159
|
+
.getByRole("heading", { name: /Welcome to/ })
|
|
160
|
+
.count();
|
|
161
|
+
} finally {
|
|
162
|
+
await context.close();
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{ timeout: 15_000 },
|
|
166
|
+
)
|
|
167
|
+
.toBe(expectedHeadingCount);
|
|
168
|
+
}
|
|
169
|
+
|
|
138
170
|
async function resetSeedData() {
|
|
139
171
|
await execFileAsync("pnpm", ["db:seed"], { cwd: process.cwd() });
|
|
140
172
|
}
|