Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/gavin/workspace/happymandarin/node_modules/gulp-protractor/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gavin/workspace/happymandarin/node_modules/gulp-protractor/test/main.js
/*global describe, it*/
'use strict';

var fs = require('fs'),
  es = require('event-stream'),
  expect = require('expect.js'),
  sinon = require('sinon'),
  path = require('path');

require('mocha');

var gutil = require('gulp-util'),
  protractor = require('../').protractor,
  webdriver = require('../').webdriver,
  getProtractorDir = require('../').getProtractorDir,
  child_process = require('child_process'),
  events = require('events');

var winExt = /^win/.test(process.platform)?'.cmd':'';


describe('gulp-protractor: getProtractorDir', function() {

  it('should find the protractor installation', function(done) {
    expect(getProtractorDir()).to.equal(path.resolve('./node_modules/.bin'));
    done();
  });
});

describe('gulp-protractor: protractor', function() {

  it('should pass in the args into the protractor call', function(done) {
    var fakeProcess = new events.EventEmitter();
    var spy = sinon.stub(child_process, 'spawn', function(cmd, args, options) {

      expect(path.basename(cmd)).to.equal('protractor' + winExt);
      expect(path.basename(args[0])).to.equal('protractor.config.js');
      expect(args[1]).to.equal('--browser');
      expect(args[2]).to.equal('Chrome');
      expect(args[3]).to.equal('--chrome-only');
      child_process.spawn.restore();
      done();

      return new events.EventEmitter();
    });
    var srcFile = new gutil.File({
      path: 'test/fixtures/test.js',
      cwd: 'test/',
      base: 'test/fixtures',
      contents: null
    });

    var stream = protractor({
      configFile: 'test/fixtures/protractor.config.js',
      args: [
        '--browser', 'Chrome',
        '--chrome-only'
      ]
    });

    stream.write(srcFile);
    stream.end();
  });

  it('should pass the test-files to protractor via arg', function(done) {
    var fakeProcess = new events.EventEmitter();
    var spy = sinon.stub(child_process, 'spawn', function(cmd, args, options) {

      expect(path.basename(cmd)).to.equal('protractor'+winExt);
      expect(path.basename(args[0])).to.equal('protractor.config.js');
      expect(args[1]).to.equal('--specs');
      expect(args[2]).to.equal('test/fixtures/test.js');

      child_process.spawn.restore();
      done();

      return new events.EventEmitter();
    });

    var srcFile = new gutil.File({
      path: 'test/fixtures/test.js',
      cwd: 'test/',
      base: 'test/fixtures',
      contents: null
    });

    var stream = protractor({
      configFile: 'test/fixtures/protractor.config.js'
    });

    stream.write(srcFile);
    stream.end();

  });

  it('shouldnt pass the test-files to protractor if there are none', function(done) {
    var spy = sinon.stub(child_process, 'spawn', function(cmd, args, options) {

      expect(path.basename(cmd)).to.equal('protractor'+winExt);
      expect(path.basename(args[0])).to.equal('protractor.config.js');
      expect(args[1]).to.be(undefined);
      expect(args[2]).to.be(undefined);

      child_process.spawn.restore();
      done();

      return new events.EventEmitter();
    });

    var srcFile = new gutil.File({
      path: 'test/fixtures/test.js',
      cwd: 'test/',
      base: 'test/fixtures',
      contents: null
    });

    var stream = protractor({
      configFile: 'test/fixtures/protractor.config.js'
    });

    stream.end();

  });

  it('should propogate protractor exit code', function(done) {
    var fakeProcess = new events.EventEmitter();
    var spy = sinon.stub(child_process, 'spawn', function(cmd, args, options) {
      child_process.spawn.restore();
      process.nextTick(function() { fakeProcess.emit('exit', 255) });
      fakeProcess.kill = function() {};
      return fakeProcess;
    });

    var srcFile = new gutil.File({
      path: 'test/fixtures/test.js',
      cwd: 'test/',
      base: 'test/fixtures',
      contents: null
    });

    var stream = protractor({
      configFile: 'test/fixtures/protractor.config.js'
    });

    stream.write(srcFile);
    stream.end();
    stream.on('error', function(err) {
      done();
    });
  });
});


describe('gulp-protractor: webdriver', function() {

  it.skip('should call update and then start on the webdriver-manager', function(done) {

    var fakeProcess = new events.EventEmitter();
    var seconds_call = false;
    var spy = sinon.stub(child_process, 'spawn', function(cmd, args, options) {
      expect(path.basename(cmd)).to.equal('webdriver-manager'+winExt);
      if (!seconds_call) {
        expect(args[0]).to.equal('update');
      } else {
        expect(args[0]).to.equal('start');
        child_process.spawn.restore();
        done();
      }
      return fakeProcess;
    });

    var wd = webdriver();
    setTimeout(function() {
      seconds_call = true;
      fakeProcess.emit('close');
    }, 100);


  });

  // it('should propogate protractor exit code', function(done) {
  //     var fakeProcess = new events.EventEmitter();
  //     var spy = sinon.stub(child_process, 'spawn', function(cmd, args, options) {
  //         child_process.spawn.restore();
  //         process.nextTick(function() { fakeProcess.emit('exit', 255) });
  //         fakeProcess.kill = function() {};
  //         return fakeProcess;
  //     });

  //     var srcFile = new gutil.File({
  //         path: 'test/fixtures/test.js',
  //         cwd: 'test/',
  //         base: 'test/fixtures',
  //         contents: null
  //     });

  //     var stream = protractor({
  //         configFile: 'test/fixtures/protractor.config.js'
  //     });

  //     stream.write(srcFile);
  //     stream.end();
  //     stream.on('error', function(err) {
  //         done();
  //     });
  // });
});

Youez - 2016 - github.com/yon3zu
LinuXploit