Unable to save test results from Cypress test

OK, I seem to be learning more about this ORB than I expected :slight_smile:

I think you need to look at the ORB again as it comes with an install command that uses the supplied parameters (such as cypress-cache-path) to set up an environment, but you also have a post-install step of “yarn cypress install” which is likely doing a new install using the default cypress installer over the top of what is already defined.

Looking at the ORB source code the first thing that cypress/run does is call cypress/install, so there should be no need to also tell it to install cypress a second time.

You are right, the post-install step was indeed not necessary. Not sure why I added it earlier in the process. That did not resolve the problem, as the attempted restoring of the cache already happens before.

I did manage to solve it though eventually, by splitting up the install and run step as outlined in the examples. It was recommended anyway for usages with high parallelization, in order to save time with doing only a single install that then is shared across runs.

This is how the relevant part of my config looks now:

version: 2.1
orbs:
  cypress: cypress-io/cypress@3.3.0

jobs:
  cypress-install:
    executor: cypress/default
    steps:
      - cypress/install:
          cypress-cache-key: dependencies-{{ checksum "frontend/yarn.lock" }}
          package-manager: yarn
          install-command: yarn install
          working-directory: frontend
      - persist_to_workspace:
          root: ~/
          paths:
            - .cache/Cypress
            - project

  cypress-run-tests:
    executor: cypress/default
    parallelism: 12
    steps:
      - attach_workspace:
          at: ~/
      - cypress/run-tests:
          cypress-command: TZ=America/Los_Angeles yarn cypress run --env split=true --reporter cypress-circleci-reporter
          start-command: yarn start
          working-directory: frontend
      - store_test_results:
          path: frontend/test_results

workflows:
  main:
    jobs:
      - cypress-install:
          name: "Install & Persist To Workspace"
          context:
            - "AWS CLI"
            - "Cypress"
      - cypress-run-tests:
          name: "Run Cypress Tests"
          context:
            - "AWS CLI"
            - "Cypress"
          requires:
            - Install & Persist To Workspace

I also manage to get the reporting to work finally! I think in the end it was a mistake in the provided path parameter (it needed to be frontend/test_results), but upgrading the ORB to v3 was long overdue anyway, and I learned quite a lot about circleCI in the process.

Thanks @rit1010 and @sebastian-lerner for the help throughout!