cypress-io / circleci-orb

Install, cache and run Cypress.io tests on CircleCI with minimal configuration.
https://circleci.com/orbs/registry/orb/cypress-io/cypress
MIT License
159 stars 101 forks source link

No option to no_output_timeout on run-tests #430

Open ghost opened 1 year ago

ghost commented 1 year ago

When executing a long running test using cypress/run-tests on CircleCI, I am often finding that I get the error Too long with no output (exceeded 10m0s): context deadline exceeded. After looking online I saw that there used to be a timeout command which had a default timeout of 10 minutes (the test often goes to 10-15 mins) which could be overridden (https://github.com/cypress-io/circleci-orb/issues/125). Could this be added to cypress/run-tests?

The orb does not work as expected

Phonesis commented 11 months ago

Any progress on this?

jordanpowell88 commented 11 months ago

You should be able to specify this yourself on your job itself. Have you given this a try @JP-MAT ?

ghost commented 11 months ago

I've tried both timeout and no_output_timeout and received the errors

Error calling command: 'cypress/run-tests'
Unexpected argument(s): no_output_timeout

Error calling command: 'cypress/run-tests'
Unexpected argument(s): timeout  

This used to exist as part of the 'run' job as the timeout property as far as I can tell

But there doesn't seem to be anything like it on the run-tests command or run job

ghost commented 10 months ago

Any update for this?

The change should be fairly trivial

https://github.com/cypress-io/circleci-orb/blob/master/src/commands/run-tests.yml

`description: >
  A single, complete job to run Cypress tests

parameters:
  working-directory:
    description: Directory containing package.json
    type: string
    default: "."
  start-command:
    description: Command used to start your local dev server for Cypress to tests against
    type: string
    default: ""
  cypress-command:
    description: Command used to run your Cypress tests
    type: string
    default: "npx cypress run"
  timeout: // Add this section
    description: Optional timeout for running tests
    type: string
    default: 10m
steps:
  - when:
      condition: << parameters.start-command >>
      steps:
        - run:
            name: Start Server
            command: << parameters.start-command >>
            background: true
            working_directory: << parameters.working-directory >>
  - run:
      name: Run Cypress
      command: << parameters.cypress-command >>
      working_directory: << parameters.working-directory >>
      no_output_timeout: << parameters.timeout >>  // Add this
  - store_artifacts:
      path: << parameters.working-directory >>/cypress/videos
  - store_artifacts:
      path: << parameters.working-directory >>/cypress/screenshots`

https://github.com/cypress-io/circleci-orb/blob/master/src/jobs/run.yml

description: >
  A single, complete job to run Cypress end-to-end tests in your application.
# What will this job do?
executor: default

parallelism: << parameters.parallelism >>

parameters:
  install-command:
    description: Overrides the default NPM command (npm ci)
    type: string
    default: ""
  post-install:
    description: >
      Additional commands to run after running install
      but before verifying Cypress and saving cache.
    type: string
    default: ""
  install-browsers:
    description: |
      Cypress runs by default in the Electron browser. Use this flag to install additional browsers to run your tests in.
      This is only needed if you are passing the `--browser` flag in your `cypress-command`.
      This parameter leverages the `circleci/browser-tools` orb and includes Chrome and FireFox.
      If you need additional browser support you can set this to false and use an executor with a docker image
      that includes the browsers of your choosing. See https://hub.docker.com/r/cypress/browsers/tags
    type: boolean
    default: false
  cypress-cache-key:
    description: Cache key used to cache the Cypress binary.
    type: string
    default: 'cypress-cache-{{ arch }}-{{ checksum "package.json" }}'
  cypress-cache-path:
    description: |
      By default, this will cache the '~/.cache/Cypress' directory so that the Cypress binary is cached. You can override this by providing your own cache path.
    type: string
    default: "~/.cache/Cypress"
  node-cache-version:
    type: string
    default: "v1"
    description: Change the default node cache version if you need to clear the cache for any reason.
  include-branch-in-node-cache-key:
    type: boolean
    default: false
    description: >
      If true, this cache will only apply to runs within the same branch. (Adds -{{ .Branch }}- to the node cache key)
  working-directory:
    description: Directory containing package.json
    type: string
    default: ""
  package-manager:
    type: enum
    enum: ["npm", "yarn", "yarn-berry"]
    default: "npm"
    description: Select the default node package manager to use. NPM v5+ Required.
  start-command:
    description: Command used to start your local dev server for Cypress to tests against
    type: string
    default: ""
  cypress-command:
    description: Command used to run your Cypress tests
    type: string
    default: "npx cypress run"
  parallelism:
    type: integer
    default: 1
    description: |
      Number of Circle machines to use for load balancing, min 1
      (requires `parallel` and `record` flags in your `cypress-command`)
  timeout:  // Add this section
    description: Optional timeout for running tests
    type: string
    default: 10m

steps:
  - install:
      install-command: << parameters.install-command >>
      post-install: << parameters.post-install >>
      cypress-cache-key: << parameters.cypress-cache-key >>
      cypress-cache-path: << parameters.cypress-cache-path >>
      node-cache-version: << parameters.node-cache-version >>
      working-directory: << parameters.working-directory >>
      package-manager: << parameters.package-manager >>
      include-branch-in-node-cache-key: << parameters.include-branch-in-node-cache-key >>
      install-browsers: << parameters.install-browsers >>
  - run-tests:
      working-directory: << parameters.working-directory >>
      start-command: << parameters.start-command >>
      cypress-command: << parameters.cypress-command >>
      timeout: << parameters.timeout >>  // Add this
aheffernan-litify commented 3 days ago

Any update on this? or a work around anyone has found to be successful?