Protractor - run multiple tests in parallel on different browsers

前端 未结 6 1059
再見小時候
再見小時候 2020-12-05 09:47

I can\'t find any information on how to set this up, but it seems like a pretty basic concept, so I\'m sure there\'s an answer out there.

I know how to run protrac

6条回答
  •  隐瞒了意图╮
    2020-12-05 10:21

    Update Feb 2014 - This answer is no longer valid. Use Paolo Moretti's answer below.


    There may be a better way to do this but currently I am just executing these as concurrent Grunt tasks.

    1) Add the grunt concurrent plugin

    npm install grunt-concurrent --save-dev
    

    2) Add a task for each browser under grunt.initConfig. We can add the browser as an arg to re-use our configuration file.

    protractor: {
            options: {
                keepAlive: true,
                singleRun: false,
                configFile: "test/protractor.conf.js"
            },
            run_chrome: {
                options: {
                    args: {
                        browser: "chrome"
                    }
                }
            },
            run_firefox: {
                options: {
                    args: {
                        browser: "firefox"
                    }
                }
            }
        },
    

    3) Register these as tasks;

    grunt.registerTask('protractor-chrome', ['protractor:run_chrome']);
    grunt.registerTask('protractor-firefox', ['protractor:run_firefox']);
    

    4) Create your concurrent task under grunt.initConfig

    concurrent: {
            protractor_test: ['protractor-chrome', 'protractor-firefox']
        },
    

    5) Add the grunt task for concurrent

    grunt.registerTask('protractor-e2e', ['concurrent:protractor_test']);
    

    And executing that should give you concurrent protractor tests.

提交回复
热议问题