Integrating Protractor with Yeoman via Grunt

后端 未结 3 1648
有刺的猬
有刺的猬 2020-12-04 12:11

I want to integrate Protractor with a scaffold produced by Yeoman. I followed a tutorial and therein, the older scenario-runner was used for setting up e2e test

3条回答
  •  半阙折子戏
    2020-12-04 13:08

    As @user2172816 mentions in their answer - leaving out seleniumAddress: 'http://localhost:4444/wd/hub' from your protractor config will usually cause Protractor to start a Selenium instance for you.

    As an alternative, you could use grunt-protractor-webdriver to start Selenium:

    1) Install and save grunt-protractor-webdriver

    npm install grunt-protractor-webdriver --save-dev
    

    2) Add the following into your Grunt definition function:

    grunt.loadNpmTasks('grunt-protractor-webdriver');
    

    3) Add the following example protractor webdriver task:

    protractor_webdriver: {
            start: {
                options: {
                    path: 'node_modules/protractor/bin/',
                    command: 'webdriver-manager start'
                }
            }
        }
    

    4) Add protractor_webdriver to your test task before running protractor e.g.

    grunt.registerTask('test', [
        'clean:server',
        'concurrent:test',
        'autoprefixer',
        'connect:test',
        'karma',
        'protractor_webdriver',
        'protractor:run'
    ]);
    

提交回复
热议问题