Setting up Continuous Integration of Protractor using Jenkins

后端 未结 5 1271
走了就别回头了
走了就别回头了 2020-12-04 12:26

I am writing automation test scripts using Protractor and now I need to set up the CI for this using Jenkins.

Tasks it needs to perform are:

  1. Starting t
5条回答
  •  醉话见心
    2020-12-04 12:43

    Alternatively, you could run this as a Grunt Task. First install grunt on Jenkins. Install the NPM packages for protractor_webdriver and protractor. Setup the configuration file to point the the node_module path and config file paths.

    http://sideroad.secret.jp/articles/grunt-on-jenkins/

    Then install protractor node modules. The Gruntfile would look similar to this. I created a test directory where the conf and spec files would be located.

    module.exports = function (grunt) {
      grunt.initConfig({
        protractor_webdriver: {
            your_target: {
                options: {
                    path: 'node_modules/protractor/bin/',
                    command: 'webdriver-manager start'
                }
            }
        }, 
        protractor: {
            options: {
                configFile: "node_modules/protractor/referenceConf.js", // Default config file
                keepAlive: true, // If false, the grunt process stops when the test fails.
                noColor: false, // If true, protractor will not use colors in its output.
                args: {
                // Arguments passed to the command
                }
            },
            your_target: {
                options: {
                    configFile: "test/conf.js", // Target-specific config file
                    args: {} // Target-specific arguments
                }
            }
        }
    });
    
    grunt.registerTask('p:test', [
        'protractor_webdriver',
        'protractor'
    ]);  
    });
    

提交回复
热议问题