Skip to content

Commit

Permalink
test(progress-bar): add basic e2e tests (#1895)
Browse files Browse the repository at this point in the history
Adds basic e2e tests that assert that the different progress bars are being rendered.

Referencing #559.
  • Loading branch information
crisbeto authored and tinayuangao committed Nov 28, 2016
1 parent e332f15 commit 7f37ec1
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 2 deletions.
23 changes: 23 additions & 0 deletions e2e/components/progress-bar/progress-bar.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
describe('progress-bar', () => {
beforeEach(() => browser.get('/progress-bar'));

it('should render a determinate progress bar', () => {
shouldExist('md-progress-bar[mode="determinate"]');
});

it('should render a buffer progress bar', () => {
shouldExist('md-progress-bar[mode="buffer"]');
});

it('should render a query progress bar', () => {
shouldExist('md-progress-bar[mode="query"]');
});

it('should render a indeterminate progress bar', () => {
shouldExist('md-progress-bar[mode="indeterminate"]');
});

function shouldExist(selector: string): void {
expect(element(by.css(selector)).isPresent()).toBe(true);
}
});
2 changes: 2 additions & 0 deletions src/e2e-app/e2e-app-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {BasicTabs} from './tabs/tabs-e2e';
import {DialogE2E, TestDialog} from './dialog/dialog-e2e';
import {GridListE2E} from './grid-list/grid-list-e2e';
import {ListE2E} from './list/list-e2e';
import {ProgressBarE2E} from './progress-bar/progress-bar-e2e';
import {MaterialModule} from '@angular/material';
import {E2E_APP_ROUTES} from './e2e-app/routes';

Expand All @@ -34,6 +35,7 @@ import {E2E_APP_ROUTES} from './e2e-app/routes';
TestDialog,
GridListE2E,
ListE2E,
ProgressBarE2E,
],
bootstrap: [E2EApp],
providers: [
Expand Down
1 change: 1 addition & 0 deletions src/e2e-app/e2e-app/e2e-app.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<a md-list-item [routerLink]="['icon']">Icon</a>
<a md-list-item [routerLink]="['list']">List</a>
<a md-list-item [routerLink]="['menu']">Menu</a>
<a md-list-item [routerLink]="['progress-bar']">Progress bar</a>
<a md-list-item [routerLink]="['radio']">Radios</a>
<a md-list-item [routerLink]="['tabs']">Tabs</a>

Expand Down
2 changes: 2 additions & 0 deletions src/e2e-app/e2e-app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {SimpleCheckboxes} from '../checkbox/checkbox-e2e';
import {DialogE2E} from '../dialog/dialog-e2e';
import {GridListE2E} from '../grid-list/grid-list-e2e';
import {ListE2E} from '../list/list-e2e';
import {ProgressBarE2E} from '../progress-bar/progress-bar-e2e';

export const E2E_APP_ROUTES: Routes = [
{path: '', component: Home},
Expand All @@ -21,4 +22,5 @@ export const E2E_APP_ROUTES: Routes = [
{path: 'dialog', component: DialogE2E},
{path: 'grid-list', component: GridListE2E},
{path: 'list', component: ListE2E},
{path: 'progress-bar', component: ProgressBarE2E},
];
3 changes: 1 addition & 2 deletions src/e2e-app/menu/menu-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {Component} from '@angular/core';
}
.bottom-row {
position: absolute;
top: 200px;
margin-top: 5px;
}
`]
})
Expand Down
4 changes: 4 additions & 0 deletions src/e2e-app/progress-bar/progress-bar-e2e.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<md-progress-bar mode="determinate" [value]="determinateValue"></md-progress-bar>
<md-progress-bar mode="buffer" [value]="bufferValue"></md-progress-bar>
<md-progress-bar mode="query"></md-progress-bar>
<md-progress-bar mode="indeterminate"></md-progress-bar>
17 changes: 17 additions & 0 deletions src/e2e-app/progress-bar/progress-bar-e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {Component} from '@angular/core';


@Component({
moduleId: module.id,
selector: 'progress-bar-e2e',
templateUrl: 'progress-bar-e2e.html',
styles: [`
md-progress-bar {
margin-bottom: 10px;
}
`]
})
export class ProgressBarE2E {
determinateValue: number = 57;
bufferValue: number = 35;
}

0 comments on commit 7f37ec1

Please sign in to comment.