2015-02-05 2 views
1

셀렉늄 서버를 시작 명령을 사용하여 수동으로 별도의 창에서 시작하지 않고 자동으로 시작하는 방법을 알려주십시오. 먼저 서버를 시작한 다음 자동으로 실행되도록 테스트하고 싶습니다.분지기 또는 툴툴 거리기를 사용하여 셀렌을 시작하십시오.

이것은 내 conf 파일입니다. 당신이 실행

'use strict'; 
var global = { 
    app_files: { 
     specs: './specs/**/*.js' 
    }, 
    folders: { 
     specs: './specs' 
    } 
}; 
var gulp = require('gulp'); 
var jshint = require('gulp-jshint'); 
var stylish = require('jshint-stylish'); 
var beautify = require('gulp-jsbeautifier'); 
var protractor = require('gulp-protractor').protractor; 
// Download and update the selenium driver 
var webdriver_update = require('gulp-protractor').webdriver_update; 
var webdriver_standalone = require('gulp-protractor').webdriver_standalone; 
// Downloads the selenium webdriver 
gulp.task('webdriver_update', webdriver_update); 
// Runs the selenium webdriver 
gulp.task('webdriver_standalone', webdriver_standalone); 
// Lint spec files 
gulp.task('lint', function() { 
    return gulp.src(global.app_files.specs).pipe(jshint()).pipe(jshint.reporter(stylish)).pipe(jshint.reporter('fail')); 
}); 
// Beautify spec files 
gulp.task('beautify', function() { 
    return gulp.src(global.app_files.specs).pipe(beautify({ 
     config: '.jsbeautifyrc' 
    })).pipe(gulp.dest(global.folders.specs)); 
}); 
gulp.task('e2e:local', ['lint', 'webdriver_update'], function() { 
    gulp.src([global.app_files.specs], { 
     read: false 
    }).pipe(protractor({ 
     configFile: 'protractor.conf.js' 
    })).on('error', function(e) { 
     throw e; 
    }); 
}); 
gulp.task('e2e', ['e2e:local']); 

와 각도기에 - -

var HtmlReporter = require('protractor-html-screenshot-reporter'); 
    var path = require('path'); 
    // A reference configuration file. 
