简体   繁体   中英

How to exclude one or more e2e tests in Protractor

I have a bunch of e2e tests for my AngularJS web app. This is my current protractor.config.js file:

// __dirname retuns a path of this particular config file
// assuming that protractor.conf.js is in the root of the project
var basePath = __dirname;

exports.config = {

    specs: [
        "./Pages/ChartPicker/*.feature",
        "./Pages/Chart/*.feature"
    ],

    capabilities: {
        "browserName": "chrome"
    },

    framework           : "cucumber",

    getPageTimeout      : 20000,
    allScriptsTimeout   : 25000,

     params: {
        env         : "env-not-set",
        "env-dev"   : {
            baseUrl : "http://localhost:9001/"
        },
        "env-stage" : {
            baseUrl : "http://localhost:9020/"
        }
    },

    onPrepare: function () {
        // "relativePath" - path, relative to "basePath" variable
        global.requirePO = function (relativePath) {
            return require(basePath + '\\PageObjects\\' + relativePath + '.po.js');
        };

        global.requireHelper = function (relativePath) {
            return require(basePath + '\\UtilityJS\\' + relativePath + '.js');
        };
    }
};

How can I exclude one or more tests included in the .feature files?

In our protractor tests we use the xit functionality:

xit('should test something', function() {
}).pend('Will be implemented later');

This pends the test until you are ready, however we are using jasmine2 so I'm wondering if this functionality is available to you? As far as I know you cannot exclude tests in the config file specifically - only by hiving off the tests to a don't test directory and not including that in your config.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM