Tamtam
Tamtam

Reputation: 13

NX Cypress run twice on the GitHub Action

I am using NX 14.5.1 and cypress 10.2.0. When I run e2e tests on GitHub actions, my tests always run twice. Sometimes one of them causes an error.

This is my github workflow:

jobs:
  continuous_integration:
    runs-on: ubuntu-latest
    timeout-minutes: 45
    strategy:
      fail-fast: false
      matrix:
      # run copies of the current job in parallel
      containers: [1, 2, 3, 4, 5]
    steps:
      - name: šŸ Checkout Repo
        uses: actions/checkout@v3
  
      - name: šŸ Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'npm'

      - name: Install Firebase Emulator Suite
        run: npm install -g [email protected]

      - name: šŸ’¾ Install Dependencies
        run: npm ci

      - name: āœ… E2E Tests
        uses: cypress-io/github-action@v4
        with:
          install: false
          start: |
            npm run e2e:firebase
            npm run e2e
          wait-on: http://localhost:4200
          wait-on-timeout: 120
          working-directory: apps/e2e
          record: true
          parallel: true
        env:
          FIREBASE_TOKEN: '${{ secrets.NX_FIREBASE_TOKEN }}'

And the result is like this result e2e test on GitHub Action

āœ“ should go to My Cards page (5043ms)
āœ“ should open Paint Point modal (3831ms)
āœ“ should open Insight modal (3323ms)
āœ“ should open Idea modal (2591ms)
(Attempt 1 of 3) should go to My Cards page
āœ“ should go to My Cards page (2328ms)
āœ“ should open Paint Point modal (1978ms)
āœ“ should open Insight modal (2302ms)
āœ“ should open Idea modal (2245ms)
āœ“ should create Paint Point card (4321ms)
(Attempt 1 of 3) should create Paint Point card
āœ“ should create Insight card (7147ms)
āœ“ should create Idea card (8727ms)
āœ“ should create Paint Point card (13580ms)
āœ“ should show modal from header create button (7298ms)

Do I miss a GitHub workflow configuration here?

Upvotes: 0

Views: 1188

Answers (1)

Abdallah Khalil
Abdallah Khalil

Reputation: 1

I think that's because you will need to split the workflow into 2 jobs as describe here.

Also you would need to make sure you are using their container image as mentioned Here

Upvotes: 1

Related Questions