0

I am trying to implement parallel testing in AWS code build. I created a buildspec.yml file like this sample project: https://github.com/cypress-io/cypress-realworld-app/blob/develop/buildspec.yml

My problem is the environments that I use during the cypress command are getting as empty.

      - echo $CY_GROUP_SPEC
      - CY_GROUP=$(echo $CY_GROUP_SPEC | cut -d'|' -f1)
      - CY_BROWSER=$(echo $CY_GROUP_SPEC | cut -d'|' -f2)
      - CY_SPEC=$(echo $CY_GROUP_SPEC | cut -d'|' -f3)
      - CY_CONFIG=$(echo $CY_GROUP_SPEC | cut -d'|' -f4)

And then the cypress code build fails with this error:

Opening Cypress...
Cypress encountered an error while parsing the argument: --spec

You passed: true

The error was: spec must be a string or comma-separated list

I use this command to run cypress:

- NO_COLOR=1 ./node_modules/.bin/cypress run --browser $CY_BROWSER --spec "$CY_SPEC" --config "$CY_CONFIG" --headless. --record --key $CYPRESS_KEY --parallel --ci-build-id $CODEBUILD_INITIATOR  --group "$CY_GROUP"

I defined these env variables like this on the top of the file:

batch:
  build-matrix:
      dynamic:
        env:
          image:
              - ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/cypress:latest
          variables:
            CY_GROUP_SPEC:
              - "UI - Chrome|chrome|cypress/e2e/account/*"
              - "UI - Chrome|chrome|cypress/e2e/auth/*"
              - "UI - Chrome|chrome|cypress/e2e/mastering/*"
              - "UI - Chrome|chrome|cypress/e2e/pages/**/*"
              - "UI - Chrome|chrome|cypress/e2e/user-flows/**/*"
            WORKERS:
              - 1
              - 2
              - 3
              - 4
              - 5

How can I fix this problem?

Thanks

tcetin
  • 979
  • 1
  • 21
  • 48

1 Answers1

0

The errors definitely tell you that the command is wrong. Check that carefully.

jackaaxc
  • 21
  • 5