cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Not able to run the tests on Cypress Cloud viaGithub actions

Open janavi-p opened this issue 1 year ago • 2 comments

Current behavior

I am currently able to run the tests manually via cypress cloud. But if I trigger via github actions it does not. I tried reaching out to [email protected], but did not get prompt help. image image

Desired behavior

Whenever the PR push happens to staging my repo should be triggered via Github actions in the Cypress cloud. Even scheduled cron job do not run via cypress cloud

Test code to reproduce

Whenever the PR push happens to staging my repo should be triggered via Github actions in the Cypress cloud. Even scheduled cron job do not run via cypress cloud In addition to this, in my local runs I cannot use chrome browser. image

Cypress Version

13.12.0

Node version

9.5.1

Operating System

macOS 14.5

Debug Logs

No response

Other

No response

janavi-p avatar Jun 21 '24 11:06 janavi-p

I would recommend updating to the latest Cypress version, we may have resolved the Chrome opening issue since then.

What is the output you're seeing when running Cypress? It's not clear to me the exact error you're encountering.

jennifer-shehane avatar Jun 21 '24 14:06 jennifer-shehane

@janavi-p

You write that you are using Node.js version 9.5.1. Perhaps that was a typo? Check with

node --version

and make sure that you are using a minimum version of 18.x and preferably the 20.x LTS version.

Please post also your GitHub Actions workflow.

MikeMcC399 avatar Jun 21 '24 15:06 MikeMcC399

v20.13.1. this is the node version. image GitHub Actions ( Cypress Runs) || Getting "Run finished" immediately when "Run Starts" @MikeMcC399

Workflow: jobs: cypress-run: name: 'Cypress Test on Ubuntu' runs-on: ubuntu-latest timeout-minutes: 25 strategy: fail-fast: false # https://github.com/cypress-io/github-action/issues/48 matrix: containers: [1] # Uses 1 parallel instance

steps:

  • name: 'Checkout the repository' uses: actions/checkout@v4 with: ref: main

  • name: 'git branch info' run: | git branch

  • name: 'Building web application to be tested' run: yarn

  • name: Cypress run uses: cypress-io/github-action@v6 with: browser: electron config-file: cypress.config.js spec: "cypress/e2e/specs/regression-specs/staging/**/*.cy.js" group: 'UI-Electron' record: true parallel: true

    env: CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

janavi-p avatar Jul 08 '24 13:07 janavi-p

@janavi-p

You may be able to get more information about why your workflow is failing if you enable debugging

  env:
    DEBUG: '@cypress/github-action'

You do not need the line

run: yarn

if your repo has a yarn.lock in it. cypress-io/github-action takes care of installing dependencies.

Please edit the posting of your workflow and use backticks, otherwise your code is displayed as markdown instead of as yaml, for example:

```yml
name: example-basic
# This workflow represents a set of basic End-to-End tests
on:
  push:
    branches:
      - 'master'
and so on
```

This issue could also be transferred to https://github.com/cypress-io/github-action, although at this time there has not been any root cause identified.

MikeMcC399 avatar Jul 08 '24 14:07 MikeMcC399

The workflow is missing

        env:
          # pass GitHub token to allow accurately detecting a build vs a re-run build
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

MikeMcC399 avatar Jul 08 '24 15:07 MikeMcC399

@MikeMcC399 Added the Debug line suggested by you. After which the specs are running. In addition, I see Bad credential error whenever I add the following code. With this code, even manual triggers fail with bad credential error. I have set the right token. env: GITHUB_TOKEN: ${{ secrets.TOKEN }}

Attaching the logs for your reference. Please guide. 5_Cypress run.txt

janavi-p avatar Jul 09 '24 09:07 janavi-p

@janavi-p

You write that you have added

env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}

This is not the same as:

        env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

See

I suggest again for you to follow the documentation to avoid your errors.

MikeMcC399 avatar Jul 09 '24 09:07 MikeMcC399

As per your suggestion, I made the necessary changes. @MikeMcC399

Any particular reason why the run time has increased ( 25 mins to run 2 specs ) which leads to cancellation of operation ( triggered via scheduled job and via ci/cd) image

However, it runs 18 specs in 25 mins via triggered manually.

janavi-p avatar Jul 09 '24 13:07 janavi-p

@janavi-p If you run Cypress in debug mode mode and print the entire set of logs here, that might reveal where the test is sitting for so long.

jennifer-shehane avatar Jul 09 '24 18:07 jennifer-shehane

This issue is stale since there has been no reply for one month.

MikeMcC399 avatar Aug 09 '24 16:08 MikeMcC399