https://cypress.io logo
yml config returns: spec must be a string or comma...
# i-need-help
p
Hi i'm trying to run specific specs in order by the YAML file in the pipeline This is part of my YAML file that i'm trying to executed:
Copy code
yml
stages:
  - test
test:
  image: cypress/browsers:node16.17.0-chrome106
  parallel:
    matrix:
      - SUITES: "suite1.spec.js, suite2.specjs, suite3.spec.js"
the CI Lint validator says is correct but cypress returns an error. Anyone know about this error?
a
Not sure which CI Provider you're using, but can you try removing the quotations?
Copy code
stages:
  - test
test:
  image: cypress/browsers:node16.17.0-chrome106
  parallel:
    matrix:
      - SUITES: suite1.spec.js, suite2.specjs, suite3.spec.js
If that doesn't work, can you tell me which CI Provider you are using?
n
if you have multiple values it should be inside square brackets. https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs I would also guess without -. So
SUITES: [suite1.spec.js, suite2.specjs, suite3.spec.js]
p
This executes all test suites in parallel i need 2 prallel execution with about 20 test suites in each, because my tests collude with each other and i cannot afford them running next to each other
gitlab, your suggestion didn't change anything in the execution
n
then make 2 suites
not sure what is your goal
p
Copy code
yml
stages:
  - test
test_job_1:
  image: cypress/browsers:node16.17.0-chrome106
  parallel:
    matrix:
      - TAB: suite1.spec.js, suite2.specjs, suite3.spec.js
  stage: test
  timeout: 3h
  only:
    - schedules
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  script:
    - npm ci
    - npx cypress run $BROWSER $CYPRESS_RUN --ci-build-id $CI_PIPELINE_ID --group $TAB --spec "cypress/e2e/${TAB}"
test_job_2:
  image: cypress/browsers:node16.17.0-chrome106
  parallel:
    matrix:
      - TAB: suite4.spec.js, suite5.specjs, suite6.spec.js
  stage: test
  timeout: 3h
  only:
    - schedules
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  script:
    - npm ci
    - npx cypress run $BROWSER $CYPRESS_RUN --ci-build-id $CI_PIPELINE_ID --group $TAB --spec "cypress/e2e/${TAB}"
This yml file so far creates 2 jobs, but only executes the first suite and then ends 🤔
each of my suites is more than 5000 lines of just tests code, i cant make them in 1, it will be chaotic lol
also I need the current setup with folders and paths because working in a large team is never easy and messy files and code can become the biggest burden
n
This yml file so far creates 2 jobs, but only executes the first suite and then ends :thinking:
If it ends after suite1.spec.js Im guessing you have test files imported there and you have an error in before or after. Then it will skip everything else
p
Alright i managed to do whhat i wanted, here is an example what i did in the yml:
Copy code
yml
stages:
  - test
test:
  image: cypress/browsers:node16.17.0-chrome106
  parallel:
    matrix:
      - TAB: [
        "suite1.spec.js, suite2.specjs, suite3.spec.js",
        "suite4.spec.js, suite5.specjs, suite6.spec.js"
      ]
  stage: test
  only:
    - schedules
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  script:
    - npm ci
    - npx cypress run --parallel --ci-build-id $CI_PIPELINE_ID --group $TAB --spec $TAB
This creates 2 parallel executed jobs that each runs the specs in order. Saves time, creates order and nonetheless makes reporting better
n
yeah that should work
2 Views