Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet Explorer Selenium protractor e2e tests

I would like to add to our CI build process some e2e tests. I have already added them against chrome + firefox (as the simplest ones). But I really want to do it for several IE versions. How is it possible to inject it in build process on linux/mac?

I found such article: http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/

But looks like it is not 100% what I need. Could some one provide a simple configuration sample?

like image 239
Sergey Teplyakov Avatar asked Oct 20 '22 22:10

Sergey Teplyakov


People also ask

Can we integrate protractor with selenium?

Protractor make use of Selenium Grid to initialize, control and run browser instance. Can easily integrate with jasmine, mocha and cucumber framework to write your test.

How do I install selenium protractor?

To install and start the standalone Selenium Server manually, use the webdriver-manager command line tool, which comes with Protractor. Run the update command: webdriver-manager update This will install the server and ChromeDriver. Run the start command: webdriver-manager start This will start the server.


1 Answers

You would need a selenium server, either your own, or at browserstack/SauceLabs. If you are planning to do it on your own, in short, you would need to setup a selenium grid and register nodes, one of the nodes should be a windows machine where you would run tests against IE.

Personally, I've been successfully running protractor e2e tests on multiple browsers including different Chrome, Firefox and IE versions on browserstack. Here's the configuration I use (it also includes jasmine junit reporter, needed this for the CI):

'use strict';

var browserstackUser = 'user';
var browserstackKey = 'key';

exports.config = {
    multiCapabilities: [
        {
            'browserstack.user': browserstackUser,
            'browserstack.key': browserstackKey,
            'browserstack.local': 'true',
            'browserstack.debug': 'true',

            'browserName': 'Chrome',
            'os': 'Windows',
            'os_version': '8',
            'resolution': '1024x768',

            specs: [
                '*.spec.js'
            ],
            exclude: [
                'footer.disabledCookies.spec.js'
            ]
        },

        {
            'browserstack.user': browserstackUser,
            'browserstack.key': browserstackKey,
            'browserstack.local': 'true',
            'browserstack.debug': 'true',

            'browser': 'Internet Explorer',
            'browser_version': '8.0',
            'os': 'Windows',
            'os_version': '7',
            'resolution': '1024x768',

            specs: [
                '*.spec.js'
            ]
        },

        {
            'browserstack.user': browserstackUser,
            'browserstack.key': browserstackKey,
            'browserstack.local': 'true',
            'browserstack.debug': 'true',

            'browserName': 'Internet Explorer',
            'browser_version': '9.0',
            'os': 'Windows',
            'os_version': '7',
            'resolution': '1024x768',

            specs: [
                '*.spec.js'
            ],
            exclude: [
                'footer.disabledCookies.spec.js'
            ]
        }
    ],

    // Browserstack's selenium server address
    seleniumAddress: 'http://hub.browserstack.com/wd/hub',

    framework: 'jasmine',

    allScriptsTimeout: 300000,

    baseUrl: 'http://localhost:9001',

    onPrepare: function () {
        require('jasmine-reporters');
        var capsPromise = browser.getCapabilities();
        capsPromise.then(function (caps) {
            var browserName = caps.caps_.browserName.toUpperCase();
            var browserVersion = caps.caps_.version;
            var prePendStr = browserName + "-" + browserVersion + "-";
            jasmine.getEnv().addReporter(new
                jasmine.JUnitXmlReporter("test-results", true, true, prePendStr));
        });
    },

    jasmineNodeOpts: {
        showColors: true,
        isVerbose: true,
        includeStackTrace: true,
        defaultTimeoutInterval: 3600000
    }
};
like image 104
alecxe Avatar answered Oct 22 '22 23:10

alecxe