워크스페이스(탭) 도입 — 로그인 후 기본 화면을 탭 작업공간으로.

- /workspace: 헤더+사이드바+탭바+iframe 패널. 메뉴 클릭=탭 열기,
  전환해도 폼·스크롤·조회결과 등 작업 상태 유지(세션 동안)
- 로그인 후 / = 워크스페이스(첫 탭=대시보드). iframe 내부는 임베드 렌더
- 임베드 레이아웃(bag/layout/embed): 헤더·사이드바 없이 본문만
- 임베드 판정: ?embed=1 또는 Sec-Fetch-Dest=iframe (iframe 내 링크·폼·
  리다이렉트까지 중첩 크롬 없이 처리)
- iframe 안 세션만료 시 상위 창을 로그인으로 전환(auth/_shell)
- 포털 헤더에 워크스페이스 진입 링크, E2E(workspace.spec) 추가

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
taekyoungc
2026-06-08 13:32:53 +09:00
parent 600a79788e
commit c15e01bfa7
10 changed files with 381 additions and 14 deletions

View File

@@ -8,14 +8,15 @@ const { login } = require('./helpers/auth');
* - 대메뉴 클릭 → 좌측 사이드바에 소메뉴 표시
*/
test.describe('gov-portal 전면 적용', () => {
test('메인(/)이 포털 대시보드로 렌더', async ({ page }) => {
test('메인(/)이 워크스페이스(탭) + 첫 탭 대시보드로 렌더', async ({ page }) => {
await login(page, 'user');
await page.goto('/');
await expect(page.locator('header.portal-header')).toBeVisible();
await expect(page.locator('.sidebar')).toBeVisible();
await expect(page.getByText('봉투 재고 총량')).toBeVisible();
await expect(page.getByText('승인 대기')).toBeVisible();
// 목업 흔적(가짜 공지/지도)이 없어야 함
await expect(page.locator('.ws-tabbar')).toBeVisible();
// 첫 탭(대시보드) iframe 안에 실데이터 KPI
await expect(page.frameLocator('.ws-frame.active').getByText('봉투 재고 총량')).toBeVisible({ timeout: 10000 });
// 목업 흔적 없음
await expect(page.getByText('서비스 데스크')).toHaveCount(0);
});

42
e2e/workspace.spec.js Normal file
View File

@@ -0,0 +1,42 @@
const { test, expect } = require('@playwright/test');
const { login } = require('./helpers/auth');
/**
* 워크스페이스(탭) — 메뉴를 탭(iframe)으로 열고 전환해도 작업 상태 유지
*/
test.describe('워크스페이스 탭', () => {
test('탭 열기·전환·상태 유지·닫기', async ({ page }) => {
await login(page, 'admin');
await page.goto('/admin/select-local-government');
await page.evaluate(() => {
const r = document.querySelector('input[name="lg_idx"][value="1"]');
if (r) { r.checked = true; r.form.submit(); }
});
await page.waitForTimeout(700);
await page.goto('/workspace');
await page.waitForTimeout(2500);
// 대시보드 탭이 자동으로 열림
await expect(page.locator('.ws-tab')).toHaveCount(1);
await expect(page.locator('.ws-frame.active')).toBeVisible();
// 대시보드 탭에 입력
await page.frameLocator('.ws-frame.active').locator('#mainMenuSearch').fill('WS_STATE', { timeout: 8000 });
// 사이드바 메뉴 클릭 → 새 탭
await page.locator('.sidebar .my-menu-list a').first().click();
await page.waitForTimeout(1500);
await expect(page.locator('.ws-tab')).toHaveCount(2);
// 첫 탭으로 복귀 → 입력값 유지 확인
await page.locator('.ws-tab').first().click();
await page.waitForTimeout(400);
await expect(page.frameLocator('.ws-frame.active').locator('#mainMenuSearch')).toHaveValue('WS_STATE');
// 탭 닫기
await page.locator('.ws-tab').nth(1).locator('.t-close').click();
await page.waitForTimeout(300);
await expect(page.locator('.ws-tab')).toHaveCount(1);
});
});