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

When we using Protractor-retry then it Re-run whole test case not a failed test cases #62

Open
Navneetsoni860 opened this issue May 14, 2019 · 11 comments

Comments

@Navneetsoni860
Copy link

Navneetsoni860 commented May 14, 2019

Can someone help me on this.....
My conf file :
var retry = require('../lib/retry');

exports.config = {
framework: 'jasmine2',
specs: ['./jasmine/*.spec.js'],
jasmineNodeOpts: {
// If true, print colors to the terminal.
showColors: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 30000
},
capabilities: {
shardTestFiles: true,
maxInstances: 4,
browserName: 'chrome',
},
onCleanUp: function (results) {
retry.onCleanUp(results);
},
onPrepare: function () {
retry.onPrepare();
require('jasmine-expect');
browser.ignoreSynchronization = true;
},
afterLaunch: function() {
return retry.afterLaunch(2); // number of retries ( default is 2 )
}
};

@dreuxl
Copy link
Contributor

dreuxl commented May 15, 2019

Hi @Navneetsoni860

Do u have logs / traces of your issue?

@Navneetsoni860
Copy link
Author

It is not showing any error....If any of the spec failed then It's runing all specs 2 time.I want to rerun only failed specs .

@dreuxl
Copy link
Contributor

dreuxl commented May 16, 2019

please try to run your command line with DEBUG=* to get more logs on your side.
without logs, debugging is hard.

@kabomi
Copy link

kabomi commented Jul 12, 2019

If, as suggested on Readme, use
retry.onCleanUp(results);

Then later on files will be undefined on this line

function onCleanUp(results,files) {
    if (results) {
        writeToFile(files);
    }
}

Which will provoke to run all the specs again

It is related to this PR

So, what is missing is:
Example code on onCleanUp about passing the failed spec file paths to retry.onCleanUp(results, files);

@kabomi
Copy link

kabomi commented Oct 1, 2019

@dreuxl I've debugged until the method onCleanUp is being called and some tests already failed. We are missing the list of files that failed on the method onCleanUp
Let me know if you need anything else or something is not clear. Thanks

@aamirafridi97
Copy link

[
  'test/ui/e2e/specs/messagePage/*.js',
  'test/ui/e2e/specs/paymentPage/*.js',
]

I have these tests. Each folder has 1 file in it. I intentionally make the test fail under paymentPage.
I reran the test under messagePage as well :|

We have over 50 tests but just to see the issue I used the above example.
I have this under onCleanUp

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

@ShashankGupta28
Copy link

ShashankGupta28 commented Dec 26, 2019

@dreuxl : Let me eleborate issue,

exports.config = Object.assign({
  specs: [
    "**/spec1.e2e-spec.ts",
    "**/spec2.e2e-spec.ts",
  ],
  framework: "jasmine",
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 900000,
    print: function () { }
  },
  onPrepare() {
    retry.onPrepare();
  },
  onCleanUp: function (results, files) {
    retry.onCleanUp(results, files);
  },
  afterLaunch: function () {
    return retry.afterLaunch(3);
  }
}

In this config if there is any single test failure in spec1.e2e-spec.ts. then all test cases of spec1.e2e-spec.ts & spec2.e2e-spec.ts are executed in rerun on next retry which is the issue.

@Neal910
Copy link

Neal910 commented Jan 17, 2020

Hi guys, any luck on solving this one or workaround? I am having the same issue.

No matter how I twist the onPrepare, onCleanup and afterLaunch in config file, I always have the whole list of test cases written in a the file that will be re-ran by protractor-retry library. as following:
<?xml version="1.0" encoding="UTF-8"?> <list> <failedTest> <spec>**/login.spec.js,**/patient.spec.js,/usr/local/lib/node_modules/protractor/built/frameworks/__protractor_internal_afterEach_setup_spec.js</spec> </failedTest> </list>

@yuezk
Copy link

yuezk commented Mar 16, 2020

Seems to be a known issue as described in README, https://github.com/yahoo/protractor-retry#known-caveat

@ashishgoel88
Copy link

Will this issue get resolved?

@yuezk
Copy link

yuezk commented Mar 9, 2021

Will this issue get resolved?

@ashishgoel88 You could give it a try on https://github.com/yuezk/protractor-jasmine-retry if you are using Jasmine as the test framework. As I remember, it resolved this issue.

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

8 participants