Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress not respecting specPattern in CI #30957

Open
mrfixitalec opened this issue Jan 27, 2025 · 0 comments
Open

Cypress not respecting specPattern in CI #30957

mrfixitalec opened this issue Jan 27, 2025 · 0 comments

Comments

@mrfixitalec
Copy link

mrfixitalec commented Jan 27, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant