Skip to content

Commit

Permalink
test(loading): add e2e test for loading in tabs and remove animation …
Browse files Browse the repository at this point in the history
…for basic e2e

references #5426
  • Loading branch information
brandyscarney committed Apr 5, 2016
1 parent 1d6569a commit 41a6524
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 16 deletions.
35 changes: 19 additions & 16 deletions ionic/components/loading/test/basic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ class E2EPage {
this.nav.present(loading);
}

// Pass the fixed-spinner class so we can turn off
// spinner animation for the e2e test
presentLoadingDefault() {
let loading = Loading.create({
content: 'Please wait...',
cssClass: 'fixed-spinner'
});

this.nav.present(loading);
Expand Down Expand Up @@ -101,15 +104,15 @@ class E2EPage {
goToPage2() {
this.nav.push(Page2);
}

presentLoadingMultiple() {
let loading = Loading.create({
spinner: 'hide',
content: 'Loading 1 Please Wait...'
});

this.nav.present(loading);

let loading2 = Loading.create({
spinner: 'hide',
content: 'Loading 2 Please Wait...'
Expand All @@ -118,30 +121,30 @@ class E2EPage {
setTimeout(() => {
this.nav.present(loading2);
}, 1000);

let loading3 = Loading.create({
spinner: 'hide',
content: 'Loading 3 Please Wait...'
});

setTimeout(() => {
this.nav.present(loading3);

setTimeout(() => {
loading3.dismiss();
}, 1000);

setTimeout(() => {
loading2.dismiss();
}, 2000);
}, 2000);

setTimeout(() => {
loading.dismiss();
}, 3000);
}, 3000);
}, 2000);

}

presentLoadingMultipleNav() {
let loading = Loading.create({
spinner: 'hide',
Expand All @@ -150,7 +153,7 @@ class E2EPage {
});

this.nav.present(loading);

let loading2 = Loading.create({
spinner: 'hide',
content: 'Loading 2 Please Wait...',
Expand All @@ -160,7 +163,7 @@ class E2EPage {
setTimeout(() => {
this.nav.present(loading2);
}, 500);

let loading3 = Loading.create({
spinner: 'hide',
content: 'Loading 3 Please Wait...',
Expand All @@ -169,12 +172,12 @@ class E2EPage {

setTimeout(() => {
this.nav.present(loading3);

setTimeout(() => {
this.nav.push(Page2);
}, 1000);
}, 1000);
}
}, 1000);
}, 1000);
}
}

@Page({
Expand Down
5 changes: 5 additions & 0 deletions ionic/components/loading/test/basic/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* Fix the spinner used in e2e */
.fixed-spinner svg {
animation: none;
}

.custom-spinner-container {
position: relative;
display: inline-block;
Expand Down
4 changes: 4 additions & 0 deletions ionic/components/loading/test/tabs/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

it('should show default spinner', function() {
element(by.css('.e2eLoadingTabsContent')).click();
});
74 changes: 74 additions & 0 deletions ionic/components/loading/test/tabs/index.ts
Original file line number Diff line number Diff line change
@@ -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;
}
9 changes: 9 additions & 0 deletions ionic/components/loading/test/tabs/main.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 41a6524

Please sign in to comment.