{"id":13624364,"url":"https://github.com/mllrsohn/gulp-protractor","last_synced_at":"2025-04-04T08:06:59.682Z","repository":{"id":12878136,"uuid":"15554605","full_name":"mllrsohn/gulp-protractor","owner":"mllrsohn","description":"gulp wrapper for protractor tests","archived":false,"fork":false,"pushed_at":"2022-10-25T21:01:57.000Z","size":18399,"stargazers_count":136,"open_issues_count":24,"forks_count":84,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-14T09:03:08.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mllrsohn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-31T18:12:32.000Z","updated_at":"2020-09-15T07:41:27.000Z","dependencies_parsed_at":"2022-08-26T07:01:37.184Z","dependency_job_id":null,"html_url":"https://github.com/mllrsohn/gulp-protractor","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mllrsohn%2Fgulp-protractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mllrsohn%2Fgulp-protractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mllrsohn%2Fgulp-protractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mllrsohn%2Fgulp-protractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mllrsohn","download_url":"https://codeload.github.com/mllrsohn/gulp-protractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142063,"owners_count":20890652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:41.775Z","updated_at":"2025-04-04T08:06:59.652Z","avatar_url":"https://github.com/mllrsohn.png","language":"JavaScript","funding_links":[],"categories":["Plugins","JavaScript","插件"],"sub_categories":["Testing","测试"],"readme":"# gulp-protractor [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]\n\n\u003e Run your [angular protractor](https://github.com/angular/protractor) tests with [gulp](https://github.com/wearefractal/gulp)\n\n## Usage\n\nFirst, install `gulp-protractor` as a development dependency:\n\n```shell\nnpm install --save-dev gulp-protractor\n```\n\nThen, add it to your `gulpfile.js`:\n\n```javascript\n\nvar protractor = require(\"gulp-protractor\").protractor;\n\ngulp.src([\"./src/tests/*.js\"])\n    .pipe(protractor({\n        configFile: \"test/protractor.config.js\",\n        args: [\n            '--baseUrl', 'http://127.0.0.1:8000',\n            '--suite', 'login',\n            '--params.environment', 'test'\n        ]\n    }))\n    .on('error', function(e) { throw e })\n```\n\n### Protractor Webdriver\n\nYou have to update and start a standalone selenium server. [Please read the offical instructions](https://github.com/angular/protractor#appendix-a-setting-up-a-standalone-selenium-server).\n\nYou can also ensure that the driver is installed by using the `webdriver_update` task. Have a look at the example folder.\n\nYou have 2 options to start the selenium server.\n\nThe first one is to let Protractor handle it automatically, including stopping it once your tests are done.\nTo do that, simply point to the selenium jar in the protractor config file (you will need to update the version number accordingly) instead of the address:\n\n```javascript\n\n  // The file path to the selenium server jar ()\n  seleniumServerJar: './node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.2.0.jar',\n  // seleniumAddress: 'http://localhost:4444/wd/hub',\n\n```\n\nThe second option is to let the gulp task handle it with the built-in webdriver snippet.\nIf you decide to start it that way, the task will keep running indefinitely.\n\n```javascript\nvar webdriver_standalone = require(\"gulp-protractor\").webdriver_standalone;\ngulp.task('webdriver_standalone', webdriver_standalone);\n```\n\n## API\n\n### protractor(options)\n\n#### options.configFile\n\nType: `String`\nDefault: `null`\n\nThe path to your protractor config\n\n#### options.args\n\nType: `Array`\nDefault: `[]`\n\nArguments get passed directly to the protractor call [Read the docs for more information](https://github.com/angular/protractor/blob/master/docs/getting-started.md#setup-and-config)\n\n#### options.debug\n\nType: `Boolean`\nDefault: `false`\n\nEnables Protractor's [debug mode](https://github.com/angular/protractor/blob/master/docs/debugging.md), which can be used to pause tests during execution and to view stack traces.\n\n### webdriver_update_specific(options)\n\n#### options.webDriverManagerArgs\n\nType: `Array`\nDefault: `[]`\n\n```javascript\n// Download and update the selenium driver\nvar webdriver_update = require('gulp-protractor').webdriver_update_specific;\n\n// Downloads the selenium webdriver - stupid solution to pass extra args like ignore_ssl\ngulp.task('webdriver_update', webdriver_update({\n    webdriverManagerArgs: ['--ignore_ssl']\n}));\n```\n\n## Running Protractor without a plugin\n\nIf you want to avoid using a plugin at all, here are gulp tasks which install the webdriver and start protractor:\n\nFirst install the protractor package:\n\n```npm install --save-dev protractor```\n\nThen add these tasks to your ```gulpfile.js```:\n\n```javascript\n\n// gulpfile.js should be in workspace root for this example\nvar gulp = require('gulp');\nvar path = require('path');\nvar child_process = require('child_process');\n\nfunction getProtractorBinary(binaryName){\n    var winExt = /^win/.test(process.platform)? '.cmd' : '';\n    var protractorBin = path.join('node_modules', '.bin', binaryName);\n    return path.join(protractorBin, winExt);\n}\n\ngulp.task('protractor-install', function(done){\n    child_process.spawn(getProtractorBinary('webdriver-manager'), ['update'], {\n        stdio: 'inherit'\n    }).once('close', done);\n});\n\ngulp.task('protractor-run', function (done) {\n    var argv = process.argv.slice(3); // forward args to protractor\n    child_process.spawn(getProtractorBinary('protractor'), argv, {\n        stdio: 'inherit'\n    }).once('close', done);\n});\n\n```\n\nYou can add command line arguments for protractor behind the gulp task:\n\n```gulp protractor-run --specs=runOnlyThisFile.js```\n\n\n## License\n\n[MIT License](http://en.wikipedia.org/wiki/MIT_License)\n\n[npm-url]: https://npmjs.org/package/gulp-protractor\n[npm-image]: https://badge.fury.io/js/gulp-protractor.png\n\n[travis-url]: http://travis-ci.org/mllrsohn/gulp-protractor\n[travis-image]: https://secure.travis-ci.org/mllrsohn/gulp-protractor.png?branch=master\n\n[depstat-url]: https://david-dm.org/mllrsohn/gulp-protractor\n[depstat-image]: https://david-dm.org/mllrsohn/gulp-protractor.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmllrsohn%2Fgulp-protractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmllrsohn%2Fgulp-protractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmllrsohn%2Fgulp-protractor/lists"}