공개 (@Tuwasduliebst 제보) 대응. - ckeditor5: 미참조 이미지 정리 엔진 신설 — 참조 판정(hash + 파일명 2토큰, filter_reference_sources 훅으로 확장 콘텐츠 등록) + 정리 커맨드(기본 꺼짐 옵트인, 3중 게이트) + 업로드 관리 화면(권한 분리·참조 배지·개별/선택 삭제) + 기설치본 설정 백필 upgrade step - board: 임시 첨부 GC(상시) + 소프트삭제 첨부 영구 정리(옵트인) + 설정 UI, 저장 payload 누락(F4)·빈 temp 디렉토리 잔존(F5) 수정 - ecommerce: 임시 상품 이미지 GC + 카테고리 삭제 시 이미지 파일 미삭제(S4) 수정 - page: 임시 첨부 GC - 코어: 고아 첨부 정리 커맨드(옵트인, site_logo 보호) + 사이트 로고 교체 시 구 로고 재편입 차단(S6) + DB 백업 미구현 501 정직화(B3) + 플러그인 관리자 메뉴 설치·업데이트 자동 동기화(F1·F7) - 동반: 플러그인 설정 검증 오류 필드명 라벨화(F3), Toggle 노드 type 정정 수평 전개(marketing 1.0.2 bump·gdpr·ecommerce), ja 언어팩 4종, API 문서, hooks.md, 시나리오 매니페스트 8종, Playwright E2E 4종
91 lines
3.9 KiB
TypeScript
91 lines
3.9 KiB
TypeScript
/**
|
|
* CKEditor5 플러그인 Playwright E2E 설정.
|
|
*
|
|
* 코어 `playwright.config.ts` 와 동일한 base URL 해석 우선순위를 따른다 — 플러그인도 활성 호스트가
|
|
* 가변(개발자/CI/운영 환경별로 다른 도메인)이므로 하드코딩 회피.
|
|
*
|
|
* Base URL 해석:
|
|
* 1. PLAYWRIGHT_BASE_URL 환경변수 (CI/명시적 오버라이드)
|
|
* 2. .env (코어 루트) 의 APP_URL — 단 localhost 류는 fallback 부적합
|
|
* 3. 그 외 — 명시 에러
|
|
*
|
|
* 실행 예시:
|
|
* PowerShell — $env:PLAYWRIGHT_BASE_URL='https://g7.dev'; npm run test:e2e
|
|
* Bash — PLAYWRIGHT_BASE_URL=https://g7.dev npm run test:e2e
|
|
*
|
|
* 플러그인은 코어 fixture 의 `issueToken` / `authenticatePage` 헬퍼를 재사용 — 권한 식별자는
|
|
* `sirsoft-ckeditor5.*` 등 임의 string.
|
|
*/
|
|
import { defineConfig, devices } from '@playwright/test';
|
|
import { readFileSync, existsSync } from 'node:fs';
|
|
import { dirname, resolve } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
// ESM 환경(package.json "type": "module")에서는 __dirname 이 정의되지 않으므로
|
|
// import.meta.url 로 재구성한다.
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
|
/**
|
|
* 코어 루트 (artisan / .env / Playwright 산출물의 기준 경로).
|
|
*
|
|
* 확장 config 는 확장 디렉토리에서 실행되지만, 산출물을 그 안에 쓰면 Windows 에서
|
|
* `plugin:update` 의 디렉토리 이동이 열린 핸들에 걸려 실패한다.
|
|
* 산출물은 코어 루트 아래로 모아 update 경로와 분리한다 (.gitignore 가 이미 덮는 위치).
|
|
*/
|
|
const CORE_ROOT = process.env.G7_ROOT || resolve(__dirname, '../../../../../');
|
|
|
|
/** 확장별 산출물 격리 — 확장끼리 리포트를 덮어쓰지 않도록 slug 로 네임스페이스. */
|
|
const ARTIFACT_SLUG = 'plugins/sirsoft-ckeditor5';
|
|
|
|
function readEnvFile(filePath: string, key: string): string | null {
|
|
if (!existsSync(filePath)) return null;
|
|
const content = readFileSync(filePath, { encoding: 'utf-8' });
|
|
const pattern = new RegExp(`^${key}=(.*)$`, 'm');
|
|
const match = content.match(pattern);
|
|
if (!match) return null;
|
|
let value = match[1].trim();
|
|
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
value = value.slice(1, -1);
|
|
}
|
|
return value || null;
|
|
}
|
|
|
|
function resolveBaseUrl(): string {
|
|
if (process.env.PLAYWRIGHT_BASE_URL) {
|
|
return process.env.PLAYWRIGHT_BASE_URL;
|
|
}
|
|
const appUrl = readEnvFile(resolve(CORE_ROOT, '.env'), 'APP_URL');
|
|
if (appUrl && !/^https?:\/\/localhost(:\d+)?\/?$/i.test(appUrl)) {
|
|
return appUrl;
|
|
}
|
|
throw new Error(
|
|
'CKEditor5 플러그인 E2E base URL 미설정. PLAYWRIGHT_BASE_URL 환경변수를 지정하거나 코어 .env 의 APP_URL 을 활성 호스트로 설정하세요.'
|
|
);
|
|
}
|
|
|
|
export default defineConfig({
|
|
testDir: './specs',
|
|
outputDir: resolve(CORE_ROOT, 'test-results', ARTIFACT_SLUG),
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: [
|
|
['html', { outputFolder: resolve(CORE_ROOT, 'playwright-report', ARTIFACT_SLUG), open: 'never' }],
|
|
['list'],
|
|
],
|
|
use: {
|
|
baseURL: resolveBaseUrl(),
|
|
// spec 이 한국어 화면 문구를 단언하므로 로케일을 고정한다.
|
|
// 로케일 우선순위는 localStorage g7_locale → 서버 응답값 → 'ko' 이고, 서버값은 미인증
|
|
// 요청에서 Accept-Language 로 결정된다(SetLocale 미들웨어). Playwright 의 locale 옵션이
|
|
// 그 헤더를 만들므로, 지정하지 않으면 첫 페이지 로드가 en-US 로 나가 화면이 영어로 렌더되고
|
|
// 엔진이 그 값을 localStorage 에 저장해 이후 인증해도 세션 전체가 영어로 고정된다.
|
|
locale: 'ko-KR',
|
|
trace: 'retain-on-failure',
|
|
screenshot: 'only-on-failure',
|
|
ignoreHTTPSErrors: true,
|
|
},
|
|
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
|
|
});
|