vendredi 18 décembre 2015

multiCapabilities and jasmine focused tests

The Story:

We have a rather huge end-to-end protractor test codebase. We have two configs - one is "local" - to run the tests in Chrome and Firefox using directConnect, and the other one is "remote" - to run tests on a remote selenium server - BrowserStack in our case.

Our "local" config is configured to run some tests in Chrome and some in Firefox - because we really cannot run some tests in Chrome - for instance, keyboard shortcuts don't work in Chrome+Mac. Running the tests that require using keyboard shortcuts in Firefox is a workaround until the linked chromedriver issue is resolved.

Here is the relevant part of the configuration:

var firefox_only_specs = [
    "../specs/some_spec1.js",
    "../specs/some_spec2.js",
    "../specs/some_spec3.js"
];

exports.config = {
    directConnect: true,

    multiCapabilities: [
        {
            browserName: "chrome",
            chromeOptions: {
                args: ["incognito", "disable-extensions", "start-maximized"]
            },
            specs: [
                "../specs/**/*.spec.js",
                "../specs/**/**/*.spec.js",
                "../specs/**/**/**/*.spec.js"
            ],
            exclude: firefox_only_specs
        },
        {
            browserName: "firefox",
            specs: firefox_only_specs
        }
    ],

    // ...
};

The problem:

Now, the problem is that, if I'm debugging a single test, or want to run a single test - I'm marking it is as focused (via fdescribe/fit) - but protractor starts two driver sessions - one for Chrome and the other one for Firefox, using both configured capabilities:

Running "protractor:local" (protractor) task
[launcher] Running 2 instances of WebDriver

...
------------------------------------
[chrome #1] PID: 2329
[chrome #1] Using ChromeDriver directly...
[chrome #1] Spec started

...

------------------------------------
[firefox #2] PID: 2330
[firefox #2] Using FirefoxDriver directly...
[firefox #2] Spec started

...


The question:

Is there a way to tell protractor to use the only one capability that has a focused spec configured?


Using currently latest protractor 3.0.0.

Hope the question is clear. Let me know if you need any additional information.

Aucun commentaire:

Enregistrer un commentaire