' +
- 'First Page: {{ val }}
' +
+ 'First Page
' +
'' +
'' +
'' +
@@ -29,10 +29,7 @@ export class FirstPage {
app: IonicApp,
config: IonicConfig
) {
- console.log('FirstPage constructor');
-
this.nav = nav;
- this.val = Math.round(Math.random() * 8999) + 1000;
this.pushPage = SecondPage;
this.pushData = {
diff --git a/ionic/components/nav/test/basic/pages/second-page.ts b/ionic/components/nav/test/basic/pages/second-page.ts
index 7e7d25cca0..dd34d485fe 100644
--- a/ionic/components/nav/test/basic/pages/second-page.ts
+++ b/ionic/components/nav/test/basic/pages/second-page.ts
@@ -11,7 +11,6 @@ import {FirstPage} from './first-page';
- Random: {{ val }}
`
@@ -23,7 +22,6 @@ export class SecondPage {
) {
this.nav = nav;
this.params = params;
- this.val = Math.round(Math.random() * 8999) + 1000;
console.log('Second page params:', params);
}
diff --git a/scripts/e2e/e2e-publish.js b/scripts/e2e/e2e-publish.js
index ba592dbba5..0a9d94452b 100644
--- a/scripts/e2e/e2e-publish.js
+++ b/scripts/e2e/e2e-publish.js
@@ -5,7 +5,7 @@ module.exports = function(options) {
var path = require('path');
var request = require('request');
var inputDir = path.join(__dirname, '../../dist');
-
+ var uploadQueue = [];
function uploadFiles(dir, urlPath) {
fs.readdir(dir, function(err, list) {
@@ -26,27 +26,60 @@ module.exports = function(options) {
});
});
+
+ setTimeout(postNextUpload, 100);
}
function uploadFile(archiveFileUrlPath, archiveFileLocalPath) {
- var formData = {
+ uploadQueue.push({
url_path: archiveFileUrlPath,
+ local_path: archiveFileLocalPath,
group_id: options.groupId,
app_id: options.appId,
test_id: options.testId,
access_key: process.env.IONIC_SNAPSHOT_KEY
- };
+ });
+ }
+
+ function postNextUpload() {
+ var uploadData = null;
+
+ var totalUploading = 0;
+
+ for (var i = 0; i < uploadQueue.length; i++) {
+ if (uploadQueue[i].status === 'uploaded') {
+ continue;
+
+ } else if (uploadQueue[i].status === 'uploading') {
+ totalUploading++;
+ continue;
+
+ } else {
+ uploadData = uploadQueue[i];
+ }
+ }
+
+ if (!uploadData || totalUploading > 20) {
+ return;
+
+ } else if (options.verbose) {
+ console.log('Uploading: ' + uploadData.url_path);
+ }
+
+ uploadData.status = 'uploading';
request.post({
uri: 'http://' + options.domain + '/e2e/upload-url',
- formData: formData
+ formData: uploadData
},
function(err, httpResponse, body) {
if (err) {
+ uploadData.status = 'failed';
console.error('Get upload failed:', err);
+
} else {
if (httpResponse.statusCode == 200) {
- uploadE2E(body, archiveFileUrlPath, archiveFileLocalPath);
+ uploadE2E(body, uploadData);
} else {
console.error('Get upload error:', httpResponse.statusCode, body);
}
@@ -55,9 +88,9 @@ module.exports = function(options) {
);
}
- function uploadE2E(uploadUrl, archiveFileUrlPath, archiveFileLocalPath) {
+ function uploadE2E(uploadUrl, uploadData) {
var formData = {
- file: fs.createReadStream(archiveFileLocalPath)
+ file: fs.createReadStream(uploadData.local_path)
};
request.post({
@@ -65,11 +98,22 @@ module.exports = function(options) {
formData: formData
},
function(err, httpResponse, body) {
+ setTimeout(postNextUpload, 100);
+
if (err) {
console.error('Upload failed:', err);
+ uploadData.status = 'failed';
+
} else {
- if (httpResponse.statusCode != 200) {
+ if (httpResponse.statusCode == 200) {
+ uploadData.status = 'uploaded';
+
+ if (options.verbose) {
+ console.error('Uploaded:', uploadData.url_path);
+ }
+ } else {
console.error('Upload error:', httpResponse.statusCode, body);
+ uploadData.status = 'failed';
}
}
}
diff --git a/scripts/snapshot/snapshot.task.js b/scripts/snapshot/snapshot.task.js
index 40247037d6..7fe1d7a702 100644
--- a/scripts/snapshot/snapshot.task.js
+++ b/scripts/snapshot/snapshot.task.js
@@ -28,10 +28,17 @@ module.exports = function(gulp, argv, buildConfig) {
snapshot(done, true);
});
+ gulp.task('e2e-publish', function(done) {
+ var testId = uuid.v4().split('-')[0];
+ e2ePublish(testId, true);
+ });
+
function snapshot(done, quickMode) {
+ var testId = uuid.v4().split('-')[0];
+
var protractorConfigFile = path.resolve(projectRoot, 'scripts/snapshot/protractor.config.js');
- snapshotValues.params.test_id = uuid.v4().split('-')[0];
+ snapshotValues.params.test_id = testId;
snapshotValues.params.upload = !quickMode;
var protractorArgs = [
@@ -48,9 +55,7 @@ module.exports = function(gulp, argv, buildConfig) {
return _.template(argument, snapshotValues);
});
- if (!quickMode) {
- e2ePublish(snapshotValues.params.test_id);
- }
+ e2ePublish(testId, false);
return protractor(done, [protractorConfigFile].concat(protractorArgs));
}
@@ -73,9 +78,10 @@ module.exports = function(gulp, argv, buildConfig) {
});
}
- function e2ePublish(testId) {
+ function e2ePublish(testId, verbose) {
console.log('e2ePublish: ' + testId);
snapshotConfig.testId = testId;
+ snapshotConfig.verbose = verbose;
require('../e2e/e2e-publish')(snapshotConfig);
}