cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.66k stars 3.16k forks source link

Not able to run the tests on Cypress Cloud viaGithub actions #29722

Closed janavi-p closed 3 weeks ago

janavi-p commented 2 months ago

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 support@cypress.io, 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

jennifer-shehane commented 2 months ago

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.

MikeMcC399 commented 2 months ago

@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.

janavi-p commented 2 months ago

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:

MikeMcC399 commented 2 months ago

@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 commented 2 months ago

The workflow is missing

        env:
          # pass GitHub token to allow accurately detecting a build vs a re-run build
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
janavi-p commented 2 months ago

@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

MikeMcC399 commented 2 months ago

@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.

janavi-p commented 1 month ago

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.

jennifer-shehane commented 1 month ago

@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.

MikeMcC399 commented 4 weeks ago

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