Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: How to run cypress from separate repo? #1387

Closed
vitalykarasik opened this issue Mar 6, 2025 · 8 comments
Closed

Q: How to run cypress from separate repo? #1387

vitalykarasik opened this issue Mar 6, 2025 · 8 comments
Assignees
Labels
question Further information is requested

Comments

@vitalykarasik
Copy link

As far as I understand from Readme and examples, the default scenario expects Cypress tests as part of application repo.
In my case I have a repository with Cypress tests, and I need to run them using 'yarn install && yarn cypress:run:staging' and so on.

Tests run OK when I'm running them using shell commands, like

run: yarn cypress:run:staging

but fail when I tried to use this action:

          uses: cypress-io/github-action@v6
          with:
            build: yarn install
            start: yarn cypress:run:staging 

Did I miss something?

Thanks, Vitaly

@MikeMcC399
Copy link
Collaborator

@vitalykarasik

build is intended to build the app, not to install dependencies. The action will already execute yarn install if it finds a yarn.lock file

start documentation says:

Caution: use the start parameter only to start a server, not to run Cypress, otherwise tests may be run twice. The action runs Cypress tests by default, unless the parameter runTests is set to false.

  • Which version of Yarn are you using?
  • What is the definition of the script cypress:run:staging?

This issue list is intended for bug reports and feature requests. For "how-to" type support you can connect to the Cypress technical community on Discord:

Discord chat (click on button)

@MikeMcC399 MikeMcC399 added the question Further information is requested label Mar 6, 2025
@MikeMcC399 MikeMcC399 self-assigned this Mar 6, 2025
@vitalykarasik
Copy link
Author

@MikeMcC399 thank you!

I missed documentation regarding 'start'.
My 'run staging' definition is:

cypress run --env environment=staging --record --key xxxxxxxxxxxxxxxx

@MikeMcC399
Copy link
Collaborator

@vitalykarasik

The intention of the cypress-io/github-action is not to run Cypress through a command line, but to run Cypress using the Cypress Module API driven by the action options.

See Project ID and Record Key for an example and explanation for recording:

  - name: Cypress run
    uses: cypress-io/github-action@v6
    with:
      record: true
    env:
      # pass the Cypress Cloud record key as an environment variable
      CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
      # pass the project ID from the secrets through environment variable
      CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }}

See Env for examples of passing environment variables.

@vitalykarasik
Copy link
Author

Thank you for your patience, I'll re-read project docs.

@MikeMcC399
Copy link
Collaborator

There is a gap in the documentation to make it clearer about the difference between using CLI commands and using cypress-io/github-action

Example without action

Example with action

@vitalykarasik
Copy link
Author

There is a gap in the documentation to make it clearer about the difference between using CLI commands and using cypress-io/github-action

Example without action

Example with action

Thanks!
I'll probably build workflow without cypress action - similar to single.yml scenario, but with print test report into job summary.

@MikeMcC399
Copy link
Collaborator

@vitalykarasik

I'm going to suggest closing this issue now. I think you have received the answers you needed to your questions.

@vitalykarasik
Copy link
Author

@vitalykarasik

I'm going to suggest closing this issue now. I think you have received the answers you needed to your questions.

sure, thank you again! I discovered just now that I can close it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants