diff --git a/front/src/css/index.css b/front/src/css/index.css
index fa05717..8bcc1ff 100644
--- a/front/src/css/index.css
+++ b/front/src/css/index.css
@@ -34,7 +34,8 @@
font-size: 1em;
}
.settings input[type=text],
-.settings input[type=password] {
+.settings input[type=password],
+.settings textarea {
width: 100%;
min-width: 4em;
}
diff --git a/front/src/js/services/apiService.js b/front/src/js/services/apiService.js
index 0482748..95aad1e 100644
--- a/front/src/js/services/apiService.js
+++ b/front/src/js/services/apiService.js
@@ -14,20 +14,22 @@ apiService.factory('API', ['$location', 'Runs', 'Results', function($location, R
waitForSelector: settings.waitForSelector,
cookie: settings.cookie,
authUser: settings.authUser,
- authPass: settings.authPass
+ authPass: settings.authPass,
+ blockDomain: settings.blockDomain,
+ allowedDomains: settings.allowedDomains,
+ noExternals: settings.noExternals
};
- if (settings.waitForSelector && settings.waitForSelector !== '') {
- runObject.waitForSelector = settings.waitForSelector;
- }
-
- if (settings.cookie && settings.cookie !== '') {
- runObject.cookie = settings.cookie;
- }
-
- if (settings.authUser && settings.authUser !== '' && settings.authPass && settings.authPass !== '') {
- runObject.authUser = settings.authUser;
- runObject.authPass = settings.authPass;
+
+ if (settings.domainsBlackOrWhite === 'black') {
+ runObject.blockDomain = this.parseDomains(settings.domains);
+ } else if (settings.domainsBlackOrWhite === 'white') {
+ var allowedDomains = this.parseDomains(settings.domains);
+ if (allowedDomains.length > 0) {
+ runObject.allowDomain = allowedDomains;
+ } else {
+ runObject.noExternals = true;
+ }
}
Runs.save(runObject, function(data) {
@@ -43,6 +45,17 @@ apiService.factory('API', ['$location', 'Runs', 'Results', function($location, R
relaunchTest: function(result) {
this.launchTest(result.params.url, result.params.options);
+ },
+
+ parseDomains: function(textareaContent) {
+ var lines = textareaContent.split('\n');
+
+ function removeEmptyLines (line) {
+ return line.trim() !== '';
+ }
+
+ // Remove empty lines
+ return lines.filter(removeEmptyLines).join(',');
}
};
diff --git a/front/src/less/index.less b/front/src/less/index.less
index 5c665b4..bbc8b4d 100644
--- a/front/src/less/index.less
+++ b/front/src/less/index.less
@@ -38,7 +38,7 @@
font-size: 1em;
}
- input[type=text], input[type=password] {
+ input[type=text], input[type=password], textarea {
width: 100%;
min-width: 4em;
}
diff --git a/front/src/views/dashboard.html b/front/src/views/dashboard.html
index f5dfa2c..430af91 100644
--- a/front/src/views/dashboard.html
+++ b/front/src/views/dashboard.html
@@ -1,6 +1,13 @@
+
+
Global score
diff --git a/front/src/views/index.html b/front/src/views/index.html
index ada6eca..a72bb2a 100644
--- a/front/src/views/index.html
+++ b/front/src/views/index.html
@@ -61,15 +61,22 @@
-
+
diff --git a/lib/metadata/policies.js b/lib/metadata/policies.js
index f8fae98..bcc0f59 100644
--- a/lib/metadata/policies.js
+++ b/lib/metadata/policies.js
@@ -281,6 +281,8 @@ var policies = {
if (value.indexOf('1.12.') === 0 ||
value.indexOf('2.2.') === 0 ||
+ value.indexOf('1.13.') === 0 ||
+ value.indexOf('2.3.') === 0 ||
value.indexOf('3.0.') === 0 ||
value.indexOf('3.1.') === 0) {
score = 100;
diff --git a/lib/runner.js b/lib/runner.js
index 977355c..4c5daf2 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -66,9 +66,14 @@ var Runner = function(params) {
delete data.toolsResults.phantomas.metrics.scrollExecutionTree;
delete data.toolsResults.phantomas.offenders.scrollExecutionTree;
+
+ if (data.toolsResults.phantomas.offenders.blockedRequests) {
+ data.blockedRequests = data.toolsResults.phantomas.offenders.blockedRequests;
+ }
+
+
// Finished!
deferred.resolve(data);
-
})
.fail(function(err) {
diff --git a/lib/server/controllers/apiController.js b/lib/server/controllers/apiController.js
index a2addbf..28ecd81 100644
--- a/lib/server/controllers/apiController.js
+++ b/lib/server/controllers/apiController.js
@@ -39,7 +39,10 @@ var ApiController = function(app) {
waitForSelector: req.body.waitForSelector || null,
cookie: req.body.cookie || null,
authUser: req.body.authUser || null,
- authPass: req.body.authPass || null
+ authPass: req.body.authPass || null,
+ blockDomain: req.body.blockDomain || null,
+ allowDomain: req.body.allowDomain || null,
+ noExternals: req.body.noExternals || false
}
};
@@ -77,6 +80,9 @@ var ApiController = function(app) {
cookie: run.params.cookie,
authUser: run.params.authUser,
authPass: run.params.authPass,
+ blockDomain: run.params.blockDomain,
+ allowDomain: run.params.allowDomain,
+ noExternals: run.params.noExternals,
phantomasEngine: serverSettings.phantomasEngine
};
diff --git a/lib/tools/phantomas/phantomasWrapper.js b/lib/tools/phantomas/phantomasWrapper.js
index 7d51542..6eeb20f 100644
--- a/lib/tools/phantomas/phantomasWrapper.js
+++ b/lib/tools/phantomas/phantomasWrapper.js
@@ -31,12 +31,14 @@ var PhantomasWrapper = function() {
'cookie': task.options.cookie,
'auth-user': task.options.authUser,
'auth-pass': task.options.authPass,
+ 'block-domain': task.options.blockDomain,
+ 'allow-domain': task.options.allowDomain,
+ 'no-externals': task.options.noExternals,
// Mandatory
'reporter': 'json:pretty',
'analyze-css': true,
'skip-modules': [
- 'blockDomains', // not needed
'domHiddenContent', // overriden
'domMutations', // not compatible with webkit
'domQueries', // overriden
@@ -118,11 +120,6 @@ var PhantomasWrapper = function() {
async.retry(triesNumber, function(cb) {
currentTry ++;
- // Fix for https://github.com/gmetais/YellowLabTools/issues/114
- if (currentTry === 2 && options.engine === 'webkit2') {
- debug('Launching a second try with the old webkit v1 engine');
- options.engine = 'webkit';
- }
var process = phantomas(task.url, options, function(err, json, results) {
var errorCode = err ? parseInt(err.message, 10) : null;
diff --git a/package.json b/package.json
index 35e8866..07c772a 100644
--- a/package.json
+++ b/package.json
@@ -45,7 +45,7 @@
"meow": "3.6.0",
"minimize": "1.7.4",
"parse-color": "1.0.0",
- "phantomas": "1.13.0",
+ "phantomas": "git://github.com/gmetais/phantomas.git#fix-about-blank",
"ps-node": "0.0.5",
"q": "1.4.1",
"request": "2.67.0",
diff --git a/test/api/apiTest.js b/test/api/apiTest.js
index c13701f..10751d5 100644
--- a/test/api/apiTest.js
+++ b/test/api/apiTest.js
@@ -31,6 +31,7 @@ describe('api', function() {
},
json: true,
headers: {
+ 'Content-Type': 'application/json',
'X-Api-Key': 'invalid'
}
}, function(error, response, body) {
@@ -53,6 +54,7 @@ describe('api', function() {
},
json: true,
headers: {
+ 'Content-Type': 'application/json',
'X-Api-Key': Object.keys(config.authorizedKeys)[0]
}
}, function(error, response, body) {
@@ -76,6 +78,7 @@ describe('api', function() {
},
json: true,
headers: {
+ 'Content-Type': 'application/json',
'X-Api-Key': Object.keys(config.authorizedKeys)[0]
}
}, function(error, response, body) {
@@ -99,12 +102,13 @@ describe('api', function() {
screenshot: true,
device: 'tablet',
//waitForSelector: '*',
- cookie: 'foo=bar',
+ //cookie: 'foo=bar;domain=google.com',
authUser: 'joe',
authPass: 'secret'
},
json: true,
headers: {
+ 'Content-Type': 'application/json',
'X-Api-Key': Object.keys(config.authorizedKeys)[0]
}
}, function(error, response, body) {
@@ -133,6 +137,7 @@ describe('api', function() {
},
json: true,
headers: {
+ 'Content-Type': 'application/json',
'X-Api-Key': Object.keys(config.authorizedKeys)[0]
}
}, function(error, response, body) {
@@ -172,7 +177,7 @@ describe('api', function() {
// Check if settings are correctly sent and retrieved
body.params.options.should.have.a.property('device').that.equals('tablet');
//body.params.options.should.have.a.property('waitForSelector').that.equals('*');
- body.params.options.should.have.a.property('cookie').that.equals('foo=bar');
+ //body.params.options.should.have.a.property('cookie').that.equals('foo=bar');
body.params.options.should.have.a.property('authUser').that.equals('joe');
body.params.options.should.have.a.property('authPass').that.equals('secret');
@@ -208,6 +213,7 @@ describe('api', function() {
},
json: true,
headers: {
+ 'Content-Type': 'application/json',
'X-Api-Key': Object.keys(config.authorizedKeys)[0]
}
}, function(error, response, body) {
@@ -232,6 +238,7 @@ describe('api', function() {
url: serverUrl + '/api/runs/' + asyncRunId,
json: true,
headers: {
+ 'Content-Type': 'application/json',
'X-Api-Key': Object.keys(config.authorizedKeys)[0]
}
}, function(error, response, body) {
diff --git a/test/core/customPoliciesTest.js b/test/core/customPoliciesTest.js
index 784bf64..2f517cd 100644
--- a/test/core/customPoliciesTest.js
+++ b/test/core/customPoliciesTest.js
@@ -183,18 +183,19 @@ describe('customPolicies', function() {
var versions = {
'1.2.9': 0,
- '1.3.9': 0,
- '1.4.4': 10,
- '1.5.0': 20,
- '1.6.3': 30,
- '1.7.0': 40,
- '1.8.3a': 50,
- '1.9.2': 70,
- '1.10.1': 90,
- '2.0.0-rc1': 90,
- '1.11.1': 100,
- '2.1.1-beta1': 100,
- '3.0.0': 100
+ '1.4.4': 0,
+ '1.5.0': 10,
+ '1.6.3': 20,
+ '1.7.0': 30,
+ '1.8.3a': 40,
+ '1.9.2': 50,
+ '1.10.1': 70,
+ '2.0.0-rc1': 70,
+ '1.11.1': 90,
+ '2.1.1-beta1': 90,
+ '1.12.1': 100,
+ '2.3.1': 100,
+ '3.1.0': 100
};
for (var version in versions) {
diff --git a/test/fixtures/settings.json b/test/fixtures/settings.json
index 58c89ca..a68db4c 100644
--- a/test/fixtures/settings.json
+++ b/test/fixtures/settings.json
@@ -2,6 +2,7 @@
"serverPort": "8387",
"phantomasEngine": "webkit",
"googleAnalyticsId": "",
+ "screenshotWidth": 400,
"authorizedKeys": {
"1234567890": "contact@gaelmetais.com"