
troynguyen/cypress-included-pdf-package本镜像基于cypress/included构建,扩展集成了多种PDF处理工具(pdftk、poppler-utils、ghostscript)和OCR识别工具(tesseract-ocr),旨在提供一站式的端到端测试环境,支持在测试流程中直接处理PDF文件或执行OCR文字识别任务。
cypress/included环境,支持直接运行Cypress测试脚本,无需额外安装Cypress依赖。pdftotext(PDF转文本)、pdfinfo(PDF元信息提取)、pdfimages(PDF图像提取)等工具。bashdocker pull [镜像名称] # 请替换为实际镜像地址
bashdocker run -it --rm \ -v $(pwd)/cypress:/e2e/cypress \ -v $(pwd)/cypress.config.js:/e2e/cypress.config.js \ [镜像名称] \ npx cypress run
-v $(pwd)/cypress:/e2e/cypress:挂载本地Cypress测试用例目录到容器内。-v $(pwd)/cypress.config.js:/e2e/cypress.config.js:挂载Cypress配置文件。--spec cypress/e2e/pdf-test.cy.js指定测试文件)。在Cypress测试脚本中,可通过cy.exec()调用镜像内置工具:
javascript// cypress/e2e/pdf-validation.cy.js it('验证PDF导出内容', () => { // 假设测试流程中生成了目标PDF并保存到/tmp/test.pdf cy.exec('pdftotext /tmp/test.pdf -', { log: true }).then(result => { expect(result.stdout).to.include('订单编号: 20240101001'); // 验证文本内容 }); });
javascript// cypress/e2e/ocr-test.cy.js it('OCR识别验证', () => { // 假设测试流程中下载了包含文字的图像/tmp/sample.png cy.exec('tesseract /tmp/sample.png stdout', { log: true }).then(result => { expect(result.stdout.trim()).to.equal('测试OCR识别内容'); // 验证OCR结果 }); });
yaml# docker-compose.yml version: '3.8' services: cypress-test: image: [镜像名称] volumes: - ./cypress:/e2e/cypress - ./cypress.config.js:/e2e/cypress.config.js - ./test-assets:/e2e/test-assets # 挂载测试所需的PDF/图像资源 command: npx cypress run --spec cypress/e2e/pdf-ocr-test.cy.js
:支持所有Cypress原生环境变量(如CYPRESS_BASE_URL`指定测试基础URL)。/usr/share/tesseract-ocr/5/tessdata/)。apt-get安装(需以root用户运行),例如安装中文语言包:
bashdocker run -it --rm --user root [镜像名称] apt-get update && apt-get install -y tesseract-ocr-chi-sim
/etc/ghostscript/下的配置)实现。/e2e,建议将测试脚本及资源挂载到此目录。--memory参数)。

manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务