我是詹金斯的新人。我想在詹金斯(Jenkins)工作中自动运行我的量角器测试。 而且Jenkins无法自动找到要更新的webdriver-manager。 这是我的protractor.confing.js:
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () { }
},
suites: {
full:'e2e/**/**/*.ts',
// smoke: 'e2e/tests/home/home.page-spec.ts ',
},
onPrepare() {
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
require('ts-node').register({
// project: 'e2e/tsconfig.e2e.json',
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
savePath: './e2e/report',
screenshotsFolder: 'images'
}));
}
};
这是我的package.js文件:
{
"name": "ui",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "5.2.0",
"@angular/common": "5.2.0",
"@angular/compiler": "5.2.0",
"@angular/core": "5.2.0",
"@angular/forms": "5.2.0",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.0",
"@angular/platform-browser-dynamic": "5.2.0",
"@angular/router": "5.2.0",
"bootstrap": "4.1.1",
"core-js": "2.4.1",
"jquery": "3.3.1",
"ngx-bootstrap": "^3.0.1",
"popper.js": "^1.14.3",
"protractor-jasmine2-html-reporter": "0.0.7",
"protractor-jasmine2-reporter": "^1.1.0",
"protractor-jasmine2-screenshot-reporter": "^0.5.0",
"rxjs": "5.5.6",
"zone.js": "0.8.19"
},
"devDependencies": {
"@angular/cli": "1.7.3",
"@angular/compiler-cli": "5.2.0",
"@angular/language-service": "5.2.0",
"@types/jasmine": "2.8.3",
"@types/jasminewd2": "2.0.2",
"@types/node": "6.0.60",
"codelyzer": "4.0.1",
"jasmine-core": "2.8.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "2.0.2",
"karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "1.2.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"protractor": "5.3.2",
"ts-node": "4.1.0",
"tslint": "5.9.1",
"typescript": "2.5.3"
}
}
在我的Jenkins工作中,我从BitBucket存储库中提取代码。然后执行Windows批处理命令:
我在控制台中出错:
Started by user Admin
Building in workspace C:\Program Files (x86)\Jenkins\workspace\newGen_protractor
> C:\Program Files\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> C:\Program Files\Git\bin\git.exe config remote.origin.url https://___somi@bitbucket.org/night_riders/desingstudio_new_gen.git # timeout=10
Fetching upstream changes from https://___somi@bitbucket.org/night_riders/desingstudio_new_gen.git
> C:\Program Files\Git\bin\git.exe --version # timeout=10
using GIT_ASKPASS to set credentials
> C:\Program Files\Git\bin\git.exe fetch --tags --progress https://___somi@bitbucket.org/night_riders/desingstudio_new_gen.git +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/application.properties
Seen branch in repository origin/develop
Seen branch in repository origin/features/conf_view_changes
Seen branch in repository origin/master
Seen 4 remote branches
> C:\Program Files\Git\bin\git.exe show-ref --tags -d # timeout=10
Checking out Revision 7be6f493b7de7a1d78fdc66db21a85f58db4f50b (origin/application.properties)
> C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10
> C:\Program Files\Git\bin\git.exe checkout -f 7be6f493b7de7a1d78fdc66db21a85f58db4f50b
Commit message: "protractor"
> C:\Program Files\Git\bin\git.exe rev-list --no-walk 7be6f493b7de7a1d78fdc66db21a85f58db4f50b # timeout=10
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins1838595441649612146.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>npm install
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN @angular/http@5.2.11 requires a peer of @angular/core@5.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@5.2.11 requires a peer of @angular/platform-browser@5.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-bootstrap@3.0.1 requires a peer of @angular/common@>=6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-bootstrap@3.0.1 requires a peer of @angular/core@>=6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package protractor is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
audited 7457 packages in 66.478s
found 20 vulnerabilities (2 low, 12 moderate, 6 high)
run `npm audit fix` to fix them, or `npm audit` for details
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins2673585650827143440.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>npm -g install protractor
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\protractor -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\protractor\bin\protractor
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\webdriver-manager -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
+ protractor@5.4.1
updated 1 package in 18.687s
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins3055133064298792255.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>npm install -g @angular/cli
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\ng -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\@angular\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ @angular/cli@6.2.2
updated 6 packages in 61.913s
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins3326917024779106456.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>npm i jasmine-spec-reporter
npm WARN @angular/http@5.2.11 requires a peer of @angular/core@5.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@5.2.11 requires a peer of @angular/platform-browser@5.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-bootstrap@3.0.1 requires a peer of @angular/common@>=6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-bootstrap@3.0.1 requires a peer of @angular/core@>=6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package protractor is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ jasmine-spec-reporter@4.2.1
updated 1 package and audited 7457 packages in 37.074s
found 20 vulnerabilities (2 low, 12 moderate, 6 high)
run `npm audit fix` to fix them, or `npm audit` for details
[newGen_protractor] $ cmd /c call C:\Windows\TEMP\jenkins1987663965716966083.bat
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor>cd NewGenProject/ui/
C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui>ng e2e
Your global Angular CLI version (6.2.1) is greater than your local
version (1.7.3). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
** NG Live Development Server is listening on localhost:49156, open your browser on http://localhost:49156/ **
[0mDate: [1m[37m2018-09-16T13:31:53.250Z[39m[22m[0m
[0mHash: [1m[37mb824d4ffc831966e2310[39m[22m[0m
[0mTime: [1m[37m46284[39m[22mms[0m
[0mchunk {[1m[33minline[39m[22m} [1m[32minline.bundle.js, inline.bundle.js.map[39m[22m (inline) 3.89 kB [1m[33m[entry][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mmain[39m[22m} [1m[32mmain.bundle.js, main.bundle.js.map[39m[22m (main) 240 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mpolyfills[39m[22m} [1m[32mpolyfills.bundle.js, polyfills.bundle.js.map[39m[22m (polyfills) 203 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mscripts[39m[22m} [1m[32mscripts.bundle.js, scripts.bundle.js.map[39m[22m (scripts) 158 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mstyles[39m[22m} [1m[32mstyles.bundle.js, styles.bundle.js.map[39m[22m (styles) 158 kB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
[0mchunk {[1m[33mvendor[39m[22m} [1m[32mvendor.bundle.js, vendor.bundle.js.map[39m[22m (vendor) 6.04 MB [1m[33m[initial][39m[22m[1m[32m [rendered][39m[22m[0m
(node:2336) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
Cannot automatically find webdriver-manager to update.
Update webdriver-manager manually and run 'ng e2e --no-webdriver-update' instead.
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE