diff --git a/config/gulp-tasks/test.js b/config/gulp-tasks/test.js index d8fff5b273..9710a49311 100644 --- a/config/gulp-tasks/test.js +++ b/config/gulp-tasks/test.js @@ -66,9 +66,15 @@ module.exports = function(gulp, argv) { gulp.task('snapshot', ['snapshot-server'], function(done) { var uuid = require('node-uuid'); + var testId = uuid.v4(); + return protractor(done, [ 'config/protractor.conf.js', - '--test_id=' + uuid.v4() + '--browser chrome', + '--params.platform_id=chrome_desktop_narrow', + '--params.width=400', + '--params.height=800', + '--params.test_id=' + testId, ]); }); diff --git a/config/lib/ionic-snapshot.js b/config/lib/ionic-snapshot.js index a52a1e391b..a2f8a651a0 100755 --- a/config/lib/ionic-snapshot.js +++ b/config/lib/ionic-snapshot.js @@ -28,14 +28,20 @@ var IonicSnapshot = function(options) { self.flow = protractor.promise.controlFlow(); // set browser size - self.width = options.width; - self.height = options.height; - if(self.width && self.height) { + self.width = browser.params.width || -1; + self.height = browser.params.height || -1; + if(self.width > 0 && self.height > 0) { self.flow.execute(function(){ return browser.driver.manage().window().setSize(self.width, self.height); }); } + self.platformId = browser.params.platform_id; + + console.log('width', self.width); + console.log('height', self.height); + console.log('platformId', self.platformId); + self.flow.execute(function(){ var d = protractor.promise.defer(); @@ -44,6 +50,9 @@ var IonicSnapshot = function(options) { var data = { compare: self.compare, test_id: self.testId, + platform_id: self.platformId, + width: self.width, + height: self.height, browser: capabilities.get('browserName'), platform: capabilities.get('platform'), version: capabilities.get('version') @@ -99,7 +108,9 @@ var IonicSnapshot = function(options) { description: spec.getFullName(), png_base64: pngBase64, url: currentAppUrl, - access_key: self.accessKey + access_key: self.accessKey, + width: self.width, + height: self.height }; pngBase64 = null; @@ -172,16 +183,11 @@ var IonicSnapshot = function(options) { } }; - // get --test_id cmd line argument - for(var x=0; x