Saat ini saya sedang mencoba menggabungkan beberapa tes Busur Derajat E2E ke dalam grunt. Sejauh ini, belum begitu berhasil. Semua dokumen yang saya temukan mengatakan bahwa grunt cocok untuk situasi saya. Namun, setelah menjalankan webdriver-manager update --standalone
, grunt keluar tanpa pesan kesalahan atau menjalankan tugas lainnya.
file Grunt saya:
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
protractor: {
options: {
configFile: "./conf.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
}
},
all: {} // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
},
protractor_webdriver: {
update : {
options: {
path:'node_modules/.bin/',
command: ['webdriver-manager update --standalone']
},
},
e2eStart: {
options: {
keepAlive: true,
path:'node_modules/.bin/',
command: ['webdriver-manager start']
},
},
}
});
grunt.registerTask('default', ['protractor_webdriver:update', 'protractor_webdriver:e2eStart', 'protractor:all']);
grunt.loadNpmTasks('grunt-protractor-webdriver');
grunt.loadNpmTasks('grunt-protractor-runner');
};
Karena seseorang mungkin penasaran: paket.json
{
"name": "Protractor-me",
"description": "Protractor-me!",
"version": "0.0.1",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-protractor-runner": "~2.0.0",
"grunt-protractor-webdriver": "~0.2.0",
"jasmine-reporters": "^2.0.7"
},
"install": {}
}
Dan terakhir, keluaran grunt --verbose
$ grunt --verbose
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-protractor-webdriver" local Npm module tasks.
Reading /Users/brianalbright/workspace/qa/personal/Brian/Angular/feed_editor_2/node_modules/grunt-protractor-webdriver/package.json...OK
Parsing /Users/brianalbright/workspace/qa/personal/Brian/Angular/feed_editor_2/node_modules/grunt-protractor-webdriver/package.json...OK
Loading "protractor_webdriver.js" tasks...OK
+ protractor_webdriver
Registering "grunt-protractor-runner" local Npm module tasks.
Reading /Users/brianalbright/workspace/qa/personal/Brian/Angular/feed_editor_2/node_modules/grunt-protractor-runner/package.json...OK
Parsing /Users/brianalbright/workspace/qa/personal/Brian/Angular/feed_editor_2/node_modules/grunt-protractor-runner/package.json...OK
Loading "protractor_runner.js" tasks...OK
+ protractor
Loading "Gruntfile.js" tasks...OK
+ default
No tasks specified, running default tasks.
Running tasks: default
Running "default" task
Running "protractor_webdriver:update" (protractor_webdriver) task
Verifying property protractor_webdriver.update exists in config...OK
File: [no files]
Options: path="node_modules/.bin/", command=["webdriver-manager update --standalone"], keepAlive=false
Starting Selenium server
>> selenium standalone is up to date.
>> chromedriver is up to date.
$
Ini menjalankan pembaruan webdriver-manager, lalu berhenti. Menurut pemahaman saya, setiap tugas harus berjalan secara berurutan, dan tidak berhenti sampai tugas tersebut berakhir atau terjadi kesalahan. Saya kehabisan ide!