Meteor CI with Meteor up and Cypress


I’ve got a Meteor projecting that is using Meteor up to deploy to a simple digitalocean droplet and have it working with a github action to deploy when pushed to the main branch.

I am currently in the works to setup Cypress in my project for e2e testing and have it all working well on my dev machine, but would like to have it run before a deployment as well, so it will never deploy if there are errors in one of the tests.

My current github action for this is as follows:

- name: Cypress run
              uses: cypress-io/github-action@v4
                  # Specify Browser since container image is compile with Firefox
                  browser: chrome
                  build: npm install --production
                  start: npm run test:dev:headless 

With the following run commands in my package.json file:

"cypress:ui": "cypress open",
"cypress:headless": "cypress run",
"e2e": "METEOR_LOCAL_DIR=.meteor/test BABEL_ENV=test DISABLE_REACT_FAST_REFRESH=1 meteor run --port 4000 --settings settings-production.json --production --allow-superuser",
"test:dev:ui": "start-test 'npm run e2e' :4000 'npm run cypress:ui'",
"test:dev:headless": "start-test 'npm run e2e' :4000 'npm run cypress:headless'"

In my github action I’m seeing the following error:
We received this error at the network level:

I can’t seem to figure out what is going wrong and how I can get this to work properly.
Has anyone else got a setup working with Cypress in CI with meteor that could share some of their github actions .yml file?

Thank you in advance!

My main.yml file:

name: Deploy meteor app to digital ocean with meteor up
        branches: [main]

        runs-on: ubuntu-latest
        container: cypress/browsers:node12.18.3-chrome87-ff82
            # we setup ssh first as it is quick, so the action will fail fast during the installation on a new repository
            - name: Install SSH key
              uses: shimataro/ssh-key-action@v2
                  key: ${{ secrets.SSH_KEY }}
                  name: digitalocean
                  known_hosts: ${{ secrets.KNOWN_HOSTS }}

            # get the source
            - uses: actions/checkout@v2
            - uses: actions/setup-node@v2
                  node-version: "12"
            - name: Cache NPM dependencies
              uses: actions/cache@v1
                  path: ~/.npm
                  key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
                  restore-keys: |
                      ${{ runner.OS }}-npm-cache-

            # install only the production dependencies
            - name: get production dependencies only
              run: npm install --production

            # install mup without the -g flag, as it would not be allowed on github action
            - name: install mup locally
              run: npm install mup

            # install meteor to be able to build the app as a bundle
            - name: install meteor
              run: curl | sh

            - name: create-settings-production-json
              id: create-settings-production-json
              uses: jsdaniell/create-json@1.1.2
                  name: "./settings-production.json"
                  json: ${{ secrets.BETA_SETTINGS }}

            - name: Cypress run
              uses: cypress-io/github-action@v4
                  # Specify Browser since container image is compile with Firefox
                  browser: chrome
                  build: npm install --production
                  start: npm run test:dev:headless

            - name: create-mup-settings-json
              id: create-mup-settings-json
              uses: jsdaniell/create-json@1.1.2
                  name: "./.mup-beta/settings.json"
                  json: ${{ secrets.BETA_SETTINGS }}

            - name: Bundle the app and upload to Digital Ocean
              run: cd ./.mup-beta && npx mup deploy

And my cypress.config.ts file:

import { defineConfig } from "cypress";
const path = require("path");

const { Seeder } = require("mongo-seeding");
const config = {
    database: "mongodb://localhost:4001/meteor",
    dropDatabase: true,
const seeder = new Seeder(config);
const collections = seeder.readCollectionsFromPath(path.resolve("./cypress/fixtures"));

export default defineConfig({
    video: false,
    e2e: {
        baseUrl: "http://localhost:4000",
        setupNodeEvents(on, config) {
            // e2e testing node events setup code
            on("task", {
                async "seed:database"() {
                    await seeder.import(collections);
                    // > If you do not need to return a value, explicitly return null to
                    // > signal that the given event has been handled.
                    return null;

Hello @tfrionnet!

I would say that your problem is related to the timeout because the environment is still starting.

Below is a template to validate and add the timeout to your GitHub Actions file:

name: Cypress Tests

on: [push]

  # ...

    runs-on: ubuntu-latest
    container: cypress/browsers:node12.18.3-chrome87-ff82
    needs: install
      fail-fast: false
        # run copies of the current job in parallel
        containers: [1, 2, 3, 4, 5]
      - name: Checkout
        uses: actions/checkout@v2

      - name: Download the build folders
        uses: actions/download-artifact@v2
          name: build
          path: build

      - name: 'UI Tests - Chrome'
        uses: cypress-io/github-action@v4
          # we have already installed all dependencies above
          install: false
          start: yarn start:ci
          wait-on: 'http://localhost:3000'
          wait-on-timeout: 120
          browser: chrome
          record: true
          parallel: true
          group: 'UI - Chrome'
          spec: cypress/tests/ui/*
          # Recommended: pass the GitHub token lets this action correctly
          # determine the unique run id necessary to re-run the checks
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Another thing you can try and also add a timeout in your cypressfile and a specific header, as in the suggestion below:

Best Regards,

Philippe Oliveira

1 Like