Skip to content

Cypress not respecting specPattern in CI #30957

Open
@mrfixitalec

Description

@mrfixitalec

Current behavior

I am running Cypress with Github Actions, and everything has been working well until I restructured how some of our environment variables are being pulled in. When I did this, everything continued to work as expected outside of Cypress not respecting the specPattern specified in cypress.config.ts

I am using cypress-io/github-action@v6

You can see from the output that calculator.cy.ts is running first, and the order of the tests ends up running alphabetically.

┌────────────────────────────────────────────────────────────────────────────────────────────
  │ Cypress:        12.17.4                                                                        │
  │ Browser:        Electron 106 (headless)                                                        │
  │ Node Version:   v20.18.0 (/home/runner/runners/2.321.0/externals/node20/bin/node)              │
  │ Specs:          5 found (register.cy.ts, login.cy.ts, opportunities.cy.ts, data.cy.ts, calcula │
  │                 tor.cy.ts)                                                                     │
  │ Searched:       cypress/e2e/register.cy.ts, cypress/e2e/login.cy.ts, cypress/e2e/opportunities │
  │                 .cy.ts, cypress/e2e/data.cy.ts, cypress/e2e/calculator.cy.ts                   │
  │ Params:         Tag: ***, Group: ***, Parallel: ***                                      │
  │ Run URL:        https://cloud.cypress.io/projects/vevccc/runs/7                                │
  └────────────────────────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  calculator.cy.ts                                                                (1 of 5)
  Estimated: 19 seconds

Config file

import { defineConfig } from 'cypress';
export default defineConfig({
        projectId: 'vevccc',
	e2e: {
		baseUrl: 'http://frontend:3000',
		env: {
			APP_URL: '',
			TEST_USER_ID: '',
			TEST_USERNAME: '',
			TEST_PASSWORD: ''
		},
		specPattern: [
			'cypress/e2e/register.cy.ts',
			'cypress/e2e/login.cy.ts',
			'cypress/e2e/opportunities.cy.ts',
			'cypress/e2e/data.cy.ts',
			'cypress/e2e/calculator.cy.ts'
		]
	},
	viewportWidth: 1920,
	viewportHeight: 1080
});

The issue started after I added in Cypress Cloud recording. The recording works fine, but it seems to be throwing off the specPattern. If I remove the projectId, the specPattern is recognized.

Desired behavior

Run tests in the order they are specified in the specPattern

Test code to reproduce

Let me know if you need any more information, and I can try to get something set up.

Cypress Version

12.17.4

Node version

v20.18.0

Operating System

ubuntu-latest

Debug Logs

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions