3

Is there a way to skip protractor test dynamically? I have scenarios where a user can select any specific test to perform. So, I want to execute only the tests user has specified and dependent tests, all other tests should be skipped.

I am using grunt-protractor-runner.

  • protractor: 2.0
  • Jasmine: 2.3
Hasan
  • 188
  • 8

2 Answers2

1

As shown in this question, you can specify a URL of a specific spec. Otherwise you'd have to use the focused fdescribe/fit but you can't change it in runtime. This is not related to Protractor but rather specific to Jasmine.

Community
  • 1
  • 1
Gabriel Kohen
  • 4,166
  • 4
  • 31
  • 46
0

May be for you not actual. But it may be useful for other people. You can try to use the next construction:

it('your test', function(done)){

if('user action or result of user action'){
console.log("Test is skiped");
done();
}
//other test's code
...................
done(); 
}
eva.eis
  • 36
  • 3
  • Tried this, doesn't work. `//other test's code' is still executed. But with your approach, you could simply `return` in the `if` branch to have an early exit without using the `done` function. – deviolog May 06 '18 at 22:10