feat(board,ecommerce,template): 관리자↔유저 크로스 이동 링크 + 상품코드·게시판 슬러그 라우팅 전환
관리자·유저 화면 왕복 이동 수단을 추가하고, 상품/게시판 URL 식별자를 사람이 읽을 수 있는 값(상품코드/슬러그)으로 전환한다. 크로스 이동 링크 (전부 새 탭): - 관리자 사이드바 "사이트 보기" + 모바일 드로어 상단 잘림 수정 - 관리자 게시물 조회 ↔ 유저 게시판, 유저 상품 상세 ↔ 관리자 상품 수정 - 유저 화면의 관리자 진입은 is_admin 이 아니라 세부 권한 플래그로 게이트 (게시판 can_access_admin, 상품 can_update) 상품 라우팅 id → product_code: - Product::resolveRouteBinding(code/id) + 공개 라우트 정규식 확장 - 모든 상품 링크(목록·최근본·검색·장바구니·주문내역·문의내역·관리자) 전환 - 상품 검색을 상품코드·번호 양쪽 조회 가능하게 확장(관리자+통합검색) 게시판 라우팅 board id → slug: - Board::resolveRouteBinding(slug/id) + 관리자 라우트 slug 전환 - 생성 후 리다이렉트·토글·삭제·수정·add-to-menu·편집기 스코프 전수 정정 - BoardController::addToAdminMenu 를 Board 바인딩으로 정합 검증: 프론트 레이아웃 Vitest 36건 green, 백엔드 회귀 테스트 추가, g7.dev 라이브 실측(생성/삭제/메뉴추가 slug, 문의내역·검색 상품코드 URL).
This commit is contained in:
1 parent
32b1b11930
commit
6505d85959
78 files changed
+1670
-146
No files matched your search
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* E2E: 관리자 ↔ 유저 화면 상호 이동 링크 + 모바일 사이드바 드로어 상단 잘림 수정 (#450)
|
||||
*
|
||||
* @scenario admin_sidebar_view_site, admin_board_view_user_page, mobile_drawer_not_clipped
|
||||
* @effects new_tab_navigation, drawer_starts_below_header
|
||||
*
|
||||
* 검증:
|
||||
* 1. 관리자 사이드바 하단 "사이트 보기" 링크가 A[href="/"][target="_blank"] 로 마운트
|
||||
* 2. 관리자 게시물 조회 화면에 "유저 화면 보기" 링크가 새 탭으로 마운트
|
||||
* 3. 모바일 뷰포트에서 드로어를 열면 드로어 상단이 헤더(약 64px) 아래에서 시작 —
|
||||
* 첫 메뉴 항목이 헤더에 가려 잘리지 않는다 (버그 회귀 가드)
|
||||
*/
|
||||
import { test, expect, issueToken, authenticatePage } from '../../fixtures/auth';
|
||||
|
||||
/** admin 진입 공통 대기 */
|
||||
async function gotoAdmin(page: import('@playwright/test').Page, path: string): Promise<void> {
|
||||
await page.goto(path);
|
||||
await page.waitForLoadState('domcontentloaded', { timeout: 30_000 });
|
||||
await page.waitForFunction(
|
||||
() => !window.location.pathname.includes('/admin/login') || document.readyState === 'complete',
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
}
|
||||
|
||||
// @scenario link=admin_sidebar_to_user_site, permitted=na
|
||||
// @effects new_tab_navigation
|
||||
test('@smoke #450 - 관리자 사이드바 "사이트 보기" 링크가 새 탭 A 로 마운트된다', async ({ page }) => {
|
||||
const token = issueToken('core.templates.layouts.edit');
|
||||
await authenticatePage(page, token);
|
||||
|
||||
await gotoAdmin(page, '/admin/dashboard');
|
||||
expect(page.url()).not.toMatch(/\/admin\/login/);
|
||||
|
||||
const link = page.locator('#sidebar_view_site_link');
|
||||
await expect(link).toBeAttached({ timeout: 10_000 });
|
||||
await expect(link).toHaveAttribute('href', '/');
|
||||
await expect(link).toHaveAttribute('target', '_blank');
|
||||
await expect(link).toHaveAttribute('rel', 'noopener noreferrer');
|
||||
|
||||
// 사이드바 footer 는 스크롤 메뉴 밖의 형제이므로, 메뉴 영역과 별도로 마운트된다.
|
||||
await expect(page.locator('#sidebar_footer')).toBeAttached();
|
||||
});
|
||||
|
||||
// @scenario link=admin_board_to_user_board, permitted=na
|
||||
// @effects new_tab_navigation, board_admin_routes_by_slug
|
||||
test('@smoke #450 - 관리자 게시물 조회 화면에 "유저 화면 보기" 새 탭 링크가 마운트된다', async ({ page }) => {
|
||||
// 게시판 관리 권한으로 관리자 게시물 목록 진입
|
||||
const token = issueToken('sirsoft-board.notice.admin.posts.read', 'sirsoft-board.notice.admin.manage');
|
||||
await authenticatePage(page, token);
|
||||
|
||||
await gotoAdmin(page, '/admin/board/notice');
|
||||
expect(page.url()).not.toMatch(/\/admin\/login/);
|
||||
|
||||
const link = page.locator('#view_user_page_link').first();
|
||||
// 게시판이 없거나 접근 불가 환경에서는 스킵 (권한/데이터 의존)
|
||||
if ((await link.count()) === 0) {
|
||||
test.skip(true, '게시판(notice) 미존재 또는 접근 불가 — 데이터 의존 스킵');
|
||||
}
|
||||
await expect(link).toHaveAttribute('target', '_blank');
|
||||
await expect(link).toHaveAttribute('href', /\/board\/notice/);
|
||||
});
|
||||
|
||||
// @scenario link=admin_product_to_user_detail, permitted=na
|
||||
// @effects new_tab_navigation, product_detail_routes_by_code
|
||||
test('@smoke #450 - 관리자 상품 수정 화면에 "유저 화면 보기" 새 탭 링크가 마운트된다', async ({ page }) => {
|
||||
const token = issueToken('sirsoft-ecommerce.product.read', 'sirsoft-ecommerce.product.update');
|
||||
await authenticatePage(page, token);
|
||||
|
||||
// 임의 상품 편집 경로 진입 (상품 미존재 시 링크 미노출 → 데이터 의존 스킵)
|
||||
await gotoAdmin(page, '/admin/ecommerce/products/1/edit');
|
||||
expect(page.url()).not.toMatch(/\/admin\/login/);
|
||||
|
||||
const link = page.locator('#view_user_page_link').first();
|
||||
if ((await link.count()) === 0) {
|
||||
test.skip(true, '상품(id=1) 미존재 또는 접근 불가 — 데이터 의존 스킵');
|
||||
}
|
||||
await expect(link).toHaveAttribute('target', '_blank');
|
||||
await expect(link).toHaveAttribute('href', /\/products\/1$/);
|
||||
});
|
||||
|
||||
// @scenario link=admin_sidebar_to_user_site, permitted=na
|
||||
// @effects drawer_starts_below_header
|
||||
test('@smoke #450 - 모바일 드로어가 헤더 아래에서 시작해 첫 메뉴가 잘리지 않는다', async ({ page }) => {
|
||||
const token = issueToken('core.templates.layouts.edit');
|
||||
await authenticatePage(page, token);
|
||||
|
||||
// 모바일 뷰포트 (portable breakpoint 진입)
|
||||
await page.setViewportSize({ width: 390, height: 780 });
|
||||
await gotoAdmin(page, '/admin/dashboard');
|
||||
expect(page.url()).not.toMatch(/\/admin\/login/);
|
||||
|
||||
// 햄버거로 드로어 열기 (모바일 헤더의 토글). 토글 id 는 menu_toggle_btn 계열.
|
||||
const toggle = page.locator('#menu_toggle_btn, [data-testid="menu_toggle_btn"], .menu_toggle_btn').first();
|
||||
if ((await toggle.count()) > 0) {
|
||||
await toggle.click();
|
||||
}
|
||||
|
||||
const drawer = page.locator('#left_sidebar_area');
|
||||
await expect(drawer).toBeAttached({ timeout: 10_000 });
|
||||
|
||||
// 드로어의 상단 y 좌표가 헤더 높이(약 64px = h-16) 이상이어야 한다.
|
||||
// inset-y-0(top:0) 회귀 시 이 값이 0 이 되어 첫 메뉴가 헤더에 가려진다.
|
||||
const box = await drawer.boundingBox();
|
||||
if (box) {
|
||||
expect(box.y, '드로어가 top:0 으로 헤더를 덮음 (#450 회귀)').toBeGreaterThanOrEqual(48);
|
||||
}
|
||||
|
||||
// 첫 메뉴 항목의 top 이 헤더 하단(약 56~64px)보다 아래에 있어야 한다.
|
||||
const firstItem = page.locator('#admin_sidebar_menu .admin-sidebar-item').first();
|
||||
if ((await firstItem.count()) > 0) {
|
||||
const itemBox = await firstItem.boundingBox();
|
||||
if (itemBox) {
|
||||
expect(itemBox.y, '첫 메뉴 항목이 헤더에 가려 잘림 (#450 회귀)').toBeGreaterThanOrEqual(48);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
feature: admin_user_cross_navigation
|
||||
description: >
|
||||
관리자 ↔ 유저 화면 상호 이동 링크 (#450). 관리자 사이드바 "사이트 보기",
|
||||
관리자 게시물 조회 ↔ 유저 게시판, 유저 게시판 → 관리자(게시물 조회+게시판 관리),
|
||||
유저 상품 상세 ↔ 관리자 상품 수정. 유저측 관리자 진입 링크는 세부 권한 플래그로 게이트.
|
||||
모바일 사이드바 드로어 상단 잘림 수정 포함.
|
||||
|
||||
test_files:
|
||||
- modules/_bundled/sirsoft-board/tests/Feature/PostResourcePermissionTest.php
|
||||
- modules/_bundled/sirsoft-ecommerce/tests/Feature/Http/Controllers/Public/PublicProductControllerTest.php
|
||||
- tests/Playwright/specs/admin/cross-navigation-and-mobile-drawer.spec.ts
|
||||
|
||||
# 입력 axis
|
||||
# link : 크로스링크 종류 (출발→도착 surface)
|
||||
# permitted: 유저측 관리자 진입 권한 보유 여부 (관리자측/항상노출 링크는 n/a 로 컷)
|
||||
axes:
|
||||
link: [admin_sidebar_to_user_site, admin_board_to_user_board, user_board_to_admin, user_product_to_admin_edit, admin_product_to_user_detail]
|
||||
permitted: [true, false, na]
|
||||
|
||||
# 의미 없는 조합 컷:
|
||||
# - 항상 노출(게이트 없음) 링크는 permitted 축이 무의미 → na 만 유지, true/false 컷
|
||||
# - 게이트 있는 유저측 링크는 na 컷 (true/false 만)
|
||||
exclusions:
|
||||
- { link: admin_sidebar_to_user_site, permitted: true, reason: "관리자 전용 화면, 게이트 없음" }
|
||||
- { link: admin_sidebar_to_user_site, permitted: false, reason: "관리자 전용 화면, 게이트 없음" }
|
||||
- { link: admin_board_to_user_board, permitted: true, reason: "관리자 화면, 항상 노출" }
|
||||
- { link: admin_board_to_user_board, permitted: false, reason: "관리자 화면, 항상 노출" }
|
||||
- { link: admin_product_to_user_detail, permitted: true, reason: "관리자 화면, 편집모드 노출(권한 무관)" }
|
||||
- { link: admin_product_to_user_detail, permitted: false, reason: "관리자 화면, 편집모드 노출(권한 무관)" }
|
||||
- { link: user_board_to_admin, permitted: na, reason: "게이트 있음 — true/false 만 유효" }
|
||||
- { link: user_product_to_admin_edit, permitted: na, reason: "게이트 있음 — true/false 만 유효" }
|
||||
|
||||
# 후속 효과 체인 — 각 링크가 실제로 수행/노출하는 결과
|
||||
effects:
|
||||
- new_tab_navigation
|
||||
- board_admin_gate_true_shows_link
|
||||
- board_admin_gate_false_hides_link
|
||||
- product_edit_gate_true_shows_link
|
||||
- product_edit_gate_false_hides_link
|
||||
- drawer_starts_below_header
|
||||
# 라우팅 식별자 전환 (#450): 상품=product_code, 게시판=slug
|
||||
- product_detail_routes_by_code
|
||||
- board_admin_routes_by_slug
|
||||
|
||||
# 보조 흐름
|
||||
sub_flows:
|
||||
- id: mobile_drawer
|
||||
effects: [drawer_starts_below_header]
|
||||
Reference in new issue
Block a user