https://cypress.io logo
Hi! I am getting the following error in my github ...
# e2e-testing
a
Hi! I am getting the following error in my github action while running cypress: env variables are required my action is as follows:
Copy code
yaml
name: Cypress Tests
on: [push]
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Cypress run
        uses: cypress-io/github-action@v4.1.0
        with:
          build: npm run build
          start: npm start
        env:
          NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
          NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
I have tried the following and all have failed: 1. putting the environment variables in cypress.config.ts 2. putting the environment variables in github secrets My test:
Copy code
ts
describe('Plan', () => {
  it('Displays login required and redirects user to login page when clicked on', () => {
    cy.visit('http://localhost:3000/plan')
    cy.findByRole('link', { name: /login required/i }).click()
    cy.url().should('include', '/login')
  })
})
I'm new to cypress testing and testing in general so any help is much appreciated. Thank you!