Back to Test Automation
2026-04-306 min read

Install the Cypress GitHub app (Test Automation)

Learn Install the Cypress GitHub app (Test Automation) step by step with clear examples and exercises.

Title: Install the Cypress GitHub App for Test Automation

Why This Matters

Test automation is a crucial part of modern software development, ensuring that your code works as expected across various environments and devices. Cypress, an end-to-end testing solution for web applications, offers seamless integration with popular version control systems like GitHub. In this lesson, we will learn how to install the Cypress GitHub app, enabling you to run tests automatically on every push to your GitHub repository.

Prerequisites

Before diving into the installation process, make sure you have the following prerequisites:

  1. Node.js and npm installed on your system
  2. A Cypress account (sign up at )
  3. A GitHub account (sign up at )
  4. Access to a project repository on GitHub
  5. Basic understanding of JavaScript and npm package management

Core Concept

Cypress offers a GitHub App integration that allows you to run tests automatically whenever code changes are pushed to your GitHub repository. To achieve this, we will:

  1. Install the Cypress GitHub App
  2. Enable GitHub integration for our project
  3. Configure status checks and pull request comments

Installing the Cypress GitHub App

To install the Cypress GitHub App, follow these steps:

  1. Navigate to your organization's settings page or a project's settings page in Cypress Cloud ().
  2. Click on "Integrations" from the left-hand menu.
  3. Scroll down and click on "GitHub" under the "Services" section.
  4. If you haven't already, sign in to your GitHub account by clicking the "Sign In" button.
  5. Authorize the Cypress GitHub App by clicking "Authorize app."
  6. Once authorized, you will be redirected back to the Cypress Cloud dashboard, where you can configure your GitHub integration settings.

Enabling GitHub Integration for a Project

After installing the Cypress GitHub App, follow these steps to enable it for your project:

  1. Go to the "Organizations" page or open the organization switcher in the Cypress Cloud dashboard.
  2. Select the organization you wish to integrate with a GitHub account or GitHub organization.
  3. Visit the selected organization's Integrations page via the side navigation.
  4. Click on the "Add Project" button and select the project repository you want to integrate with Cypress Cloud.
  5. Follow the prompts to configure your project settings, including specifying a branch for recording tests and enabling GitHub integration.

Configuring Status Checks and Pull Request Comments

Once your project is set up to record to Cypress Cloud, you can enable status checks and pull request comments in your GitHub repository:

  1. Navigate to the "Settings" page of your GitHub repository.
  2. Click on "Secrets" from the left-hand menu.
  3. Add a new secret called CYPRESS_API_TOKEN with the value being your Cypress API token (found in the Cypress Cloud dashboard under "Account Settings").
  4. Under "Code scanning," ensure that "Status checks" and "Pull request reviews" are enabled.
  5. Save your changes.

Now, whenever you push code to your GitHub repository, Cypress will run your tests automatically, and the results will be displayed as status checks in your pull requests and on the main branch's activity feed.

Worked Example

In this worked example, we will walk through the process of setting up a simple test suite using Cypress and integrating it with GitHub.

  1. Create a new directory for our project:
mkdir cypress-github-example && cd cypress-github-example
  1. Initialize a new Node.js project:
npm init -y
  1. Install Cypress and its required dependencies:
npm install cypress --save-dev
  1. Create a new spec file (test case) for our example:
touch cypress/integration/example_spec.js
  1. Add the following code to cypress/integration/example_spec.js:
describe('Example Test', () => {
it('Visits the Cypress website and checks the title', () => {
cy.visit('https://www.cypress.io')
cy.title().should('include', 'Cypress - Fast, easy and reliable testing for anything that runs in a browser')
})
})
  1. Run our test suite locally:
npx cypress run
  1. Sign up for a Cypress account if you haven't already () and log in to the dashboard ().
  2. Follow the steps outlined in the Core Concept section to install the Cypress GitHub App, enable GitHub integration for your project, and configure status checks and pull request comments.
  3. Push your code to a new branch on GitHub:
git init
git add .
git commit -m "Initial commit"
git push origin main
git checkout -b example-branch
  1. Modify the test case in cypress/integration/example_spec.js to ensure it fails:
describe('Example Test', () => {
it('Visits the Cypress website and checks the title', () => {
cy.visit('https://www.cypress.io')
// Modify this line to fail the test
cy.title().should('include', 'Cypress - Fast, easy and reliable testing for anything that runs in a browser')
})
})
  1. Push your changes to GitHub:
git add .
git commit -m "Introduce test failure"
git push origin example-branch
  1. Observe the status check failure in your GitHub pull request and the Cypress Cloud dashboard.

Common Mistakes

  • Forgetting to install the Cypress GitHub App: Make sure you follow the steps outlined in the "Installing the Cypress GitHub App" section above.
  • Not configuring status checks and pull request comments: Ensure that you have set up status checks and pull request reviews in your GitHub repository, as described in the "Configuring Status Checks and Pull Request Comments" section.
  • Incorrect API token: Double-check that you are using the correct Cypress API token (found in the Cypress Cloud dashboard under "Account Settings").
  • Misconfigured Git information: Make sure your CI environment is reliably providing a commit SHA (typically via an environment variable).
  • Failing to push code to a new branch: Always create a new branch for your changes and push them to GitHub before testing.

Practice Questions

  1. How can you configure Cypress to run tests on every push to your GitHub repository?
  2. What are the steps to install the Cypress GitHub App?
  3. What is the purpose of status checks and pull request comments in the GitHub integration with Cypress?
  4. Why should you always create a new branch for your changes before testing with Cypress and GitHub?
  5. How can you troubleshoot issues related to Git information when integrating Cypress with GitHub?

FAQ

  1. What if I encounter GitHub integration issues with my CI setup?
  • Make sure the git information is being sent properly by following these guidelines:
  • If you still face issues, please contact Cypress support for assistance.
  1. Is GitHub Enterprise integration included in the Business and Enterprise pricing plans?
  • Yes, GitHub Enterprise integration is included in our Business and Enterprise paid pricing plans. For more information, visit .
  1. What happens when a test fails with GitHub integration enabled?
  • When a test fails, the status check will show as failed in your GitHub pull request and on the main branch's activity feed. You can view detailed test results in the Cypress Cloud dashboard ().
  1. Can I integrate Cypress with other version control systems besides GitHub?
  • Yes, Cypress offers integrations with GitLab, Bitbucket, and more. For more information, visit .
  1. How can I customize the status check messages displayed in my GitHub pull requests?
  • You can configure custom status check messages by setting environment variables in your CI configuration file (e.g., .circleci/config.yml or .gitlab-ci.yml). For more information, visit .
Install the Cypress GitHub app (Test Automation) | Test Automation | XQA Learn