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

Protractor Flake is not working with cucumber? #113

Open
abubakarafzal opened this issue Sep 25, 2019 · 2 comments
Open

Protractor Flake is not working with cucumber? #113

abubakarafzal opened this issue Sep 25, 2019 · 2 comments

Comments

@abubakarafzal
Copy link

abubakarafzal commented Sep 25, 2019

Hi there!

Thanks for submitting an issue! Please provide the following information:

  • Windows 10
  • 12
  • 5.1.2
  • 3.0.0
  • Flake Config
    `
'use strict';

const protractorFlake = require('protractor-flake');
const argv = require('yargs').argv;


protractorFlake({
    maxAttempts: 2,
    parser: 'cucumber',
    protractorArgs: [
        '../QuinCCucumber/config.js',

    ]
}, (status) => {
    process.exit(status);
});`

**config.ts**

`import * as path from "path";
import { browser, Config } from "protractor";
import { Reporter } from "./Test/hooks/reporter";
//import { Reporter } from "../hooks/reporter";

const jsonReports = process.cwd() + "/reports/json";
const retry = require('protractor-retry').retry;
const protractorFlake = require('protractor-flake');
const argv = require('yargs').argv;
export const config: Config = {
    defaultTimeoutInterval: 1445500000,
    seleniumAddress: "http://127.0.0.1:4444/wd/hub",

    SELENIUM_PROMISE_MANAGER: false,

    baseUrl: "http://lakshmi:4443/LoginPage.html",
    suites:{
        "Login": "./Test/features/login.feature",
        "case": "./Test/features/case.feature",

    },


    capabilities: {
        browserName: 'chrome',
        unexpectedAlertBehaviour: 'accept',
        'goog:chromeOptions': {
            'w3c': false,

        }
    },
    framework: 'custom',
    frameworkPath: require.resolve('protractor-cucumber-framework'),
    ignoreUncaughtExceptions: true,

    specs: [

        "./Test/features/login.feature",

        "./Test/features/case.feature",
    ],

    onPrepare: () => {
        browser.ignoreSynchronization = true;
        browser.manage().window().maximize();
        browser.manage().timeouts().setScriptTimeout(6000000);
        Reporter.createDirectory(jsonReports);
        retry.onPrepare();

    },
    protractorFlake:[{
        maxAttempts: 2,
        parser: 'cucumber',

    }, (status) => {
        process.exit(status);
    }],

    cucumberOpts: {

        // required step definitions
        compiler: [],
        require: ['../reporting/cucumber-screenshot.js','../steps/*.js',
            path.resolve(process.cwd(), './/Test/steps/*.js'),
            path.resolve(process.cwd(), './/Test/hooks/afterHooks.js'),

        ],
        // require : [ '../steps/*.js',
        // path.resolve(process.cwd(), './/Test/steps/*.js'),
        //  ],
        removeOriginalJsonReportFile : true,
        format: "json:./reports/json/cucumber_report.json",
        strict  : true,
        dryRun  : false,
        tags    : []
    },


onComplete: () => {
        Reporter.createHTMLReport();
    },


    plugins: [{
        package: require.resolve('protractor-multiple-cucumber-html-reporter-plugin'),
        options:{
            automaticallyGenerateReport: true,
            removeExistingJsonReportFile: true,
            openReportInBrowser: true,
            pageTitle : 'QUIN-C',
            reportName :'QUIN-C Test Report',

            //jsonOutputPath: './features',     //?featuresJsonPath
            removeOriginalJsonReportFile: true, //! This Option will Delete Generated Json File
            pageFooter: '<div class="container"><div class="row"><div class="col-sm-4"></div><img src="https://res-4.cloudinary.com/crunchbase-production/image/upload/c_lpad,h_256,w_256,f_auto,q_auto:eco/v1397183701/77e5f4c19af7b22148f5e1016925b98e.jpg" class="img-fluid"alt="no image"></div>',
            displayDuration: true,
        }
    }],


    getPageTimeout: 30000,
};

`

  • Output from your test suite
    **Using cucumber to parse output
    Re-running tests: test attempt 2

Tests failed but no specs were found. All specs will be run again.**

All of my Pass and failed test case run after one Scenerio fail.
kindly tell me what to do
i just want to run the failed test after execution.

You can collect the first few items easily with the trouble cli npx @nicktomlin/trouble protractor protractor-flake (or npm i -g @nicktomlin/trouble && trouble protractor protractor-flake)

@achuinard
Copy link

You shouldn't need this plugin anymore, you can just include a retry integer argument under the cucumberOpts in your protractor.conf.

@abhinaba-ghosh
Copy link

@achuinard Can you share your piece of code, please?

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

3 participants