테스트.
DXPR Builder에는 네 가지 자동 검사가 있습니다. 편집기의 Puppeteer 테스트,
Drush 명령용 Bash 종단 간 테스트, 별도 dxpr_maven 저장소의 Selenium
시각 회귀 스위트, 린터. 이 페이지에서는 각각의 내용, 로컬 실행법, CI
실행법을 나열합니다.
검사 목록
| 검사 | 위치 | 실행 조건 |
|---|---|---|
| 편집기 콘솔 및 레이아웃 테스트 | test/test-editor.js |
JavaScript, HTML, test/를 건드리는 풀 리퀘스트(.github/workflows/fe-test.yaml) |
| Drush 종단 간 테스트 | scripts/drush-e2e/ |
PHP, YAML, Markdown을 건드리는 풀 리퀘스트(.github/workflows/review.yaml) |
| Selenium 시각 회귀 스위트 | dxpr_maven 저장소 |
PR 댓글 명령(.github/workflows/e2e-command.yaml, e2e-bs3-command.yml, e2eV2-command.yaml) |
| PHP 코딩 표준(phpcs) | scripts/linters/run-drupal-lint.sh, phpcs.xml.dist |
PHP, YAML, Markdown을 건드리는 풀 리퀘스트. 푸시 대상: 3.x |
| PHPStan | scripts/linters/run-drupal-check.sh |
PHP, YAML, Markdown을 건드리는 풀 리퀘스트. 푸시 대상: 3.x |
| ESLint, Stylelint, Rust Clippy | scripts/linters/ |
풀 리퀘스트. 바뀐 경로로 필터링. |
| 지원 중단 감지기 | .github/workflows/deprecations.yml |
다음을 건드리는 풀 리퀘스트: js/나 dxpr_builder/build/ |
문서 검사(markdownlint, check_docs.py, Vale) |
.markdownlint-cli2.yaml, docs/lint/, .vale.ini |
다음을 건드리는 풀 리퀘스트: docs/(review.yaml) |
저장소의 유일한 PHPUnit 테스트는
기존 미디어 하위 모듈용 modules/dxpr_builder_media/tests/src/FunctionalJavascript/MediaEntityBrowserTest.php
입니다. GitHub 워크플로는 실행하지 않습니다. drupal.org GitLab 파이프라인(.gitlab-ci.yml)은 표준
DrupalCI 템플릿을 쓰며, 그곳의 PHPUnit 작업은 꺼져 있지 않습니다.
편집기 콘솔 테스트
test/test-editor.js(은)는 포트 3000에 정적 서버를 시작하고
(test/start-standalone-server.js) 헤드리스 Chrome에서
test/standalone-editor/의 독립 페이지 네 개를 엽니다.
test-bs5-anon.html, test-bs5-cms-block.html,
test-bs5-editor.html, test-bs5-clean-html.html. 다음 경우 실패합니다.
- 페이지에서 JavaScript 오류 발생.
- 전체 편집기가 2000ms 안에 준비되지 않거나 로드 후 지연된 화면 밖 제어 장치가 없을 때(성능 게이트).
- 파워 사용자 모드에서 요소 제어 장치가 겹칠 때(기준선은 겹치는 쌍 0개).
- 전체 편집기 페이지의 저장된 HTML이 기준인 32,094자보다 클 때.
- 페이지별 검사가 실패할 때. 예: 깨끗한 Bootstrap HTML 파싱, 브레드크럼, Panel 유형, 로컬 비디오의 Muted 설정, CMS 블록 미리 보기.
페이지는 dxpr_builder/의 빌드된 파일을 불러오므로 먼저 빌드하세요.
-
의존성을 설치하세요:
npm install -
편집기 번들을 빌드하세요. CI 스크립트는 다음 순서로 작업을 실행합니다(
test/scripts/run-fe-tests.sh).npx grunt concat npx grunt exec:gen npx grunt babel npx grunt terser npx grunt sass npx grunt postcss -
테스트를 실행하세요:
npm run fe-test브라우저를 보려면
npm run fe-test:headed(을)를, 어서션 없이 독립 페이지를 서빙하려면npm run fe-test:dev(을)를 쓰세요.
CI에서는 .github/workflows/fe-test.yaml(이)가 같은 테스트를 Docker로
실행합니다:
docker compose --profile fe-test run --rm fe-test
Drush 종단 간 테스트
scripts/drush-e2e/run-e2e-tests.sh(은)는 Composer 컨테이너 안에 SQLite로 새 Drupal 11 사이트를
설치하고, 모듈을 심볼릭 링크로 넣고, 활성화하고, dxpr_builder_text
포매터의 Basic page 콘텐츠 유형, 페이지 템플릿, 사용자 템플릿을 만든 뒤
모든 scripts/drush-e2e/test-*.sh 파일을 실행합니다:
| 파일 | 테스트 대상 명령 |
|---|---|
test-cleartext-key-update.sh |
업데이트 9026은 Key 모듈 저장소에 남은 평문 제품 키를 지우고, 고른 Key가 사라지면 유지합니다(cleartext-key-update.php). |
test-cms-cache-tags.sh |
블록 및 뷰 목록의 캐시 무효화(cms-cache-tags.php). |
test-elements.sh |
drush dxb:element:list |
test-migration-summary.sh |
마이그레이션 열 요약의 단복수 표현(migration-summary.php). |
test-migrations.sh |
drush dxb:migrate와 콘텐츠 마이그레이션 회귀(migration-regressions.php). |
test-page-controller.sh |
경로용 페이지 컨트롤러 빌드(page-controller.php). |
test-page-create.sh |
drush dxb:page:create |
test-page-get-update.sh |
drush dxb:page:get, drush dxb:page:update |
test-page-module.sh |
Drag and Drop Page 모듈은 나열한 모든 구성을 포함(page-module.php). |
test-profile-buttons.sh |
빌더 프로필의 텍스트 편집기 버튼(profile-buttons.php). |
test-profile-order.sh |
가중치로 적용되는 프로필과 프로필 목록 순서(profile-order.php). |
test-settings-form.sh |
다음 작업과 그에 따른 라이선스 동기화: General Settings에서의 제품 키 저장 및 검증(settings-form.php). |
test-setup-ai.sh |
drush dxb:setup-ai |
test-templates.sh |
drush dxb:template:list |
test-user-licenses-page.sh |
라이선스 카드가 User Licenses에 한 번 표시되고 People에도 계속 표시됨(user-licenses-page.php). |
test-user-settings.sh |
각 편집자의 편집기 설정(user-settings.php). |
test-user-templates.sh |
drush dxb:user-template:list, drush dxb:user-template:create |
전부 실행:
docker compose --profile drush-e2e run --rm e2e-test
이름 일부를 전달해 하나의 파일을 실행하세요. 스크립트는 다음에 대조합니다:
scripts/drush-e2e/test-*<filter>*.sh.
docker compose --profile drush-e2e run --rm e2e-test page-create
테스트를 추가하려면 다음을 만들고: scripts/drush-e2e/test-<name>.sh.
다음을 호출하고: section "<Title>". 다음의 도우미를 쓰세요:
scripts/drush-e2e/_helpers.sh. assert_success, assert_fail,
assert_eq, assert_has, assert_not_empty, assert_runs,
assert_dry_run. 각 도우미는 설명과 명령
문자열을 받습니다.
CI에서 이 스위트는 다음의 "Run Drush E2E tests" 작업입니다:
.github/workflows/review.yaml. 풀 리퀘스트가 다음을 바꿀 때 실행됩니다:
.php, .module, .inc, .install, .yml, .md, composer.json,
composer.lock 파일.
Selenium 시각 회귀 스위트
브라우저 테스트는 dxpr_maven
저장소의 Java TestNG 스위트입니다. 이 저장소에서 설치한 사이트의 다음 Docker 스택에 대해
실행됩니다: docker-compose.test.yml(Selenium 허브, Chrome 노드, Maven
컨테이너). 로컬 체크아웃에서 실행하지 않습니다. 풀 리퀘스트
댓글에서 실행합니다. .github/workflows/command-dispatcher.yml(이)가 댓글을
워크플로 실행으로 바꿉니다.
| 명령 | 스위트 | 워크플로 |
|---|---|---|
/e2e |
chrome.editor.bs5.parallel.xml과 익명 BS5 스위트. |
e2e-command.yaml |
/e2e-bs3 |
chrome.editor.bs3.parallel.xml |
e2e-bs3-command.yml |
/e2eV2 |
DXPR CMS 스택의 BS5 편집기 및 익명 스위트. | e2eV2-command.yaml |
/qa-demo-2x-dxpr_theme6x-tests |
DXPR Theme 6.x QA 데모. | qa-demo-2x-dxpr_theme6x-tests-command.yaml |
옵션(CONTRIBUTING.md에 문서화):
groups=row-element-test,icon-element-test(은)는 스위트 XML의 이름 있는<test name="...">그룹을 실행합니다.tests=RowColumnLayoutVisualTest(은)는 이름 있는 테스트 클래스를 실행합니다.maven_ref=branch-name(은)는dxpr_maven브랜치를 씁니다. 빌더 변경과 테스트 업데이트를 함께 검토하는 방법입니다.
워크플로는 target/reports/**와 스크린샷을 빌드 아티팩트로 업로드하고 결과를 풀
리퀘스트 댓글로 게시합니다. 실패나 재시도에서만 통과한 테스트를 나열합니다. 각
스위트 작업의 제한 시간은 90분입니다.
린터와 정적 분석
각 린터는 Docker Compose 서비스이므로 Docker 외에 로컬 툴체인이 필요 없습니다.
| 서비스 | 명령 | 검사 내용 |
|---|---|---|
drupal-lint |
docker compose run --rm drupal-lint |
PHPCompatibility(PHP 8.3 이상), Drupal, DrupalPractice 표준의 phpcs. |
drupal-check-D11 |
docker compose run --rm drupal-check-D11 |
다음이 있는 PHPStan 레벨 5: mglaman/phpstan-drupal. 실행 환경: drupal/recommended-project |
eslint |
docker compose run --rm eslint |
다음의 ESLint와 맞춤법 검사: js/와 dxpr_builder/build/의 ESLint, dxpr_builder/extracted_t_functions.js |
stylelint |
docker compose run --rm stylelint |
다음의 Stylelint: dxpr_builder/sass/와 sass/ |
rust-lint |
docker compose run --rm rust-lint |
다음의 Rust 소스 Clippy: rust/ |
no-jquery, no-underscore, html-in-js |
docker compose run --rm <service> |
다음의 지원 중단 감지기: .github/workflows/deprecations.yml |
phpcs, ESLint, Stylelint에는 자동 수정 변형이 있습니다
(drupal-lint-auto-fix, eslint-auto-fix, stylelint-auto-fix).
같은 검사는 Docker 없이도 다음으로 쓸 수 있습니다: npm run lint:scss, npm run lint:no-jquery, npm run lint:no-underscore,
npm run lint:html-in-js.
npm install(은)는 Husky 사전 커밋 후크도 설치합니다
(.husky/pre-commit). 스테이징된 JavaScript, PHP, SCSS 파일과 Rust
소스에 맞는 자동 수정 및 린트 서비스를 실행하고, docs/ 아래 파일이
스테이징되면 docs/video-tools/bin/lint-videos.mjs(을)를 실행합니다.
.github/workflows/review.yaml(은)는 모든 풀 리퀘스트에서 바뀐 경로에 맞는
린터를 실행합니다. .github/workflows/main.yaml(은)는
3.x로의 모든 푸시에 drupal-lint, eslint, drupal-check-D11,
rust-lint(을)를 실행합니다. 둘 다 검사가 실패하면 빌드를 실패시키고
위반 파일과 함께 요약을 기록합니다.