Cypress test not loading data inside Nuxt component on CI

35 views Asked by At

I have some Cypress tests in my project that were until recently running absolutely fine, but over the past week have started failing. I can see the issue is my Contentful data isn't pulling through to the component in my default layout, which is making the tests fail as they're searching for data being pulled from Contentful.

The tests pass if I run them locally using localhost:3000, it's only in Github Ci that they don't pass/get the Contetnful data

E.g. my /layouts/default.vue is:

<template>
  <div :class="layout-body">
    <SkipLink />
    <Nuxt />
    <GlobalFooter />
  </div>
</template>

Any Contentful data in the SkipLink and GlobalFooter component is showing in the test but there is no Contentful data inside the Nuxt component.

My workflow file is:

run-cypress:
    runs-on: ubuntu-22.04
    env:
      AWS_ACCESS_KEY_ID: ${{ ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ SECRET_ACCESS_KEY }}
      AWS_REGION: "eu-west-2"
    strategy:
      matrix:
        node: [16]
    name: E2E on Node v${{ matrix.node }}
    steps:
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - name: Checkout
        uses: actions/checkout@v4
      - name: Cypress run
        uses: cypress-io/github-action@v6
        with:
          start: npm run dev
          wait-on: http://localhost:3000
          wait-on-timeout: 360
          browser: electron
          config: video=false,pageLoadTimeout=100000,defaultCommandTimeout=60000
        env:
          CYPRESS_ENVIRONMENT: local

Things i've tried:

  • adding the pageLoadTimeout & defaultCommandTimeout in the workflow file (they weren't previously there when it worked and it still doesn't work)
  • updating cypress-io/github-action (previously v5)
  • updating actions/setup-node (previously v2)
  • using more specific versions of Node
  • checking Contentful API keys
  • Using Electron browser instead of Chrome
0

There are 0 answers