Skip to content

Commit

Permalink
Updated versions of packages and added new test that will be skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenzitron committed Dec 30, 2016
1 parent 1ff548d commit 4229b22
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 24 deletions.
27 changes: 14 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var fs = require('fs'),
mkdirp = require('mkdirp'),
_ = require('lodash'),
path = require('path'),
async = require('async'),
hat = require('hat');

require('string.prototype.startswith');
Expand Down Expand Up @@ -142,6 +143,7 @@ function Jasmine2HTMLReporter(options) {
spec._suite = currentSuite;
currentSuite._specs.push(spec);
};

self.specDone = function(spec) {
spec = getSpec(spec);
spec._endTime = new Date();
Expand All @@ -159,19 +161,17 @@ function Jasmine2HTMLReporter(options) {
spec.screenshot = sanitizeFilename(spec.description) + '.png';

browser.takeScreenshot().then(function (png) {
browser.getCapabilities().then(function (capabilities) {
var screenshotPath;


//Folder structure and filename
screenshotPath = path.join(self.savePath + self.screenshotsFolder, spec.screenshot);

mkdirp(path.dirname(screenshotPath), function (err) {
if (err) {
throw new Error('Could not create directory for ' + screenshotPath);
}
writeScreenshot(png, screenshotPath);
});
var screenshotPath = path.join(
self.savePath,
self.screenshotsFolder,
spec.screenshot
);

mkdirp(path.dirname(screenshotPath), function (err) {
if (err) {
throw new Error('Could not create directory for ' + screenshotPath);
}
writeScreenshot(png, screenshotPath);
});
});
}
Expand All @@ -187,6 +187,7 @@ function Jasmine2HTMLReporter(options) {
suite._endTime = new Date();
currentSuite = suite._parent;
};

self.jasmineDone = function() {
if (currentSuite) {
// focused spec (fit) -- suiteDone was never called
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"repository": {
"type": "git",
"url": "https://github.com/Kenzitron/protractor-jasmine2-html-reporter"
"url": "https://github.com/Kenzitron/protractor-jasmine2-html-reporter",
"postinstall": "./node_modules/protractor/bin/webdriver-manager update"
},
"keywords": [
"jasmine2",
Expand All @@ -27,13 +28,14 @@
"url": "https://github.com/Kenzitron/protractor-jasmine2-html-reporter/issues"
},
"dependencies": {
"hat": "0.0.3",
"lodash": "^4.0.0",
"async": "^2.1.4",
"hat": "^0.0.3",
"lodash": "^4.17.0",
"mkdirp": "^0.5.0",
"string.prototype.startswith": "^0.2.0"
},
"devDependencies": {
"jasmine": "^2.4.1",
"protractor": "^3.1.1"
"jasmine": "^2.5.2",
"phantomjs": "^2.1.7"
}
}
15 changes: 9 additions & 6 deletions protractor.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@ exports.config = {

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

directConnect: true,
//directConnect: true,

specs: ['test/**/*[sS]pec.js'],

onPrepare: function() {

var Jasmine2HtmlReporter = require('./index.js');
return global.browser.getProcessedConfig().then(function (config) {
var Jasmine2HtmlReporter = require('./index.js');

jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
savePath: './test/reports/'
}));
});

jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
savePath: './test/reports/'
}));

}
};
29 changes: 29 additions & 0 deletions test/test3Spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
xdescribe('SPEC 2', function() {

it('2 should add a todo', function() {
browser.get('http://www.angularjs.org');

element(by.model('todoList.todoText')).sendKeys('write a protractor test');
element(by.css('[value="add"]')).click();

var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.count()).toEqual(6); //Failure
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});

it('2 second it', function() {
browser.get('http://www.angularjs.org');

element(by.model('todoList.todoText')).sendKeys('write a protractor test');
element(by.css('[value="add"]')).click();

var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.count()).toEqual(3);
expect(todoList.count()).toEqual(3);
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});

});

0 comments on commit 4229b22

Please sign in to comment.