https://cypress.io logo
Join Discord
Powered by
# general-chat
  • m

    mysterious-belgium-25713

    10/18/2022, 11:30 AM
    You can also check my action runs
  • g

    green-queen-82383

    10/18/2022, 11:30 AM
    @mysterious-belgium-25713 Let me take a look, thanks!
  • g

    green-queen-82383

    10/18/2022, 11:33 AM
    @mysterious-belgium-25713 I believe that works because you're not using a monorepo. There is only one package.json file and the lock file is in the root. When I leave
    install: false
    out and have the cypress package do the installs, it bugs out because it expects lock files in each project in the monorepo, which pnpm workspaces do not add (there is only 1 lock file in the root). So the instructions that I've found prompt us to skip the install phase (because it happened in a previous step, but it requires caching).
  • m

    mysterious-belgium-25713

    10/18/2022, 11:34 AM
    Maybe you can add as extra step. pnpm dlx cypress install. This will do the same as npx cypress install and installs the cypress binary
  • g

    green-queen-82383

    10/18/2022, 11:35 AM
    I can try that, but it would mean downloading the binary on each test run.
  • g

    green-queen-82383

    10/18/2022, 11:36 AM
    And it is already getting installed either way, via a previous
    pnpm i
    . It just doesn't know where to get the file from, because caching the binary folder isn't working.
  • m

    mysterious-belgium-25713

    10/18/2022, 11:38 AM
    Yeah well some tricks i used in the past with caching files in another CI was to set the CYPRESS_CACHE_FOLDER env variable to a folder/location in the project. And then you can point to where the binary is cached in your step
  • g

    green-queen-82383

    10/18/2022, 11:40 AM
    I have tried caching it, but I can't get it to work. The instructions in the docs (and examples in the kitchen sink repo) do not include an example with pnpm, only npm and yarn.
  • g

    green-queen-82383

    10/18/2022, 11:42 AM
    I have tried that, with this set up (to no avail):
    Copy code
    yaml
    env: 
      CYPRESS_CACHE_FOLDER: cypress/cache
    # jobs and other steps...
    - name: Cache Cypress Binary
            id: cache-cypress-binary
            uses: actions/cache@v3
            with:
              path: cypress/cache
              key: ${{ runner.os }}-cypress-binary-${{ hashFiles('**/pnpm-lock.yaml') }}
              restore-keys: |
                ${{ runner.os }}-cypress-binary-
    - run: pnpm i
    - name: Cypress run
            uses: cypress-io/github-action@v4
            env:
              # Have tried with and without the ../..
              CYPRESS_CACHE_FOLDER: ../../cypress/cache
            with:
              install: false
              working-directory: apps/myapp
              command: pnpm cypress:ci
              start: pnpm dev
              wait-on: 'http://localhost:3000'
  • g

    green-queen-82383

    10/18/2022, 11:42 AM
    It keeps giving me the same message about not finding the cached binary.
  • g

    green-queen-82383

    10/18/2022, 11:45 AM
    Just to add to this: it's only the caching that doesn't seem to work. The steps function fine, the dev server is started, it waits for it, ... The error pops up when the
    cypress run
    command is run inside the step, because at that point it fails to find the binary.
  • m

    mysterious-belgium-25713

    10/18/2022, 12:00 PM
    I have a feeling that pnpm install in the pipeline is not installing the cypress binary. Because i could get the same result if i do pnpm install and in the cypress action put install:false
  • m

    mysterious-belgium-25713

    10/18/2022, 12:01 PM
    Maybe its because its downloading the deps from the lockfile
  • m

    mysterious-belgium-25713

    10/18/2022, 12:05 PM
    @green-queen-82383 This seems to work and the cache seems to work so its not redownloading the cypress binary after cache. Note: Overriding Cypress cache directory to: $GITHUB_WORKSPACE/mycache Previous installs of Cypress may not be found. Cypress 10.10.0 is installed in /home/runner/work/cypress-pnpm/cypress-pnpm/$GITHUB_WORKSPACE/mycache/10.10.0 Skipping installation:
    Copy code
    yaml
    name: pnpm Cypress Example Workflow
    
    env:
      CYPRESS_CACHE_FOLDER: '$GITHUB_WORKSPACE/mycache'
    
    
    on:
      push:
    jobs:
      build:
        runs-on: ubuntu-20.04
        steps:
        - uses: actions/checkout@v3
        - uses: pnpm/action-setup@v2.2.2
          with:
            version: 7
        - name: Use Node.js 
          uses: actions/setup-node@v3
          with:
            node-version: 16
            cache: 'pnpm'
        - name: Cache folder
          uses: actions/cache@v3
          with:
            path: '$GITHUB_WORKSPACE/mycache'
            key: ${{ runner.os}}-cypress
        - name: Install dependencies
          run: pnpm install
        - name: Install cypress
          run: pnpm dlx cypress install
        - name: Run Cypress
          uses: cypress-io/github-action@v4
          with:
            browser: chrome
            install: false
  • g

    green-queen-82383

    10/18/2022, 12:06 PM
    I will try that right away, thanks!
  • m

    mysterious-belgium-25713

    10/18/2022, 12:08 PM
    Mabye you need some tweaking with the cache key because my project is a demo one and not a real project
  • g

    green-queen-82383

    10/18/2022, 12:09 PM
    What does the cache key do anyway? Isn't it just a unique identifier to recover the cache from?
  • m

    mysterious-belgium-25713

    10/18/2022, 12:11 PM
    @green-queen-82383 Yup, but now i have runner.os
  • m

    mysterious-belgium-25713

    10/18/2022, 12:11 PM
    And dont know if you are using different runners so windows/macs/linux
  • m

    mysterious-belgium-25713

    10/18/2022, 12:11 PM
    Then it will change
  • g

    green-queen-82383

    10/18/2022, 12:15 PM
    Still not working. It does 2 things wrong: 1. Running the
    pnpm dlx cypress install
    command actually does reinstall cypress, doesn't skip the step. 2. It now looks in the wrong place for the binary:
    We expected the binary to be installed here: /home/runner/work/project/project/apps/myapp/$GITHUB_WORKSPACE/mycache/10.10.0/Cypress/Cypress
    This is likely due to the working directory being set (for the monorepo app).
  • g

    green-queen-82383

    10/18/2022, 12:29 PM
    I also can't take away the working directory, because then it gives me the error:
    Cannot find module 'cypress'
  • m

    mysterious-belgium-25713

    10/18/2022, 12:32 PM
    Pff the monorepo makes it a bit harder. I think i have a project lying somewhere, where i have a client and server folder. Maybe i can dig it up and try to recreate this.
  • g

    green-queen-82383

    10/18/2022, 12:35 PM
    I actually got it working just now, but without the cypress binary cache. I now have the following:
    Copy code
    yaml
    name: CI Push
    on:
      push:
        branches:
          - main
    jobs:
      build:
        name: Nx Build - Main Job
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v3
            with:
              fetch-depth: 0
              submodules: true
          - uses: nrwl/nx-set-shas@v3
          - uses: pnpm/action-setup@v2.2.2
            with:
              version: 7
          - name: Use Node.js 16.17
            uses: actions/setup-node@v3
            with:
              node-version: 16
              cache: 'pnpm'
          - run: pnpm i
          - run: pnpm nx workspace-lint
          - run: pnpm nx run-many --target=lint
          - run: pnpm nx run-many --target=test
          - name: Cypress run
            uses: cypress-io/github-action@v4
            with:
              install: false
              browser: chrome
              working-directory: apps/myapp
              command: pnpm cypress:ci
              start: pnpm dev
              wait-on: 'http://localhost:3000'
          - run: pnpm nx run-many --target=build
          - name: Upload built artifact
            uses: actions/upload-artifact@v3
            with:
              name: build-artifact
              path: apps/myapp/dist
              retention-days: 1
  • g

    green-queen-82383

    10/18/2022, 12:37 PM
    There are however 2 things going wrong: 1. It's not testing with chrome, but using Electron:
    Browser:        Electron 106 (headless)
    2. The test runs (there's only 1 atm), but it fails.
    CypressError: Timed out retrying after 5000ms: cy.wait() timed out waiting 5000ms for the 1st request to the route: getAttempt. No request ever occurred.
    The test runs perfectly fine locally...
  • m

    mysterious-belgium-25713

    10/18/2022, 12:38 PM
    hmm, dont think i can help with that. Since i dont see anything weird in your yaml
  • g

    green-queen-82383

    10/18/2022, 2:01 PM
    @mysterious-belgium-25713 I just want to give a huge thanks for all the effort you've put into helping me! I've got everything resolved now!
  • s

    salmon-computer-88142

    10/18/2022, 2:30 PM
    https://github.com/cypress-io/code-coverage/issues/603 i want to work on it, please give me green light
  • f

    few-night-45066

    10/18/2022, 2:33 PM
    Hello, i have a problem with a some databases queries I want to make queries to ssms from Cypress, but despiste The fact that's already connected it doesn't make queries and it gives me a time error, I share My files for a better understanding
  • f

    few-night-45066

    10/18/2022, 2:37 PM
    If someone can help me, I really really appreciate it
1...878889...127Latest