Исправить перекрытие навигации и обновить пакеты образов
This commit is contained in:
1 parent
f48754aaf5
commit
249b777bec
6 files changed
+172
-5
No files matched your search
@@ -244,7 +244,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p ../../.tmp
|
mkdir -p ../../.tmp
|
||||||
rm -f ../../.tmp/openapi-playwright.json ../../.tmp/openapi-ui-evidence.json
|
rm -f ../../.tmp/openapi-playwright.json ../../.tmp/openapi-ui-evidence.json
|
||||||
PLAYWRIGHT_JSON_OUTPUT=../../.tmp/openapi-playwright.json npx playwright test
|
PLAYWRIGHT_JSON_OUTPUT=../../.tmp/openapi-playwright.json npx playwright test --retries=0
|
||||||
|
|
||||||
- name: Collect sanitized OpenAPI UI evidence
|
- name: Collect sanitized OpenAPI UI evidence
|
||||||
working-directory: apps/ui
|
working-directory: apps/ui
|
||||||
|
|||||||
@@ -23,9 +23,10 @@ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certifi
|
|||||||
|
|
||||||
RUN sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.list.d/debian.sources \
|
RUN sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.list.d/debian.sources \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends --only-upgrade libpcre2-8-0 \
|
&& apt-get install -y --no-install-recommends --only-upgrade libpcre2-8-0 perl-base \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& dpkg --compare-versions "$(dpkg-query -W -f='${Version}' libpcre2-8-0)" ge '10.42-1+deb12u2' \
|
&& dpkg --compare-versions "$(dpkg-query -W -f='${Version}' libpcre2-8-0)" ge '10.42-1+deb12u2' \
|
||||||
|
&& dpkg --compare-versions "$(dpkg-query -W -f='${Version}' perl-base)" ge '5.36.0-7+deb12u4' \
|
||||||
&& echo "crank-security-refresh=${CRANK_SECURITY_REFRESH}"
|
&& echo "crank-security-refresh=${CRANK_SECURITY_REFRESH}"
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -61,9 +61,10 @@ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certifi
|
|||||||
|
|
||||||
RUN sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.list.d/debian.sources \
|
RUN sed -i 's|http://deb.debian.org|https://deb.debian.org|g' /etc/apt/sources.list.d/debian.sources \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends --only-upgrade libpcre2-8-0 \
|
&& apt-get install -y --no-install-recommends --only-upgrade libpcre2-8-0 perl-base \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& dpkg --compare-versions "$(dpkg-query -W -f='${Version}' libpcre2-8-0)" ge '10.42-1+deb12u2' \
|
&& dpkg --compare-versions "$(dpkg-query -W -f='${Version}' libpcre2-8-0)" ge '10.42-1+deb12u2' \
|
||||||
|
&& dpkg --compare-versions "$(dpkg-query -W -f='${Version}' perl-base)" ge '5.36.0-7+deb12u4' \
|
||||||
&& echo "crank-security-refresh=${CRANK_SECURITY_REFRESH}"
|
&& echo "crank-security-refresh=${CRANK_SECURITY_REFRESH}"
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
bottom: 76px;
|
bottom: 76px;
|
||||||
z-index: 790;
|
z-index: 790;
|
||||||
width: min(410px, calc(100vw - 28px));
|
width: min(410px, calc(100vw - 28px));
|
||||||
max-height: min(700px, calc(100vh - 104px));
|
max-height: min(700px, calc(100vh - 152px));
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
scroll-behavior: auto;
|
scroll-behavior: auto;
|
||||||
border: 1px solid var(--border-color, #30363d);
|
border: 1px solid var(--border-color, #30363d);
|
||||||
@@ -89,7 +89,7 @@ body.wizard-page .onboarding-trigger {
|
|||||||
|
|
||||||
body.wizard-page .onboarding-panel {
|
body.wizard-page .onboarding-panel {
|
||||||
bottom: calc(150px + env(safe-area-inset-bottom, 0px));
|
bottom: calc(150px + env(safe-area-inset-bottom, 0px));
|
||||||
max-height: min(700px, calc(100vh - 178px));
|
max-height: min(700px, calc(100vh - 226px));
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
|
|||||||
@@ -727,4 +727,14 @@
|
|||||||
window.addEventListener('storage', function(event) { if (event.key === 'crank_onboarding_signal') refresh(); });
|
window.addEventListener('storage', function(event) { if (event.key === 'crank_onboarding_signal') refresh(); });
|
||||||
document.addEventListener('visibilitychange', function() { if (!document.hidden) refresh(); });
|
document.addEventListener('visibilitychange', function() { if (!document.hidden) refresh(); });
|
||||||
document.addEventListener('keydown', function(event) { if (event.key === 'Escape' && state.open) setOpen(false); });
|
document.addEventListener('keydown', function(event) { if (event.key === 'Escape' && state.open) setOpen(false); });
|
||||||
|
// Shell menus own the pointer plane. Capture before their handlers stop
|
||||||
|
// propagation so the optional helper cannot cover an opened menu.
|
||||||
|
document.addEventListener('click', function(event) {
|
||||||
|
if (state.open && event.target instanceof Element
|
||||||
|
&& event.target.closest('.nav-avatar, .nav-hamburger')) {
|
||||||
|
// Keep keyboard focus on the shell control that the user just activated.
|
||||||
|
lastFocused = null;
|
||||||
|
setOpen(false);
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
}());
|
}());
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
const { test, expect } = require('@playwright/test');
|
||||||
|
const { getCurrentWorkspace, login } = require('./helpers');
|
||||||
|
|
||||||
|
function onboardingSnapshot(workspaceId) {
|
||||||
|
return {
|
||||||
|
schema_version: 1,
|
||||||
|
workspace_id: workspaceId,
|
||||||
|
revision: 1,
|
||||||
|
status: 'in_progress',
|
||||||
|
dismissed: false,
|
||||||
|
eligible_since: '2026-08-23T08:00:00Z',
|
||||||
|
started_at: '2026-08-23T08:01:00Z',
|
||||||
|
completed_at: null,
|
||||||
|
steps: [
|
||||||
|
{ kind: 'operation', status: 'complete', action: 'open_operation' },
|
||||||
|
{ kind: 'test', status: 'complete', action: 'open_operation' },
|
||||||
|
{ kind: 'publish', status: 'complete', action: 'open_operation' },
|
||||||
|
{ kind: 'agent', status: 'current', action: 'create_agent' },
|
||||||
|
{ kind: 'key', status: 'pending', action: 'create_key' },
|
||||||
|
{ kind: 'connection', status: 'pending', action: 'show_connection' },
|
||||||
|
{ kind: 'first_call', status: 'pending', action: 'open_logs' },
|
||||||
|
],
|
||||||
|
operation: { id: 'op_shell_layout', published_version: 1, last_test: null },
|
||||||
|
agent: null,
|
||||||
|
key: null,
|
||||||
|
connection: { status: 'pending', reason_code: 'key_required' },
|
||||||
|
first_call: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function rectsIntersect(a, b) {
|
||||||
|
return a.x < b.x + b.width
|
||||||
|
&& a.x + a.width > b.x
|
||||||
|
&& a.y < b.y + b.height
|
||||||
|
&& a.y + a.height > b.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openShellLayoutCase(page, path) {
|
||||||
|
await login(page);
|
||||||
|
const workspace = await getCurrentWorkspace(page);
|
||||||
|
|
||||||
|
await page.route(/\/api\/admin\/workspaces\/[^/]+\/onboarding(?:\/events)?(?:\?.*)?$/, async (route) => {
|
||||||
|
await route.fulfill({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'application/json',
|
||||||
|
body: JSON.stringify(onboardingSnapshot(workspace.id)),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(path);
|
||||||
|
|
||||||
|
// Open the full server-derived Getting Started panel explicitly. The panel is
|
||||||
|
// auto-opened for a fresh workspace, but the trigger is used when a previous
|
||||||
|
// navigation already persisted the "opened" UI preference.
|
||||||
|
const trigger = page.getByTestId('onboarding-trigger');
|
||||||
|
const checklist = page.getByTestId('onboarding-checklist');
|
||||||
|
if (!await checklist.isVisible()) await trigger.click();
|
||||||
|
await expect(checklist).toBeVisible();
|
||||||
|
await expect(checklist.locator('ol > li')).toHaveCount(7);
|
||||||
|
|
||||||
|
const avatar = page.getByTestId('shell-avatar');
|
||||||
|
await expect(avatar).toBeVisible();
|
||||||
|
|
||||||
|
const navbar = page.locator('.navbar');
|
||||||
|
const navbarBox = await navbar.boundingBox();
|
||||||
|
const avatarBox = await avatar.boundingBox();
|
||||||
|
const panelBox = await checklist.boundingBox();
|
||||||
|
|
||||||
|
// Real hit-testing at the avatar centre: whatever would receive the pointer
|
||||||
|
// event must be the avatar itself, not the onboarding panel or its head.
|
||||||
|
// Playwright's click actionability uses exactly this condition, so this is
|
||||||
|
// the deterministic equivalent of the CI830 shell-avatar.click interception.
|
||||||
|
const avatarCentre = {
|
||||||
|
x: avatarBox.x + avatarBox.width / 2,
|
||||||
|
y: avatarBox.y + avatarBox.height / 2,
|
||||||
|
};
|
||||||
|
const hit = await page.evaluate((centre) => {
|
||||||
|
const element = document.elementFromPoint(centre.x, centre.y);
|
||||||
|
if (!element) return null;
|
||||||
|
const owner = element.closest('[data-testid="shell-avatar"]');
|
||||||
|
return {
|
||||||
|
isAvatar: Boolean(owner),
|
||||||
|
tag: element.tagName,
|
||||||
|
className: String(element.className || ''),
|
||||||
|
testId: element.getAttribute('data-testid'),
|
||||||
|
};
|
||||||
|
}, avatarCentre);
|
||||||
|
|
||||||
|
console.log('shell-layout geometry', JSON.stringify({
|
||||||
|
path,
|
||||||
|
viewport: page.viewportSize(),
|
||||||
|
navbar: navbarBox,
|
||||||
|
avatar: avatarBox,
|
||||||
|
avatarCentre,
|
||||||
|
panel: panelBox,
|
||||||
|
hit,
|
||||||
|
}));
|
||||||
|
|
||||||
|
expect(hit, `no element at avatar centre ${JSON.stringify(avatarCentre)}`).not.toBeNull();
|
||||||
|
expect(
|
||||||
|
hit.isAvatar,
|
||||||
|
`avatar centre ${JSON.stringify(avatarCentre)} is covered by ${JSON.stringify(hit)}`,
|
||||||
|
).toBe(true);
|
||||||
|
|
||||||
|
// The sticky header owns the top of the viewport; an optional helper panel
|
||||||
|
// must never overlap it.
|
||||||
|
expect(
|
||||||
|
rectsIntersect(panelBox, navbarBox),
|
||||||
|
`onboarding panel ${JSON.stringify(panelBox)} overlaps header ${JSON.stringify(navbarBox)}`,
|
||||||
|
).toBe(false);
|
||||||
|
|
||||||
|
// A single real (non-forced) click on the avatar must open the shell user menu.
|
||||||
|
await avatar.click();
|
||||||
|
await expect(page.getByTestId('shell-user-name').first()).toBeVisible();
|
||||||
|
const settings = page.locator('.user-dropdown-item').first();
|
||||||
|
await expect.poll(() => settings.evaluate((element) => {
|
||||||
|
const box = element.getBoundingClientRect();
|
||||||
|
const hit = document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2);
|
||||||
|
return element === hit || element.contains(hit);
|
||||||
|
})).toBe(true);
|
||||||
|
await settings.click();
|
||||||
|
await expect(page).toHaveURL(/\/settings(?:#profile)?$/);
|
||||||
|
|
||||||
|
if (page.viewportSize().width <= 640) {
|
||||||
|
await page.goto(path);
|
||||||
|
if (!await checklist.isVisible()) await trigger.click();
|
||||||
|
await expect(checklist).toBeVisible();
|
||||||
|
await expect(checklist.locator('ol > li')).toHaveCount(7);
|
||||||
|
const hamburger = page.locator('.nav-hamburger');
|
||||||
|
await hamburger.focus();
|
||||||
|
await hamburger.press('Enter');
|
||||||
|
await expect(hamburger).toBeFocused();
|
||||||
|
const mobileNavigation = page.locator('.mobile-nav');
|
||||||
|
await expect(mobileNavigation).toBeVisible();
|
||||||
|
await mobileNavigation.locator('a[href="/agents"]').click();
|
||||||
|
await expect(page).toHaveURL(/\/agents\/?$/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const CASES = [
|
||||||
|
{ path: '/', viewport: { width: 1280, height: 720 } },
|
||||||
|
{ path: '/', viewport: { width: 390, height: 720 } },
|
||||||
|
{ path: '/wizard/', viewport: { width: 1280, height: 720 } },
|
||||||
|
{ path: '/wizard/', viewport: { width: 390, height: 720 } },
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const testCase of CASES) {
|
||||||
|
test.describe(`${testCase.path} at ${testCase.viewport.width}x${testCase.viewport.height}`, () => {
|
||||||
|
test.use({ viewport: testCase.viewport });
|
||||||
|
|
||||||
|
test('an open Getting Started panel never covers the shell avatar in the header', async ({ page }) => {
|
||||||
|
await openShellLayoutCase(page, testCase.path);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in new issue
Block a user