mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
snapshot updates
This commit is contained in:
17
gulpfile.js
17
gulpfile.js
@ -61,7 +61,6 @@ gulp.task('clean.build', function(done) {
|
|||||||
'e2e',
|
'e2e',
|
||||||
'sass',
|
'sass',
|
||||||
'fonts',
|
'fonts',
|
||||||
'vendor',
|
|
||||||
done
|
done
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@ -73,7 +72,6 @@ gulp.task('build', function(done) {
|
|||||||
'e2e',
|
'e2e',
|
||||||
'sass',
|
'sass',
|
||||||
'fonts',
|
'fonts',
|
||||||
'vendor',
|
|
||||||
done
|
done
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@ -86,7 +84,6 @@ gulp.task('watch', function(done) {
|
|||||||
'e2e',
|
'e2e',
|
||||||
'sass',
|
'sass',
|
||||||
'fonts',
|
'fonts',
|
||||||
'vendor',
|
|
||||||
'serve',
|
'serve',
|
||||||
function() {
|
function() {
|
||||||
watch(
|
watch(
|
||||||
@ -173,9 +170,12 @@ gulp.task('tests', function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('copy-scripts', function(){
|
gulp.task('copy-scripts', function(){
|
||||||
gulp.src(['scripts/resources/*.js', 'config.js', 'dist/js/ionic.bundle.js',
|
gulp.src([
|
||||||
'dist/vendor/web-animations-js/web-animations.min.js'])
|
'scripts/resources/*.js',
|
||||||
.pipe(gulp.dest('dist/lib'));
|
'scripts/vendor/web-animations-js/web-animations.min.js',
|
||||||
|
'config.js',
|
||||||
|
'dist/js/ionic.bundle.js'
|
||||||
|
]).pipe(gulp.dest('dist/lib'));
|
||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('e2e', ['copy-scripts'], function() {
|
gulp.task('e2e', ['copy-scripts'], function() {
|
||||||
@ -279,11 +279,6 @@ gulp.task('fonts', function() {
|
|||||||
.pipe(gulp.dest('dist/fonts'));
|
.pipe(gulp.dest('dist/fonts'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('vendor', function() {
|
|
||||||
return gulp.src(['scripts/vendor/**/*'])
|
|
||||||
.pipe(gulp.dest('dist/vendor'));
|
|
||||||
});
|
|
||||||
|
|
||||||
require('./scripts/snapshot/snapshot.task')(gulp, argv, buildConfig);
|
require('./scripts/snapshot/snapshot.task')(gulp, argv, buildConfig);
|
||||||
|
|
||||||
gulp.task('karma', function() {
|
gulp.task('karma', function() {
|
||||||
|
@ -8,13 +8,13 @@ import {ThirdPage} from './third-page';
|
|||||||
@IonicView({
|
@IonicView({
|
||||||
template: '' +
|
template: '' +
|
||||||
'<ion-navbar *navbar primary>' +
|
'<ion-navbar *navbar primary>' +
|
||||||
'<ion-title>First Page: {{ val }}</ion-title>' +
|
'<ion-title>First Page</ion-title>' +
|
||||||
'<ion-nav-items secondary>' +
|
'<ion-nav-items secondary>' +
|
||||||
'<button>S1</button>' +
|
'<button>S1</button>' +
|
||||||
'</ion-nav-items>' +
|
'</ion-nav-items>' +
|
||||||
'</ion-navbar>' +
|
'</ion-navbar>' +
|
||||||
'<ion-content class="padding">' +
|
'<ion-content class="padding">' +
|
||||||
'<p>First Page: {{ val }}</p>' +
|
'<p>First Page</p>' +
|
||||||
'<p><button id="from1To2" primary (click)="push()">Push (Go to 2nd)</button></p>' +
|
'<p><button id="from1To2" primary (click)="push()">Push (Go to 2nd)</button></p>' +
|
||||||
'<p><button primary [push-data]="pushData" [nav-push]="pushPage">Push w/ nav-push (Go to 2nd)</button></p>' +
|
'<p><button primary [push-data]="pushData" [nav-push]="pushPage">Push w/ nav-push (Go to 2nd)</button></p>' +
|
||||||
'<p><button primary (click)="setItems()">setItems() (Go to 3rd, no history)</button></p>' +
|
'<p><button primary (click)="setItems()">setItems() (Go to 3rd, no history)</button></p>' +
|
||||||
@ -29,10 +29,7 @@ export class FirstPage {
|
|||||||
app: IonicApp,
|
app: IonicApp,
|
||||||
config: IonicConfig
|
config: IonicConfig
|
||||||
) {
|
) {
|
||||||
console.log('FirstPage constructor');
|
|
||||||
|
|
||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
|
||||||
|
|
||||||
this.pushPage = SecondPage;
|
this.pushPage = SecondPage;
|
||||||
this.pushData = {
|
this.pushData = {
|
||||||
|
@ -11,7 +11,6 @@ import {FirstPage} from './first-page';
|
|||||||
<p><button id="from2To1" primary nav-pop>Pop with NavPop (Go back to 1st)</button></p>
|
<p><button id="from2To1" primary nav-pop>Pop with NavPop (Go back to 1st)</button></p>
|
||||||
<p><button id="from2To3" primary (click)="push()">Push (Go to 3rd)</button></p>
|
<p><button id="from2To3" primary (click)="push()">Push (Go to 3rd)</button></p>
|
||||||
<p><button primary (click)="setItems()">setItems() (Go to 3rd, FirstPage 1st in history)</button></p>
|
<p><button primary (click)="setItems()">setItems() (Go to 3rd, FirstPage 1st in history)</button></p>
|
||||||
<p>Random: {{ val }}</p>
|
|
||||||
<div class="green"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>
|
<div class="green"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
`
|
`
|
||||||
@ -23,7 +22,6 @@ export class SecondPage {
|
|||||||
) {
|
) {
|
||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
|
||||||
|
|
||||||
console.log('Second page params:', params);
|
console.log('Second page params:', params);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ module.exports = function(options) {
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var request = require('request');
|
var request = require('request');
|
||||||
var inputDir = path.join(__dirname, '../../dist');
|
var inputDir = path.join(__dirname, '../../dist');
|
||||||
|
var uploadQueue = [];
|
||||||
|
|
||||||
function uploadFiles(dir, urlPath) {
|
function uploadFiles(dir, urlPath) {
|
||||||
fs.readdir(dir, function(err, list) {
|
fs.readdir(dir, function(err, list) {
|
||||||
@ -26,27 +26,60 @@ module.exports = function(options) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setTimeout(postNextUpload, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
function uploadFile(archiveFileUrlPath, archiveFileLocalPath) {
|
function uploadFile(archiveFileUrlPath, archiveFileLocalPath) {
|
||||||
var formData = {
|
uploadQueue.push({
|
||||||
url_path: archiveFileUrlPath,
|
url_path: archiveFileUrlPath,
|
||||||
|
local_path: archiveFileLocalPath,
|
||||||
group_id: options.groupId,
|
group_id: options.groupId,
|
||||||
app_id: options.appId,
|
app_id: options.appId,
|
||||||
test_id: options.testId,
|
test_id: options.testId,
|
||||||
access_key: process.env.IONIC_SNAPSHOT_KEY
|
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({
|
request.post({
|
||||||
uri: 'http://' + options.domain + '/e2e/upload-url',
|
uri: 'http://' + options.domain + '/e2e/upload-url',
|
||||||
formData: formData
|
formData: uploadData
|
||||||
},
|
},
|
||||||
function(err, httpResponse, body) {
|
function(err, httpResponse, body) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
uploadData.status = 'failed';
|
||||||
console.error('Get upload failed:', err);
|
console.error('Get upload failed:', err);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (httpResponse.statusCode == 200) {
|
if (httpResponse.statusCode == 200) {
|
||||||
uploadE2E(body, archiveFileUrlPath, archiveFileLocalPath);
|
uploadE2E(body, uploadData);
|
||||||
} else {
|
} else {
|
||||||
console.error('Get upload error:', httpResponse.statusCode, body);
|
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 = {
|
var formData = {
|
||||||
file: fs.createReadStream(archiveFileLocalPath)
|
file: fs.createReadStream(uploadData.local_path)
|
||||||
};
|
};
|
||||||
|
|
||||||
request.post({
|
request.post({
|
||||||
@ -65,11 +98,22 @@ module.exports = function(options) {
|
|||||||
formData: formData
|
formData: formData
|
||||||
},
|
},
|
||||||
function(err, httpResponse, body) {
|
function(err, httpResponse, body) {
|
||||||
|
setTimeout(postNextUpload, 100);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Upload failed:', err);
|
console.error('Upload failed:', err);
|
||||||
|
uploadData.status = 'failed';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (httpResponse.statusCode == 200) {
|
||||||
|
uploadData.status = 'uploaded';
|
||||||
|
|
||||||
|
if (options.verbose) {
|
||||||
|
console.error('Uploaded:', uploadData.url_path);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (httpResponse.statusCode != 200) {
|
|
||||||
console.error('Upload error:', httpResponse.statusCode, body);
|
console.error('Upload error:', httpResponse.statusCode, body);
|
||||||
|
uploadData.status = 'failed';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,17 @@ module.exports = function(gulp, argv, buildConfig) {
|
|||||||
snapshot(done, true);
|
snapshot(done, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('e2e-publish', function(done) {
|
||||||
|
var testId = uuid.v4().split('-')[0];
|
||||||
|
e2ePublish(testId, true);
|
||||||
|
});
|
||||||
|
|
||||||
function snapshot(done, quickMode) {
|
function snapshot(done, quickMode) {
|
||||||
|
var testId = uuid.v4().split('-')[0];
|
||||||
|
|
||||||
var protractorConfigFile = path.resolve(projectRoot, 'scripts/snapshot/protractor.config.js');
|
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;
|
snapshotValues.params.upload = !quickMode;
|
||||||
|
|
||||||
var protractorArgs = [
|
var protractorArgs = [
|
||||||
@ -48,9 +55,7 @@ module.exports = function(gulp, argv, buildConfig) {
|
|||||||
return _.template(argument, snapshotValues);
|
return _.template(argument, snapshotValues);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!quickMode) {
|
e2ePublish(testId, false);
|
||||||
e2ePublish(snapshotValues.params.test_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return protractor(done, [protractorConfigFile].concat(protractorArgs));
|
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);
|
console.log('e2ePublish: ' + testId);
|
||||||
snapshotConfig.testId = testId;
|
snapshotConfig.testId = testId;
|
||||||
|
snapshotConfig.verbose = verbose;
|
||||||
require('../e2e/e2e-publish')(snapshotConfig);
|
require('../e2e/e2e-publish')(snapshotConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user