'Problems storing video/screenshots when testing Rails app with Cypress/CircleCI

I am running Cypress to test a Rails app on CircleCI. I have the tests running on CircleCI with the following config. But no video/screenshot assets are created in CircleCI artefacts if tests fail.

version: 2.1 

orbs:
  ruby: circleci/[email protected]
  node: circleci/[email protected]

jobs:
  build: 
    docker:
      - image: cimg/ruby:2.7.2-node 
    steps:
      - checkout # pull down our git code.
      - ruby/install-deps # use the ruby orb to install dependencies
      - node/install-packages:
          pkg-manager: yarn

  test: 
    parallelism: 3
    docker:
      - image: cimg/ruby:2.7.2-node # this is our primary docker image, where step commands run.
      - image: circleci/postgres:12.3
        environment: # add POSTGRES environment variables.
          POSTGRES_USER: user
          POSTGRES_PASSWORD: password
          POSTGRES_DB: testdb
    environment:
      BUNDLE_JOBS: "3"
      BUNDLE_RETRY: "3"
      PGHOST: 127.0.0.1
      PGUSER: user
      PGPASSWORD: password
      RAILS_ENV: test
    steps:
      - checkout
      - ruby/install-deps
      - node/install-packages:
          pkg-manager: yarn
      - run:
          name: Wait for DB
          command: dockerize -wait tcp://localhost:5432 -timeout 1m
      - run:
          name: Database setup
          command: bundle exec rails db:schema:load --trace

      - run:
          name: Load test data
          command: bundle exec rails db:seed --trace

      - run:
          name: Run Rails Server
          background: true
          command: CYPRESS=1 bundle exec rails s -p 5017

      - run:
          name: Wait for server
          command: |
            until $(curl --retry 10 --output /dev/null --silent --head --fail http://127.0.0.1:5017); do
              printf '.'
              sleep 5
            done
      - run: sudo apt-get update
      - run: sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb

      - run: yarn cypress install --force
      - run:
          yarn: true
          command: yarn run cypress run

      - store_test_results:
          path: test-reports/


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source