Skip to content

Commit

Permalink
Merge pull request #127 from mllrsohn/spawn_to_fork
Browse files Browse the repository at this point in the history
Spawn to fork
  • Loading branch information
Rahul Raut authored Mar 24, 2017
2 parents b3ccbc2 + 8fe9ebd commit 714f642
Show file tree
Hide file tree
Showing 14 changed files with 449 additions and 402 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* text=auto
* text=auto
55 changes: 36 additions & 19 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
{
"node": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"white": false
"node": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"trailing": true,
"smarttabs": true,
"white": false,
"globals": {
"after": false,
"afterEach": false,
"angular": false,
"before": false,
"beforeEach": false,
"browser": false,
"describe": false,
"expect": false,
"inject": false,
"strict": false,
"it": false,
"jasmine": false,
"spyOn": false,
"$": false,
"element": true,
"by": true
}
}
17 changes: 9 additions & 8 deletions example/Gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
var gulp = require('gulp');

// The protractor task
Expand All @@ -9,9 +10,9 @@ var webdriver_standalone = require('../').webdriver_standalone;
// Download and update the selenium driver
var webdriver_update = require('../').webdriver_update_specific;

// Downloads the selenium webdriver
// Downloads the selenium webdriver - stupid solution to pass extra args like ignore_ssl
gulp.task('webdriver_update', webdriver_update({
browsers: ['ignore_ssl']
browsers: ['ignore_ssl']
}));

// Start the standalone selenium server
Expand All @@ -21,10 +22,10 @@ gulp.task('webdriver_standalone', webdriver_standalone);


// Setting up the test task
gulp.task('protractor', ['webdriver_update'], function (cb) {
gulp.src(['example_spec.js']).pipe(protractor({
configFile: 'protractor.conf.js'
})).on('error', function (e) {
console.log(e)
}).on('end', cb);
gulp.task('protractor', ['webdriver_update'], function(cb) {
gulp.src(['example_spec.js']).pipe(protractor({
configFile: 'protractor.conf.js'
})).on('error', function(e) {
console.log(e);
}).on('end', cb);
});
50 changes: 25 additions & 25 deletions example/example_spec.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
describe('angularjs homepage', function() {
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');

element(by.model('yourName')).sendKeys('Julie');
element(by.model('yourName')).sendKeys('Julie');

var greeting = element(by.binding('yourName'));
var greeting = element(by.binding('yourName'));

expect(greeting.getText()).toEqual('Hello Julie!');
});
expect(greeting.getText()).toEqual('Hello Julie!');
});

