Separate guest and panel navigation and add account flyout
This commit is contained in:
1 parent
60b584b7c1
commit
5852bf1897
42 files changed
+1024
-55
No files matched your search
+62
-3
@@ -94,7 +94,7 @@ const consumer = await mkdtemp(path.resolve("test-results/consumer-"));
|
||||
await cp("dist/starter", consumer, { recursive: true });
|
||||
const original = JSON.parse(
|
||||
await readFile(path.join(consumer, "api/navigation.json"), "utf8"),
|
||||
);
|
||||
).panels.admin;
|
||||
let config = structuredClone(original),
|
||||
configDelay = 0,
|
||||
failMenu = false,
|
||||
@@ -397,7 +397,9 @@ try {
|
||||
.waitFor();
|
||||
await page.locator(".dock-brand").click();
|
||||
await page.locator(".dock-account").click();
|
||||
await page.locator('[data-account-page="account"]').click();
|
||||
await page
|
||||
.locator('.account-parent-link[data-account-page="account"]')
|
||||
.click();
|
||||
await page.keyboard.press("Escape");
|
||||
await page.locator("#page-title").filter({ hasText: "Аккаунт" }).waitFor();
|
||||
assert.equal(await page.locator("[data-nav-id]").count(), 0);
|
||||
@@ -490,11 +492,19 @@ try {
|
||||
await page.goto(origin + "/?page=overview");
|
||||
await page.locator("#page-title").filter({ hasText: "Обзор" }).waitFor();
|
||||
menuFailure = { status: 401, body: { error: { code: "UNAUTHENTICATED" } } };
|
||||
await page.locator("#refresh-navigation").click();
|
||||
await page.locator(".search-select-trigger").click();
|
||||
await page.evaluate(() =>
|
||||
document.querySelector("#refresh-navigation").click(),
|
||||
);
|
||||
await page.locator('[data-error-status="401"]').waitFor();
|
||||
assert.equal(await page.locator("[data-nav-id]").count(), 0);
|
||||
assert.equal(await page.locator(".resource-row").count(), 0);
|
||||
assert.equal(await page.locator(".navigation").isVisible(), false);
|
||||
assert.equal(await page.locator("[popover]:popover-open").count(), 0);
|
||||
passed++;
|
||||
menuFailure = null;
|
||||
await page.reload();
|
||||
await page.locator("#page-title").filter({ hasText: "Обзор" }).waitFor();
|
||||
menuFailure = {
|
||||
status: 403,
|
||||
body: { error: { code: "ACCOUNT_BANNED", reason: "Изменение доступа" } },
|
||||
@@ -506,6 +516,55 @@ try {
|
||||
passed++;
|
||||
menuFailure = null;
|
||||
// Core modules also work independently of the starter's host logic.
|
||||
const savedAccount = { ...account };
|
||||
account = { status: "guest" };
|
||||
config = structuredClone(original);
|
||||
const beforeMenuRequests = requests.filter((url) =>
|
||||
url.includes("/api/navigation.json"),
|
||||
).length;
|
||||
await page.goto(origin + "/");
|
||||
await page.locator('#session-screen [data-error-status="401"]').waitFor();
|
||||
assert.equal(await page.locator(".navigation").isVisible(), false);
|
||||
assert.equal(
|
||||
requests.filter((url) => url.includes("/api/navigation.json")).length,
|
||||
beforeMenuRequests,
|
||||
);
|
||||
assert.equal(await page.locator(".shell").evaluate((e) => e.inert), true);
|
||||
passed++;
|
||||
account = { ...savedAccount, panel: "user" };
|
||||
config = {
|
||||
panels: {
|
||||
user: { defaultPage: "overview", items: original.items.slice(0, 2) },
|
||||
admin: original,
|
||||
},
|
||||
};
|
||||
await page.goto(origin + "/?page=overview");
|
||||
await page.locator("#page-title").filter({ hasText: "Обзор" }).waitFor();
|
||||
assert.equal(await page.locator("body").getAttribute("data-panel"), "user");
|
||||
assert.equal(
|
||||
await page.locator('[data-nav-toggle="administration"]').count(),
|
||||
0,
|
||||
);
|
||||
await page.locator(".dock-account").click();
|
||||
await page.locator(".account-parent-link").focus();
|
||||
await page.keyboard.press("ArrowRight");
|
||||
await page
|
||||
.locator('.account-submenu [data-account-page="account-security"]')
|
||||
.click();
|
||||
await page
|
||||
.locator("#page-title")
|
||||
.filter({ hasText: "Безопасность" })
|
||||
.waitFor();
|
||||
await page.locator(".dock-account").click();
|
||||
await page.locator(".account-submenu-toggle").click();
|
||||
await page
|
||||
.locator('.account-submenu [data-account-page="account-sessions"]')
|
||||
.click();
|
||||
await page
|
||||
.locator("#page-title")
|
||||
.filter({ hasText: "Устройства и сеансы" })
|
||||
.waitFor();
|
||||
passed++;
|
||||
await page.goto(origin + "/?page=error-502");
|
||||
await page.locator('[data-error-status="502"]').waitFor();
|
||||
assert.equal(await page.locator(".error-page-code").innerText(), "502");
|
||||
|
||||
Reference in new issue
Block a user