首页 > 解决方案 > 在 cypress docker-compose setup 上运行特定的规范文件

问题描述

我有一个 docker-compose 文件来运行 cypress 测试,但我看到它正在识别集成文件夹中的所有规范文件并运行测试。我想运行规范文件的一个子集。例如:只有一个特定的规范文件。

我尝试使用命令:并且柏树运行没有帮助的特定文件。有没有办法使用 docker-compose 设置运行特定的规范文件。

version: '3.2'
services:
  cypress:
    image: 'cypress/included:6.6.0'
    environment:
      - CYPRESS_environment=test
    working_dir: /test
    volumes:
      - ./:/test

标签: docker-composecypress

解决方案


如果您查看它使用入口点的 Dockerfile,那么您可以在撰写文件中使用命令参数来运行特定文件

version: '3.2'
services:
  cypress:
    image: 'cypress/included:6.6.0'
    environment:
      - CYPRESS_environment=test
    working_dir: /test
    volumes:
      - ./:/test
    command: "--spec /test/integration/mytest.js"

推荐阅读