Angular 5: Configure Protractor to use Jasmine after having integrated Cucumber

0

How can Protractor and Cucumber be configured to work with Jasmine and Chai respectively? I have read that Cucumber and Jasmine are mutually exclusive. I currently have the following configuration in protractor.conf.ts

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
    allScriptsTimeout: 11000,
    specs: [
        './e2e/**/*.e2e-spec.ts',
        './e2e/features/*.feature'
    ],
    capabilities: {
        'browserName': 'chrome'
    },
    directConnect: true,
    baseUrl: 'http://localhost:4200/',
    framework: 'custom',
    frameworkPath: require.resolve('protractor-cucumber-framework'),
    // jasmineNodeOpts: {
    //     showColors: true,
    //     defaultTimeoutInterval: 30000,
    //     print: function() {}
    // },
    // cucumber command line options
    cucumberOpts: {
        // require step definition files before executing features
        require: ['./e2e/steps/**/*.ts'],
        // <string[]> (expression) only execute the features or scenarios with tags matching the expression
        tags: [],
        // <boolean> fail if there are any undefined or pending steps
        strict: true,
        // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
        format: [
            'json:reports/summary.json'
        ],
        // <boolean> invoke formatters without executing steps
        dryRun: false,
        // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
        compiler: []
    },
    // Enable TypeScript for the tests
    onPrepare() {
        require('ts-node').register({
            project: 'e2e/tsconfig.e2e.json'
        });
        // jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
    }
};

As you can see, Jasmine is no longer configured as the default framework, but instead is in 'Custom'.

Has anyone already done it? Am I obligated to use Chai also with Protractor? I await your comments.

    
asked by Ricky 16.04.2018 в 22:05
source

0 answers