Skip to content

Commit e21b9a6

Browse files
committed
Added 2e2 tests using protractor.
1 parent b57bedb commit e21b9a6

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

protractor.conf.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exports.config = {
2+
seleniumAddress: 'http://localhost:4444/wd/hub',
3+
specs: ['test/e2e/*.js']
4+
};

readme.md

+20
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
Inspired by Firebase & AngularJS TodoMVC Example
2+
3+
Unit Testing (Using Karma) - http://karma-runner.github.io/0.12/index.html
4+
Test case: test/unit/*
5+
6+
Run: $ karma start karma.conf.js
7+
8+
Installation:
9+
npm install karma
10+
sudo npm install -g karma-cli
11+
sugo npm install -g karma-chrome-launcher
12+
sudo npm install -g karma-jasmine
13+
14+
E2E Testing (Usung Protractor) - http://www.protractortest.org/#/
15+
Test case: test/e2e/*
16+
17+
Run: $ protractor protractor.conf.js
18+
19+
Installation:
20+
npm install -g protractor
21+
webdriver-manager update & webdriver-manager start

test/e2e/scenarios.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
describe('angularjs homepage todo list', function() {
2+
it('should add a todo', function() {
3+
browser.get('https://angularjs.org');
4+
5+
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
6+
element(by.css('[value="add"]')).click();
7+
8+
var todoList = element.all(by.repeater('todo in todoList.todos'));
9+
expect(todoList.count()).toEqual(3);
10+
expect(todoList.get(2).getText()).toEqual('write first protractor test');
11+
12+
// You wrote your first test, cross it off the list
13+
todoList.get(2).element(by.css('input')).click();
14+
var completedAmount = element.all(by.css('.done-true'));
15+
expect(completedAmount.count()).toEqual(2);
16+
});
17+
});

0 commit comments

Comments
 (0)