26 lines
634 B
Docker
26 lines
634 B
Docker
#
|
|
# 这是 "test-runner" 服务的 Dockerfile
|
|
#
|
|
|
|
# 1. 使用微软官方的 Playwright 镜像
|
|
# 它已经内置了所有浏览器 (Chromium, Firefox, WebKit) 和操作系统依赖
|
|
FROM mcr.microsoft.com/playwright:v1.53.2-jammy
|
|
|
|
# 2. 设置工作目录
|
|
WORKDIR /app
|
|
|
|
# 3. 复制 "依赖清单" 文件
|
|
COPY tests/e2e/package*.json ./
|
|
COPY playwright.config.ts ./
|
|
|
|
# 4. 安装npm 依赖 (即 @playwright/test)
|
|
RUN npm install
|
|
|
|
# 5. 复制所有的测试代码到容器中
|
|
# (包括 global-setup.ts 和 specs/ 目录)
|
|
COPY tests/e2e/global-setup.ts ./
|
|
COPY tests/e2e/specs/ ./specs/
|
|
|
|
# 6. 默认命令
|
|
CMD ["npx", "playwright", "test"]
|