protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Exclude tag doesn't work with Protractor 2.4.0

Open sautomation opened this issue 11 years ago • 9 comments

I initially had protractor 2.2.0 and I added the exclude tag for one of the test where Firefox was not supported. My tests were running fine and excluded tag was working as expected.

Then, I upgraded Protractor -version to 2.2.0 and when I ran my tests, I was getting your spec pattern didn't match any file message for Firefox browser tests. None of the tests were running on FF browser. However, Chrome was executing tests without any issues. Here is my Config file.

var HtmlReporter = require('protractor-html-screenshot-reporter');

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub', //desktop

    allScriptsTimeout: 30000,
    baseUrl: 'https://mycustomerfacingapp.com',
    swUrl: 'https://businessapp.com/',

    // frameworks to use
    frameworks: 'jasmine',

    //Capabilities to be passed to the webdriver instance.

    multiCapabilities: [{

        'browserName': 'chrome',
        'chromeOptions' : {
       args: ['--window-size=900,900']
            }, 
        specs: [
      '../tests/*.spec.js'
    ],   

     },

   {
        'browserName': 'firefox',
        'firefoxOptions' : {
       args: ['--window-size=900,900']
            }, 
       specs: [
      '../tests/*.spec.js'
    ],     

       exclude: ['../tests/MyIgnoreFFTest.spec.js'],

      // {
      //   'browserName': 'internet explorer'
    }],






    onPrepare: function () {
        //browser.driver.manage().window().maximize();
        jasmine.getEnv().addReporter(new HtmlReporter({
            baseDirectory: '/tmp/screenshots'
        }));

    },



    jasmineNodeOpts: {
        showColors: true,
        isVerbose: true,
        includeStackTrace: true,


    }

};

I downgraded to V2.2.0 to unblock myself.

sautomation avatar Oct 05 '15 20:10 sautomation

@juliemr you're more familiar with what's new

sjelin avatar Oct 06 '15 19:10 sjelin

Do you mean Protractor version 2.4.0? 2.2.4 is not a version we have.

juliemr avatar Oct 06 '15 19:10 juliemr

Yes. Sorry about that. That was a typo. Just corrected it

sautomation avatar Oct 06 '15 20:10 sautomation

I'm unable to reproduce this - exclude options inside multiConf work in all of our tests. See https://github.com/angular/protractor/blob/master/spec/unit/taskScheduler_test.js#L218.

I believe this is a duplicate of https://github.com/angular/protractor/issues/2551

juliemr avatar Oct 07 '15 04:10 juliemr

Hello Julie,

I am seeing this issue in 2.5.1. I have tried to set the configuration to match how it looks in your test, but the excluded test is still being run. This is the relevant snip of our config:

seleniumAddress: 'http://localhost:4444/wd/hub',

    specs: [
            'shell/shell.spec.js',
            'shell/shell-low-res.spec.js'
    ],

    multiCapabilities: [
        {
            'browserName': 'chrome',
            chromeOptions: {
                args: [
                    '--start-maximized'
                ]
            },

            exclude: 'shell/shell-low-res.spec.js'

        },
    ],

    singleRun: false,

    baseUrl: 'http://localhost',

Both tests from shell.spec.js and shell-low-res.spec.js are executed, despite the exclusion. I have tried setting exclude to an array, moving the specs inside the capability definition, removing the chromeOptions, and using capabilities instead of multiCapabilities.

Moving the exclude section outside of the multiCapabilities does work.

I do not receive a warning about spec patterns like sautomation did, but it looks like #2551 was fixed with 2.5.

Please let me know if you need any additional information. Thank you!

sschmidl avatar Dec 10 '15 23:12 sschmidl

I've noticed that the call to resolveFilePatterns here https://github.com/angular/protractor/blob/master/lib/taskScheduler.js#L49 does not pass the config.configDir. resolveFilePatterns will then default to using process.cwd() which in my case is a different directory than my config file's directory. It is still possible to match the file name, however when the filter looks at it, it will be comparing tests/e2e/shell/shell-low-res.spec.js to shell/shell-low-res.spec.js and won't filter on it as a result.

sschmidl avatar Dec 11 '15 00:12 sschmidl

I think that resolveFilePatterns is actually redundant, but I'm investigating.

sjelin avatar Dec 11 '15 21:12 sjelin

It was redundant

sjelin avatar Dec 12 '15 04:12 sjelin

Ah, I see what you mean. It was already called on allSpecs and capabilitiesSpecificSpecs so it would be redundant to call it again on the concatenation of the two. Nice catch!

sschmidl avatar Dec 14 '15 23:12 sschmidl