-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(e2e): restructure e2e test, add todo e2e test
- Loading branch information
1 parent
8b3691f
commit 68229ce
Showing
6 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...-material-starter/e2e/src/app.e2e-spec.ts → ...erial-starter/e2e/src/app/app.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...l-starter/e2e/src/about/about.e2e-spec.ts → .../e2e/src/features/about/about.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
projects/angular-ngrx-material-starter/e2e/src/features/todos/todos.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!'); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
projects/angular-ngrx-material-starter/e2e/src/features/todos/todos.po.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
} | ||
} |