bahmutov / bahmutov/cypress-split

Missing Step Implementation

Open
#311 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
285
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Hello there,
currently I am trying to use the cypress-split plugin but I cannot manage it to work for every test.
We are using the @badeball/cypress-cucumber-preprocessor to be able to use cucumber.

The **cypress config** is configured like that:
```
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
import browserify from '@badeball/cypress-cucumber-preprocessor/browserify';
import { defineConfig } from 'cypress';

const { initPlugin } = require('cypress-plugin-snapshots/plugin');
const cypressSplit = require('cypress-split');

async function setupNodeEvents(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions): Promise {
cypressSplit(on, config);
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await addCucumberPreprocessorPlugin(on, config);

initPlugin(on, config);

on(
'file:preprocessor',
browserify(config, {
typescript: require.resolve('typescript'),
}),
);

// Make sure to return the config object as it might have been modified by the plugin.
return config;
}

export default defineConfig({
e2e: {
fixturesFolder: './src/fixtures',
supportFile: 'src/support/e2e.ts',
specPattern: '**/*.feature',
video: false,
videosFolder: './cypress/videos/',
watchForFileChanges: false,
screenshotOnRunFailure: true,
screenshotsFolder: '../../dist/cypress/apps/my-portal-e2e/screenshots',
baseUrl: 'http://localhost:4201',
chromeWebSecurity: false,
viewportWidth: 1980,
viewportHeight: 1080,
requestTimeout: 10000,
experimentalRunAllSpecs: true,
retries: 4,
experimentalMemoryManagement: true,
env: {
TAGS: 'not @skip',
'cypress-plugin-snapshots': {
imageConfig: {
threshold: 0.01,
thresholdType: 'percent',
},
},
},
setupNodeEvents,
excludeSpecPattern: ['**/__snapshots__/*', '**/__image_snapshots__/*'],
},
});
```

The **gitlab ci** is configured like that:
```
.cypress-template:
image: cypress/base:16.14.2-slim
stage: test
tags:
- cypress
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "develop"
when: always
artifacts:
when: always
expire_in: 1 day
paths:
- apps/my-portal-e2e/cypress/screenshots/**/*.*
- apps/my-portal-e2e/cypress/videos/**/*.*
- app/my-portal-e2e/src/e2e/**/__image_snapshots__/*

cypress-portal-split:
extends: .cypress-template
parallel: 13
script:
- npm run cypress:install
- npm run e2e:portal:split
cypress-portal2-split:
extends: .cypress-template
parallel: 1
script:
- npm run cypress:install
- npm run e2e:portal2:split
```

The **cucumber preprocessor rc** looks like this:
```
{
"stepDefinitions": ["src/e2e/[filepath]/**/*.{js,ts}", "src/e2e/common/**/*.{js,ts}", "../../e2e/common/**/*.{js,ts}"],
"filterSpecs": false,
"omitFiltered": true,
"json": {
"output": "./cypress/cucumber-reports/cucumber-json/cucumber.json",
"enabled": true
}
}
```

In the Pipeline, half of the jobs fail:
![image](https://github.com/user-attachments/assets/633a9052-fbc1-492f-ac81-61eecbd357a9)
The error is alway the same:
![image](https://github.com/user-attachments/assets/109c0031-42f5-4e9f-8f49-5b381fd58f6c)

Somehow, the specs are not there.
What could be the problem here?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Cypress config, the GitLab CI configuration, and the cucumber preprocessor rc shown in the issue; run the cypress:install and e2e:portal:split commands with the parallel settings. Compare the specs discovered by each job and determine why some jobs report no specs. Done means the cause is identified and the split jobs consistently discover and run the intended feature specs.

Written by the indexing model from the issue text.

Assessment

Tech stack
cypress, gitlab, javascript, typescript
Domain
ci-cd, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.