Giter Club home page Giter Club logo

cypress-gh-action-example's Introduction

cypress-gh-action-example renovate-app badge

Example running Cypress tests inside GitHub Action

Uses cypress-io/github-action to run Cypress end-to-end tests. Runs recorded at Cypress Dashboard

.github/workflows Status Description
artifacts.yml status Stores generated run video and any screenshots using CI artifacts
basic.yml status Basic tests example
chrome.yml status Runs tests using Chrome browser, rather than Electron
custom-container.yml status Runs tests using custom Docker image
main.yml status Runs tests on different versions of Node
merge.yml status Shows how to set custom commit message for pull requests workflows
separate-install.yml status Workflow where install and tests are in separate steps
separate-jobs.yml status Install dependencies and build the app in one job, test in another
serve.yml status Shows workflow with server start command and a separate config file
subfolder.yml status Installing and testing from a subfolder
tags.yml status Recorded runs with tags using different Node versions
timeouts.yml status Stops the job if it runs over the time limit
ubuntu.yml status Runs E2E tests on Ubuntu 16 and Ubuntu 18

Main

Example image of a test run across Node v12 and v14 recorded on Cypress Dashboard from the .github/workflows/main.yml workflow

Dashboard run recording

Note: see cypress.json where Cypress is configured to use the system Node, rather than the bundled Node version.

Artifacts

Example image showing how to download the test run videos from the action .github/workflows/artifacts.yml

Artifacts

More info

For more information see cypress-io/github-action and read Drastically Simplify Testing on CI with Cypress GitHub Action blog post.

cypress-gh-action-example's People

Contributors

bahmutov avatar mikemcc399 avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cypress-gh-action-example's Issues

Pre-build Docker container

I am trying to cache a docker container and then use it as an artifact in parallel to reduce time using the 2 jobs example. Is this possible?

name: Pre-install Docker and Run Cypress in Parallel
on: [push, pull_request]
# this workflow has two jobs
# 1. the "install-job" installs everything and saves the build web application as an upload artifact
# 2. the "test-job" downloads the build site and runs tests
jobs:
  install-job:
    runs-on: ubuntu-latest
    # https://github.com/cypress-io/cypress-docker-images
    container: cypress/browsers:node16.5.0-chrome94-ff93
    steps:
      - name: Checkout
        uses: actions/checkout@v2   
      # only install the dependencies without running any tests
      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          runTests: false
      # only upload the local folders we built / updated
      #   ./
      # TIP: we want to avoid uploading node_modules since it is SLOW
      # https://glebbahmutov.com/blog/parallel-cypress-tests-gh-action/
      - name: Save built folders ๐Ÿ†™
        uses: actions/upload-artifact@v2
        with:
          name: built
          path: |
            ./
  test-job:
    runs-on: ubuntu-latest
    needs: install-job
    strategy:
      # when one test fails, DO NOT cancel the other containers, because this will kill Cypress processes leaving the Dashboard hanging ...
      # https://github.com/cypress-io/github-action/issues/48
      fail-fast: false
      matrix:
        # split tests across three containers in parallel
        containers: [1, 2, 3]
    steps:
      - name: Checkout
        # checks-out your repository so your workflow can access it
        uses: actions/checkout@v2
      # because of "record" and "parallel" parameters these containers will load balance all found tests among themselves
      - name: Download built folders โฌ
        uses: actions/download-artifact@v2
        with:
          name: built
      - name: Cypress run
        # GitHub Action for running Cypress end-to-end tests
        uses: cypress-io/github-action@v2
        with:
          record: true
          parallel: true
          group: 'Actions example'
          tag: preinstallParallelDocker
        env:
          # pass the Dashboard record key as an environment variable
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          # Recommended: pass the GitHub token lets this action correctly determine the unique run id necessary to re-run the checks (generates dynamically)
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Example uses retired Ubuntu 16 and deprecated Ubuntu 18 runner

Problem description

.github/workflows/ubuntu.yml which uses:

  • ubuntu-16.04
  • ubuntu-18.04

fails to run. See for example run 2216393814 showing ubuntu-16 failing.

The currently supported list of GitHub runner-images shows:

Image YAML Label
Ubuntu 22.04 ubuntu-latest or ubuntu-22.04
Ubuntu 20.04 ubuntu-20.04
Ubuntu 18.04 deprecated ubuntu-18.04

Ubuntu 16.04 was removed from the available runners on September 20, 2021. (See https://github.com/actions/runner-images/issues/.)

Suggested fix

Update .github/workflows/ubuntu.yml:

Remove

  • ubuntu-16.04
  • ubuntu-18.04

and replace with

  • ubuntu-20.04
  • ubuntu-22.04

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency cypress-expect to v3
  • chore(deps): update dependency lerna to v8
  • chore(deps): update dependency ubuntu to v22
  • chore(deps): update github artifact actions to v4 (major) (actions/download-artifact, actions/upload-artifact)
  • fix(deps): update dependency cypress to v13
  • fix(deps): update dependency serve to v14
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/artifacts.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • actions/upload-artifact v2
  • actions/upload-artifact v2
  • ubuntu 20.04
.github/workflows/basic.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/chrome.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/custom-container.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/main.yml
  • actions/setup-node v2
  • actions/checkout v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/merge.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/separate-install.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/separate-jobs.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • actions/upload-artifact v2
  • actions/checkout v2
  • actions/download-artifact v2
  • cypress-io/github-action v2
  • ubuntu 20.04
  • ubuntu 20.04
.github/workflows/serve.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/subfolder.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/tags.yml
  • actions/setup-node v2
  • actions/checkout v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/timeouts.yml
  • actions/checkout v2
  • cypress-io/github-action v2
  • ubuntu 20.04
.github/workflows/ubuntu.yml
  • actions/checkout v3
  • cypress-io/github-action v5
  • actions/checkout v3
  • cypress-io/github-action v5
  • ubuntu 20.04
  • ubuntu 22.04
npm
package.json
  • cypress 7.7.0
  • cypress-expect 2.5.1
  • serve 11.3.2
  • lerna 4.0.0
packages/e2e/package.json
  • cypress 7.7.0
  • serve 11.3.2

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.