Skip to content

Commit

Permalink
chore(e2e): restructure e2e test, add todo e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
tomastrajan committed Jun 25, 2019
1 parent 8b3691f commit 68229ce
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppPage } from './app.po';

import { getCurrentRouteUrl } from './utils/utils';
import { getCurrentRouteUrl } from '../utils/utils';

describe('App', () => {
let page: AppPage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AboutPage } from './about.po';
import { getCurrentRouteUrl } from '../utils/utils';
import { getCurrentRouteUrl } from '../../utils/utils';

describe('About Page', () => {
let page: AboutPage;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { browser, ExpectedConditions as EC } from 'protractor';

import { TodosPage } from './todos.po';

describe('Todos Page', () => {
let page: TodosPage;

beforeEach(() => (page = new TodosPage()));

it('adds todo', () => {
page.navigateTo();

page.getInput().sendKeys('Run e2e tests!');
page.getAddTodoButton().click();

browser.wait(EC.presenceOf(page.getResults().get(3)), 5000);

expect(page.getResults().count()).toBe(4);
expect(
page
.getResults()
.get(0)
.getText()
.then(text => text.trim())
).toBe('Run e2e tests!');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { browser, by, element } from 'protractor';

export class TodosPage {
navigateTo() {
return browser.get('#/examples/todos');
}

getInput() {
return element(by.css('anms-big-input input'));
}

getAddTodoButton() {
return element(by.css('anms-big-input-action button'));
}

getResults() {
return element.all(by.css('mat-card.todo'));
}
}

0 comments on commit 68229ce

Please sign in to comment.