cypress-io / circleci-orb

Install, cache and run Cypress.io tests on CircleCI with minimal configuration.

Home Page:https://circleci.com/orbs/registry/orb/cypress-io/cypress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run tests against a deployed URL?

mattkoch-bb opened this issue · comments

https://github.com/cypress-io/github-action

Is there a way to achieve the following, similar to how we've done it with the above GH Action? We're trying to set up a scenario where we have already built and installed dependencies, and deployed a static site to a hosting environment. The below GH action does this by setting a baseUrl in the config. We are wondering how to do something similar with Circle CI.

# See: https://learn.cypress.io/tutorials/running-our-tests-with-github-actions
# See: https://github.com/cypress-io/github-action
- name: Run Acceptance Tests
  uses: cypress-io/github-action@v5
  with:
    browser: chrome
    working-directory: ./nextjs
    install: false
    config: video=false,baseUrl=${{needs.commit_stage.outputs.acceptance_test_url}}
    wait-on: ${{needs.commit_stage.outputs.acceptance_test_url}}
commented

You should be able to do this using something like this:

Use an executor that already has Cypress installed including any browsers https://hub.docker.com/r/cypress/browsers/tags

 run-tests-in-chrome:
    docker:
      - image: cypress/browsers:node-16.18.1-chrome-109.0.5414.74-1-ff-109.0-edge-109.0.1518.52-1
    steps:
      - cypress/run-tests:
          working-directory: examples/angular-app
          cypress-command: "npx cypress run --browser chrome --baseUrl=yourPreBuildWebsiteURL"