describe('todo list', function() {
var todoList;
describe('todo list', function() {
var todoList;

beforeEach(function() {
browser.get('http://www.angularjs.org');
beforeEach(function() {
browser.get('http://www.angularjs.org');

todoList = element.all(by.repeater('todo in todoList.todos'));
});
todoList = element.all(by.repeater('todo in todoList.todos'));
});

it('should list todos', function() {
expect(todoList.count()).toEqual(2);
expect(todoList.get(1).getText()).toEqual('build an AngularJS app');
});
it('should list todos', function() {
expect(todoList.count()).toEqual(2);
expect(todoList.get(1).getText()).toEqual('build an AngularJS app');
});

it('should add a todo', function() {
var addTodo = element(by.model('todoList.todoText'));
var addButton = element(by.css('[value="add"]'));
it('should add a todo', function() {
var addTodo = element(by.model('todoList.todoText'));
var addButton = element(by.css('[value="add"]'));

addTodo.sendKeys('write a protractor test');
addButton.click();
addTodo.sendKeys('write a protractor test');
addButton.click();

expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
});
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
});
});
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"devDependencies": {
"gulp": "latest",
"jasmine": "^2.5.3",
"protractor": "latest"
}
}
41 changes: 23 additions & 18 deletions example/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
// An example configuration file.
// https://raw.github.com/angular/protractor/master/example/conf.js
exports.config = {
// The address of a running selenium server.
// Make sure you check the version in the folder
// seleniumServerJar: './selenium-server-standalone-3.2.0.jar',

// webdriver-start can start on default port 4444
//seleniumAddress: 'http://localhost:4444/wd/hub',

// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},

allScriptsTimeout: 40000,
directConnect: true,

// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
// The address of a running selenium server.
// Make sure you check the version in the folder
// seleniumServerJar: './selenium-server-standalone-3.2.0.jar',

// webdriver-start can start on default port 4444
//seleniumAddress: 'http://localhost:4444/wd/hub',

// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},

specs: ['example-spec.js'],

allScriptsTimeout: 60000,

// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
4 changes: 2 additions & 2 deletions example_2/Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ gulp.task('e2etests:webdriver_manager_update', 'updates the selenium server stan

gulp.task('e2etests:run', 'runs e2etests using protractor.conf', ['e2etests:server', 'e2etests:webdriver_manager_update'], function(cb) {

gulp.src(['tests/e2e/**/*.js'], { read:false })
gulp.src(['tests/e2e/**/*.js'], { read: false })
.pipe(gp.protractor({
configFile: 'protractor.conf.js',
args: ['--baseUrl', 'http://' + server.address().address + ':' + server.address().port]
})).on('error', function(e) {
server.close();
if(isCI) {
if (isCI) {
throw e;
} else {
console.log(e);
Expand Down
11 changes: 6 additions & 5 deletions example_2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"version": "0.0.1",
"description": "example for gulp protractor",
"scripts": {
"wd:update" : "webdriver-manager update",
"wd:start" : "webdriver-manager start",
"e2e" : "gulp e2etests:run"
"wd:update": "webdriver-manager update",
"wd:start": "webdriver-manager start",
"e2e": "gulp e2etests:run"
},
"devDependencies": {
"express": "3.5.0",
"gulp": "latest",
"gulp-help": "^1.6.1",
"gulp-protractor": "4.0.0",
"express": "3.5.0",
"gulp-protractor": "mllrsohn/gulp-protractor#spawn_to_fork",
"jasmine": "^2.5.3",
"yargs": "^1.2.1"
}
}
34 changes: 17 additions & 17 deletions example_2/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
exports.config = {
//seleniumAddress: 'http://localhost:4444/wd/hub',
//seleniumAddress: 'http://localhost:4444/wd/hub',

// seleniumServerJar: '../node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.2.0.jar',
// seleniumServerJar: '../node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.2.0.jar',

// Capabilities to be passed to the webdriver instance.
multiCapabilities: [
{
'browserName': 'chrome',
'maxInstances': 2,
shardTestFiles: true
}
],
// Capabilities to be passed to the webdriver instance.
multiCapabilities: [
{
'browserName': 'chrome',
'maxInstances': 2,
shardTestFiles: true
}
],

allScriptsTimeout: 60000,
allScriptsTimeout: 60000,

specs: ['./tests/e2e/**/*.js'],
specs: ['./tests/e2e/**/*.js'],

// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};

14 changes: 7 additions & 7 deletions example_2/tests/e2e/01-index-tests.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
describe('WebApp', function() {

describe('index page', function(){
describe('index page', function() {

browser.get('/');
browser.get('/');

it('should show the page', function() {
expect(element.all(by.css('h1')).
first().getText()).toBe("Headline 2");
});
it('should show the page', function() {
expect(element.all(by.css('h1')).
first().getText()).toBe("Headline 2");
});

});
});

});
50 changes: 25 additions & 25 deletions example_2/tests/e2e/02-example_spec.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
describe('angularjs homepage', function() {
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');

element(by.model('yourName')).sendKeys('Julie');
element(by.model('yourName')).sendKeys('Julie');

var greeting = element(by.binding('yourName'));
var greeting = element(by.binding('yourName'));

expect(greeting.getText()).toEqual('Hello Julie!');
});
expect(greeting.getText()).toEqual('Hello Julie!');
});

describe('todo list', function() {
var todoList;
describe('todo list', function() {
var todoList;

beforeEach(function() {
browser.get('http://www.angularjs.org');
beforeEach(function() {
browser.get('http://www.angularjs.org');

todoList = element.all(by.repeater('todo in todoList.todos'));
});
todoList = element.all(by.repeater('todo in todoList.todos'));
});

it('should list todos', function() {
expect(todoList.count()).toEqual(2);
expect(todoList.get(1).getText()).toEqual('build an AngularJS app');
});
it('should list todos', function() {
expect(todoList.count()).toEqual(2);
expect(todoList.get(1).getText()).toEqual('build an AngularJS app');
});

it('should add a todo', function() {
var addTodo = element(by.model('todoList.todoText'));
var addButton = element(by.css('[value="add"]'));
it('should add a todo', function() {
var addTodo = element(by.model('todoList.todoText'));
var addButton = element(by.css('[value="add"]'));

addTodo.sendKeys('write a protractor test');
addButton.click();
addTodo.sendKeys('write a protractor test');
addButton.click();

expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
});
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
});
});
Loading

0 comments on commit 714f642

Please sign in to comment.