test(loading): add e2e test for loading in tabs and remove animation for basic e2e

references #5426
This commit is contained in:
Brandy Carney
2016-04-05 11:24:05 -04:00
parent 1d6569ae79
commit 41a6524855
5 changed files with 111 additions and 16 deletions

View File

@ -56,9 +56,12 @@ class E2EPage {
this.nav.present(loading); this.nav.present(loading);
} }
// Pass the fixed-spinner class so we can turn off
// spinner animation for the e2e test
presentLoadingDefault() { presentLoadingDefault() {
let loading = Loading.create({ let loading = Loading.create({
content: 'Please wait...', content: 'Please wait...',
cssClass: 'fixed-spinner'
}); });
this.nav.present(loading); this.nav.present(loading);
@ -101,7 +104,7 @@ class E2EPage {
goToPage2() { goToPage2() {
this.nav.push(Page2); this.nav.push(Page2);
} }
presentLoadingMultiple() { presentLoadingMultiple() {
let loading = Loading.create({ let loading = Loading.create({
spinner: 'hide', spinner: 'hide',
@ -109,7 +112,7 @@ class E2EPage {
}); });
this.nav.present(loading); this.nav.present(loading);
let loading2 = Loading.create({ let loading2 = Loading.create({
spinner: 'hide', spinner: 'hide',
content: 'Loading 2 Please Wait...' content: 'Loading 2 Please Wait...'
@ -118,7 +121,7 @@ class E2EPage {
setTimeout(() => { setTimeout(() => {
this.nav.present(loading2); this.nav.present(loading2);
}, 1000); }, 1000);
let loading3 = Loading.create({ let loading3 = Loading.create({
spinner: 'hide', spinner: 'hide',
content: 'Loading 3 Please Wait...' content: 'Loading 3 Please Wait...'
@ -126,22 +129,22 @@ class E2EPage {
setTimeout(() => { setTimeout(() => {
this.nav.present(loading3); this.nav.present(loading3);
setTimeout(() => { setTimeout(() => {
loading3.dismiss(); loading3.dismiss();
}, 1000); }, 1000);
setTimeout(() => { setTimeout(() => {
loading2.dismiss(); loading2.dismiss();
}, 2000); }, 2000);
setTimeout(() => { setTimeout(() => {
loading.dismiss(); loading.dismiss();
}, 3000); }, 3000);
}, 2000); }, 2000);
} }
presentLoadingMultipleNav() { presentLoadingMultipleNav() {
let loading = Loading.create({ let loading = Loading.create({
spinner: 'hide', spinner: 'hide',
@ -150,7 +153,7 @@ class E2EPage {
}); });
this.nav.present(loading); this.nav.present(loading);
let loading2 = Loading.create({ let loading2 = Loading.create({
spinner: 'hide', spinner: 'hide',
content: 'Loading 2 Please Wait...', content: 'Loading 2 Please Wait...',
@ -160,7 +163,7 @@ class E2EPage {
setTimeout(() => { setTimeout(() => {
this.nav.present(loading2); this.nav.present(loading2);
}, 500); }, 500);
let loading3 = Loading.create({ let loading3 = Loading.create({
spinner: 'hide', spinner: 'hide',
content: 'Loading 3 Please Wait...', content: 'Loading 3 Please Wait...',
@ -169,12 +172,12 @@ class E2EPage {
setTimeout(() => { setTimeout(() => {
this.nav.present(loading3); this.nav.present(loading3);
setTimeout(() => { setTimeout(() => {
this.nav.push(Page2); this.nav.push(Page2);
}, 1000); }, 1000);
}, 1000); }, 1000);
} }
} }
@Page({ @Page({

View File

@ -1,3 +1,8 @@
/* Fix the spinner used in e2e */
.fixed-spinner svg {
animation: none;
}
.custom-spinner-container { .custom-spinner-container {
position: relative; position: relative;
display: inline-block; display: inline-block;

View File

@ -0,0 +1,4 @@
it('should show default spinner', function() {
element(by.css('.e2eLoadingTabsContent')).click();
});

View File

@ -0,0 +1,74 @@
import {App, Page, ActionSheet, Loading, NavController, ViewController, Platform} from 'ionic-angular';
@Page({
templateUrl: 'main.html'
})
class E2EPage {
constructor(private nav: NavController, private platform: Platform) {}
presentLoading() {
let loading = Loading.create({
spinner: 'hide',
content: 'Loading...',
duration: 1000
});
this.nav.present(loading);
}
presentLoadingNav() {
let loading = Loading.create({
content: 'Please wait...',
});
this.nav.present(loading);
setTimeout(() => {
this.nav.push(Page2);
setTimeout(() => {
loading.dismiss();
}, 1000);
}, 1000);
}
}
@Page({
template: `
<ion-navbar *navbar>
<ion-title>Page 2</ion-title>
</ion-navbar>
<ion-content padding>Some content</ion-content>
`
})
class Page2 {
constructor(private nav: NavController, private platform: Platform) {}
}
@Page({
template: `
<ion-tabs>
<ion-tab tabTitle="Plain List" tabIcon="star" [root]="root1"></ion-tab>
<ion-tab tabTitle="Schedule" tabIcon="globe" [root]="root2"></ion-tab>
<ion-tab tabTitle="Stopwatch" tabIcon="stopwatch" [root]="root3"></ion-tab>
</ion-tabs>
`
})
export class TabsPage {
private root1 = E2EPage;
private root2 = Page2;
private root3 = E2EPage;
constructor() {
}
}
@App({
template: '<ion-nav [root]="root"></ion-nav>'
})
class E2EApp {
root = TabsPage;
}

View File

@ -0,0 +1,9 @@
<ion-navbar *navbar>
<ion-title>Loading</ion-title>
</ion-navbar>
<ion-content padding>
<button block (click)="presentLoading()" class="e2eLoadingTabsContent">Loading Content</button>
<button block (click)="presentLoadingNav()">Loading w/ Nav</button>
</ion-content>