exports.config = { 
// ----- How to setup Selenium ----- 
// 
// There are three ways to specify how to use Selenium. Specify one of the 
// following: 
//webdriver-manager start --standalone 
// 1. seleniumServerJar - to start Selenium Standalone locally. 
// 2. seleniumAddress - to connect to a Selenium server which is already 
// running. 
// 3. sauceUser/sauceKey - to use remote Selenium servers via SauceLabs. 
seleniumAddress: 'http://localhost:4444/wd/hub', 
// The location of the selenium standalone server .jar file. 
seleniumServerJar: 'node_modules/protractor/selenium/selenium-server-standalone-2.40.0.jar', 
// The port to start the selenium server on, or null if the server should 
// find its own unused port. 
seleniumPort: null, 
// Chromedriver location is used to help the selenium standalone server 
// find chromedriver. This will be passed to the selenium jar as 
// the system property webdriver.chrome.driver. If null, selenium will 
// attempt to find chromedriver using PATH. 
chromeDriver: 'node_modules/grunt-protractor-runner/node_modules/protractor/node_modules/selenium-webdriver/', 
// Additional command line options to pass to selenium. For example, 
// if you need to change the browser timeout, use 
// seleniumArgs: ['-browserTimeout=60'], 
seleniumArgs: [], 

// If sauceUser and sauceKey are specified, seleniumServerJar will be ignored. 
// The tests will be run remotely using SauceLabs. 
sauceUser: null, 
sauceKey: null, 

// ----- What tests to run ----- 
// 
// Spec patterns are relative to the location of this config. 
specs: [ 
    'src/test/webapp/uitest/index.js' 
], 

// ----- Capabilities to be passed to the webdriver instance ---- 
// 
// For a full list of available capabilities, see 
// https://code.google.com/p/selenium/wiki/DesiredCapabilities 
// and 
// https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js 
capabilities: { 
    'browserName': 'chrome' 
}, 

// A base URL for your application under test. Calls to protractor.get() 
// with relative paths will be prepended with this. 
baseUrl: 'http://localhost:8081', 

// Selector for the element housing the angular app - this defaults to 
// body, but is necessary if ng-app is on a descendant of <body> 
rootElement: 'body', 

onPrepare: function() { 
    global.isAngularSite = function(flag) { 
     browser.ignoreSynchronization = !flag; 
    }; 
    // Add a reporter and store screenshots to `screnshots`: 
    jasmine.getEnv().addReporter(new HtmlReporter({ 
     baseDirectory: 'screenshots', 
     pathBuilder: function pathBuilder(spec, descriptions, results, capabilities) { 

      var monthMap = { 
       "1": "Jan", 
       "2": "Feb", 
       "3": "Mar", 
       "4": "Apr", 
       "5": "May", 
       "6": "Jun", 
       "7": "Jul", 
       "8": "Aug", 
       "9": "Sep", 
       "10": "Oct", 
       "11": "Nov", 
       "12": "Dec" 
      }; 

      var currentDate = new Date(), 
       currentHoursIn24Hour = currentDate.getHours(), 
       currentTimeInHours = currentHoursIn24Hour>12? currentHoursIn24Hour-12: currentHoursIn24Hour, 
       totalDateString = currentDate.getDate()+'-'+ monthMap[currentDate.getMonth()]+ '-'+(currentDate.getYear()+1900) + 
        '-'+ currentTimeInHours+'h-' + currentDate.getMinutes()+'m'; 

      return path.join(totalDateString,capabilities.caps_.browserName, descriptions.join('-')); 
     } 
    })); 
}, 

// ----- Options to be passed to minijasminenode ----- 
jasmineNodeOpts: { 
    // onComplete will be called just before the driver quits. 
    onComplete: null, 
    // If true, display spec names. 
    isVerbose: false, 
    // If true, print colors to the terminal. 
    showColors: true, 
    // If true, include stack traces in failures. 
    includeStackTrace: true, 
    // Default time to wait in ms before a test fails. 
    defaultTimeoutInterval: 60000 
}, 
}; 

나는이 오류 우리는이에 대한 꿀꺽를 사용

 [INFO] Running "protractor_webdriver:start" (protractor_webdriver) task 
     [INFO] Starting Selenium server 
     [INFO] Warning: Selenium Standalone is not present. Install with     
    webdriver-manager update --standalone 
    [INFO] Use --force to continue. 
[INFO] 
[INFO] Aborted due to warnings. 
+0

무시하도록 선가 생각

"protractor_webdriver을 : 시작"(protractor_webdriver) 작업 [INFO] Selenium 서버 시작 [정보] 경고 : Selenium 독립 실행 형이 없습니다. webdriver-manager 업데이트로 설치 - 스탠드 얼 [정보] --force를 사용하여 계속하십시오. [INFO] [INFO] 경고로 인해 중단되었습니다. – Yahiya

답변

1

을 얻고,이처럼 보이는 방법이다 gulpe2e : 로컬 및 specs 파일의 경로가 올바른지 확인하십시오.

이렇게하면됩니다. 당신은 꿀꺽 꿀꺽 마시는 것을 먼저 설치해야합니다!

+0

당신은'webdriver_standalone' 작업을 만들지 만 어디에서든지 사용하고 있습니까? 또는 e2e 테스트에서 seleniumServerJar를 사용합니까? – martin770

0

사용 중 seleniumAddress 또는 seleniumServerJar 나는 당신이 seleniumAddress를 사용하는 경우 그것이 내가이 오류를 [정보] 러닝 무엇입니까 seleniumServerJarseleniumPort

관련 문제