1 | describe('angularjs homepage', function() {
|
2 | it('should greet the named user', function() {
|
3 | browser.get('http://www.angularjs.org');
|
4 |
|
5 | element(by.model('yourName')).sendKeys('Julie');
|
6 |
|
7 | var greeting = element(by.binding('yourName'));
|
8 |
|
9 | expect(greeting.getText()).toEqual('Hello Julie!');
|
10 | });
|
11 |
|
12 | describe('todo list', function() {
|
13 | var todoList;
|
14 |
|
15 | beforeEach(function() {
|
16 | browser.get('http://www.angularjs.org');
|
17 |
|
18 | todoList = element.all(by.repeater('todo in todoList.todos'));
|
19 | });
|
20 |
|
21 | it('should list todos', function() {
|
22 | expect(todoList.count()).toEqual(2);
|
23 | expect(todoList.get(1).getText()).toEqual('build an AngularJS app');
|
24 | });
|
25 |
|
26 | it('should add a todo', function() {
|
27 | var addTodo = element(by.model('todoList.todoText'));
|
28 | var addButton = element(by.css('[value="add"]'));
|
29 |
|
30 | addTodo.sendKeys('write a protractor test');
|
31 | addButton.click();
|
32 |
|
33 | expect(todoList.count()).toEqual(3);
|
34 | expect(todoList.get(2).getText()).toEqual('write a protractor test');
|
35 | });
|
36 | });
|
37 | });
|