mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
nav/tabs snapshot tests
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<div class="card-content">
|
||||
Keep close to Nature's heart... and break clear away, once in awhile, and climb a mountain or spend a week in the woods. Wash your spirit clean.
|
||||
</div>
|
||||
<img src="http://ionic-io-assets.s3.amazonaws.com/images/p4.png">
|
||||
<div style="width:100%; height: 180px; background: gray"></div>
|
||||
<div class="card-footer">
|
||||
Posted 5 days ago
|
||||
</div>
|
||||
|
||||
16
ionic/components/nav/test/basic/e2e.ts
Normal file
16
ionic/components/nav/test/basic/e2e.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
it('should go from 1 to 2', function() {
|
||||
element(by.css('#from1To2')).click();
|
||||
});
|
||||
|
||||
it('should go from 2 to 3', function() {
|
||||
element(by.css('#from2To3')).click();
|
||||
});
|
||||
|
||||
it('should go from 3 to 2', function() {
|
||||
element(by.css('#from3To2')).click();
|
||||
});
|
||||
|
||||
it('should go from 2 to 1', function() {
|
||||
element(by.css('#from2To1')).click();
|
||||
});
|
||||
@@ -15,7 +15,7 @@ import {ThirdPage} from './third-page';
|
||||
'</ion-navbar>' +
|
||||
'<ion-content class="padding">' +
|
||||
'<p>First Page: {{ val }}</p>' +
|
||||
'<p><button 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 (click)="setItems()">setItems() (Go to 3rd, no history)</button></p>' +
|
||||
'<icon class="ion-ios-arrow-back"></icon>' +
|
||||
|
||||
@@ -8,8 +8,8 @@ import {FirstPage} from './first-page';
|
||||
<ion-navbar *navbar primary><ion-title>Second Page Header</ion-title></ion-navbar>
|
||||
<ion-content class="padding">
|
||||
<p><button primary (click)="pop()">Pop (Go back to 1st)</button></p>
|
||||
<p><button primary nav-pop>Pop with NavPop (Go back to 1st)</button></p>
|
||||
<p><button primary (click)="push()">Push (Go to 3rd)</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 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>
|
||||
|
||||
@@ -6,7 +6,7 @@ import {IonicView, NavController} from 'ionic/ionic';
|
||||
<ion-navbar *navbar><ion-title>Third Page Header</ion-title></ion-navbar>
|
||||
<ion-content class="padding">
|
||||
<p>
|
||||
<button primary (click)="pop()">Pop (Go back to 2nd)</button>
|
||||
<button id="from3To2" primary (click)="pop()">Pop (Go back to 2nd)</button>
|
||||
</p>
|
||||
<div class="yellow"><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>
|
||||
|
||||
@@ -1 +1,20 @@
|
||||
|
||||
it('should go to Tab1 Page1', function() {
|
||||
element(by.css('#signIn')).click();
|
||||
});
|
||||
|
||||
it('should go to Tab1 Page2', function() {
|
||||
element(by.css('#goToTab1Page2')).click();
|
||||
});
|
||||
|
||||
it('should go to Tab2 Page1', function() {
|
||||
element(by.css('.tab-button:nth-of-type(2)')).click();
|
||||
});
|
||||
|
||||
it('should go back to Tab1 Page2', function() {
|
||||
element(by.css('.tab-button:nth-of-type(1)')).click();
|
||||
});
|
||||
|
||||
it('should go back to Tab1 Page1', function() {
|
||||
element(by.css('#backToTab1Page1')).click();
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import {App, IonicView, NavController} from 'ionic/ionic';
|
||||
'<ion-title>Sign In</ion-title>' +
|
||||
'</ion-navbar>' +
|
||||
'<ion-content class="padding">' +
|
||||
'<p><button primary (click)="push()">Go to tabs</button></p>' +
|
||||
'<p><button id="signIn" primary (click)="push()">Go to tabs</button></p>' +
|
||||
'<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>' +
|
||||
'</ion-content>'
|
||||
@@ -45,7 +45,7 @@ class TabsPage {
|
||||
'<ion-title>Tabs 1 Page 1</ion-title>' +
|
||||
'</ion-navbar>' +
|
||||
'<ion-content class="padding">' +
|
||||
'<p><button primary (click)="push()">Go to Tab 1, Page 2</button></p>' +
|
||||
'<p><button id="goToTab1Page2" primary (click)="push()">Go to Tab 1, Page 2</button></p>' +
|
||||
'<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>' +
|
||||
'</ion-content>'
|
||||
@@ -68,7 +68,7 @@ class Tab1Page1 {
|
||||
'</ion-navbar>' +
|
||||
'<ion-content class="padding">' +
|
||||
'<p><button primary (click)="push()">Go to Tab 1, Page 3</button></p>' +
|
||||
'<p><button primary (click)="nav.pop()">Back to Tab 1, Page 1</button></p>' +
|
||||
'<p><button id="backToTab1Page1" primary (click)="nav.pop()">Back to Tab 1, Page 1</button></p>' +
|
||||
'<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>' +
|
||||
'</ion-content>'
|
||||
|
||||
@@ -17,6 +17,7 @@ var IonicSnapshot = function(options) {
|
||||
self.appId = options.appId || 'test_app';
|
||||
self.sleepBetweenSpecs = options.sleepBetweenSpecs || 750;
|
||||
self.testId = browser.params.test_id || 'test_id';
|
||||
self.shouldUpload = browser.params.upload !== 'false';
|
||||
self.platformId = browser.params.platform_id;
|
||||
self.platformIndex = browser.params.platform_index;
|
||||
self.platformCount = browser.params.platform_count;
|
||||
@@ -54,6 +55,8 @@ var IonicSnapshot = function(options) {
|
||||
});
|
||||
});
|
||||
process.on('exit', function() {
|
||||
if (!self.shouldUpload) return;
|
||||
|
||||
if (self.highestMismatch > 1) {
|
||||
log(colors.red('Highest Mismatch: ' + self.highestMismatch + '%'));
|
||||
} else if (self.highestMismatch > 0) {
|
||||
@@ -102,6 +105,10 @@ var IonicSnapshot = function(options) {
|
||||
|
||||
browser.sleep(self.sleepBetweenSpecs).then(function(){
|
||||
|
||||
if (!self.shouldUpload) {
|
||||
return d.fulfill();
|
||||
}
|
||||
|
||||
browser.takeScreenshot().then(function(pngBase64) {
|
||||
var specIdString = '[' + (spec.id+1) + '/' + self.testData.total_specs + ']';
|
||||
|
||||
@@ -109,7 +116,7 @@ var IonicSnapshot = function(options) {
|
||||
self.testData.description = spec.getFullName();
|
||||
self.testData.highest_mismatch = self.highestMismatch;
|
||||
self.testData.png_base64 = pngBase64;
|
||||
self.testData.url = currentUrl;
|
||||
self.testData.url = currentUrl.replace('dist/', '/');
|
||||
pngBase64 = null;
|
||||
|
||||
var requestDeferred = q.defer();
|
||||
@@ -166,6 +173,8 @@ var IonicSnapshot = function(options) {
|
||||
IonicReporter.prototype.reportRunnerResults = function() {
|
||||
var self = this;
|
||||
|
||||
if (!self.shouldUpload) return;
|
||||
|
||||
self.flow.execute(function() {
|
||||
var d = protractor.promise.defer();
|
||||
log('Waiting for all screenshots to be posted...');
|
||||
|
||||
@@ -9,7 +9,7 @@ exports.config = {
|
||||
//domain: 'localhost:8080',
|
||||
|
||||
specs: 'dist/e2e/**/*e2e.js',
|
||||
//specs: 'dist/e2e/action-menu/**/*e2e.js',
|
||||
//specs: 'dist/e2e/nav/basic/*e2e.js',
|
||||
|
||||
sleepBetweenSpecs: 1200,
|
||||
|
||||
|
||||
@@ -21,12 +21,18 @@ module.exports = function(gulp, argv, buildConfig) {
|
||||
});
|
||||
|
||||
gulp.task('snapshot', ['clean.build', 'protractor-server'], function(done) {
|
||||
var protractorConfigFile = path.resolve(projectRoot, 'scripts/snapshot/protractor.config.js');
|
||||
snapshot(done, protractorConfigFile);
|
||||
snapshot(done);
|
||||
});
|
||||
|
||||
function snapshot(done, protractorConfigFile) {
|
||||
gulp.task('snapshot-quick', ['e2e', 'protractor-server'], function(done) {
|
||||
snapshot(done, true);
|
||||
});
|
||||
|
||||
function snapshot(done, quickMode) {
|
||||
var protractorConfigFile = path.resolve(projectRoot, 'scripts/snapshot/protractor.config.js');
|
||||
|
||||
snapshotValues.params.test_id = uuid.v4().split('-')[0];
|
||||
snapshotValues.params.upload = !quickMode;
|
||||
|
||||
var protractorArgs = [
|
||||
'--browser <%= browser %>',
|
||||
@@ -37,11 +43,14 @@ module.exports = function(gulp, argv, buildConfig) {
|
||||
'--params.width=<%= params.width %>',
|
||||
'--params.height=<%= params.height %>',
|
||||
'--params.test_id=<%= params.test_id %>',
|
||||
'--params.upload=<%= params.upload %>',
|
||||
].map(function(argument) {
|
||||
return _.template(argument, snapshotValues);
|
||||
});
|
||||
|
||||
e2ePublish(snapshotValues.params.test_id);
|
||||
if (!quickMode) {
|
||||
e2ePublish(snapshotValues.params.test_id);
|
||||
}
|
||||
|
||||
return protractor(done, [protractorConfigFile].concat(protractorArgs));
|
||||
}
|
||||
@@ -65,6 +74,7 @@ module.exports = function(gulp, argv, buildConfig) {
|
||||
}
|
||||
|
||||
function e2ePublish(testId) {
|
||||
console.log('e2ePublish: ' + testId);
|
||||
snapshotConfig.testId = testId;
|
||||
require('../e2e/e2e-publish')(snapshotConfig);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user