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

Using Jasmine -- Retry runs all the Test cases and not only the failed test cases. #89

Open
ankushpoly13 opened this issue Jan 31, 2021 · 1 comment

Comments

@ankushpoly13
Copy link

ankushpoly13 commented Jan 31, 2021

Using Jasmine -- Retry runs all the Test cases and not only the failed test cases.

Please refer below configuration and testfile.

Configuration File :

import { Config, browser } from "protractor";
declare const allure: any;
import protractor = require('protractor')
import { createmodules } from "./pageObjects/createmoduleElements";
import * as Cred from "./jsonfiles/credentials.json";
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
import * as fs from 'fs';
var retry = require('protractor-retry').retry;

export let config: Config = {
  allScriptsTimeout: 400000,
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      w3c: false,
      // args: ['--headless', '--window-size=1920x1280'],
      args: ['--window-size=1920x1280'],
    },

  },


  onCleanUp: function (results) {
    retry.onCleanUp(results);
  },

  onPrepare: function () {

    //retry function
    retry.onPrepare();
   
    jasmine.getEnv().addReporter(
      new SpecReporter({
        suite: {
          displayNumber: true // display each suite number (hierarchical)
        },
        spec: {
          displayPending: false, // display each pending spec
          displayDuration: true // display each spec duration
        },
        summary: {
          displaySuccesses: true, // display summary of all successes after execution
          displayFailed: true, // display summary of all failures after execution
          displayPending: true // display summary of all pending specs after execution
        }
      })
    );


    var AllureReporter = require('jasmine-allure-reporter');
    jasmine.getEnv().addReporter(new AllureReporter());
    jasmine.getEnv().afterEach(function (done) {
      browser.takeScreenshot().then(function (png) {
        allure.createAttachment('Screenshot', function () {
          return Buffer.from(png, 'base64')
        }, 'image/png')();
        done();
      })
    });

  },

  afterLaunch: function () {
    return retry.afterLaunch(2); // number of retries ( default is 2 )
  },

  specs: ['./Testsuite/clients.js'],

  jasmineNodeOpts: {
    showColors: true, // Use colors in the command line report.
    defaultTimeoutInterval: 400000,
  }
};

Test File


describe('Client Module', function () {
  it('Client 1', async () => { 
some code . . . . . .
. . . . . .
. . . . . .

  })
  it('Client 2', async () => {
some code . . . . . .
. . . . . .
. . . . . .

  })
})

describe('Client Module', function () {
  it('Candidates  1', async () => {
          some code . . . . . .
          . . . . . .
          . . . . . .

  })
  it('Candidates  2', async () => {
        some code . . . . . .
        . . . . . .
        . . . . . .

  })
})
@ashishgoel88
Copy link

ashishgoel88 commented Mar 2, 2021

I am facing the same issue. Whole test suite is getting executed if any of the test is failed. But it seems to be as a known issue from 2019. :(

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

2 participants