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

Missing Step Implementation #311

Open
paulnaber opened this issue Jul 24, 2024 · 0 comments
Open

Missing Step Implementation #311

paulnaber opened this issue Jul 24, 2024 · 0 comments

Comments

@paulnaber
Copy link

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<Cypress.PluginConfigOptions> {
    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
The error is alway the same:
image

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

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