4

I have my protractor scripts running. But on my current scenario, to run the tests it is needed to run each .js individually. I want to pack all the test files into one or pack all the test files into an executable (what it would be ideal because it won't be needed to have protractor installed on all the machines running the tests.

I appreciate any suggestions.

2
  • Why is it needed to run each individually ? Mar 25, 2020 at 9:29
  • Please add how you start your protractor server, do you do protractor conf.js and leave it running while running tests via another window/session ? Mar 25, 2020 at 11:00

2 Answers 2

0

You can adjust config to run all your tests:

For instance if you have todo-spec.js and todo-new-spec.js you can run both of them with:

exports.config = { 
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['*-spec.js']
};

As for running protractor without having protractor, not sure about that.

Example that I tried to show this:

enter image description here

11
  • I put specs:['*spec.js'], as you suggested and then I got: W/configParser - pattern *spec.js did not match any files. Is this syntax correct? Mar 25, 2020 at 9:46
  • 1
    Ah directory tests. Maybe ['./tests/*spec.js'] would work Mar 25, 2020 at 11:23
  • 1
    @IngriddBrito is your spec files under the same directory as config file , else you have to provide full path or /**/*js
    – PDHide
    Mar 25, 2020 at 11:24
  • 1
    Look to use blahblah.test.js or blahblah.spec.js for your filenames and then you'll be able to wildcard them appropriately. I suggest using originalFileName.test.js and keeping it in the same directory. This is a personal recommendation. i like to see the test right next to the code. Another directory starts to push it apart. Others will disagree with this. Mar 25, 2020 at 11:25
  • 1
    +1 to PDHide for the ** option. More at stackoverflow.com/a/28199633/631619 Mar 25, 2020 at 11:27
1

We may organise tests in the form of suites(inside conf.js):

For instance, you may have suites for different types of functionality of your application, homepage, search etc:

suites: {
  homepage: 'tests/e2e/homepage/**/*Spec.js',
  search: [
    'tests/e2e/contact_search/**/*Spec.js',
    'tests/e2e/venue_search/**/*Spec.js'
  ] 
},

And/or, you may have specs grouped into suites by the type of tests:

suites: {
  smoke: 'tests/e2e/smoke/*.js',
  performance: 'tests/e2e/performance/*.js'
},

and execute them something like:

$ protractor conf.js --suite smoke

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.