mirror of
https://github.com/appium/appium.git
synced 2026-10-23 17:19:04 +08:00
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
/* global describe, it, browser, wdBrowser, element, by, expect, beforeEach */
|
|
"use strict";
|
|
|
|
describe('angularjs homepage', function () {
|
|
it('should greet the named user', function () {
|
|
browser.get('http://www.angularjs.org');
|
|
|
|
element(by.model('yourName')).sendKeys('Julie');
|
|
|
|
var greeting = element(by.binding('yourName'));
|
|
|
|
expect(greeting.getText()).toEqual('Hello Julie!');
|
|
});
|
|
|
|
describe('todo list', function () {
|
|
var todoList;
|
|
|
|
beforeEach(function () {
|
|
browser.get('http://www.angularjs.org');
|
|
|
|
todoList = element.all(by.repeater('todo in todos'));
|
|
});
|
|
|
|
it('should list todos', function () {
|
|
expect(todoList.count()).toEqual(2);
|
|
expect(todoList.get(1).getText()).toEqual('build an angular app');
|
|
});
|
|
|
|
it('should add a todo', function () {
|
|
var addTodo = element(by.model('todoText'));
|
|
var addButton = element(by.css('[value="add"]'));
|
|
|
|
addTodo.sendKeys('write a protractor test');
|
|
addButton.click();
|
|
|
|
expect(todoList.count()).toEqual(3);
|
|
expect(todoList.get(2).getText()).toEqual('write a protractor test');
|
|
});
|
|
|
|
it('should be able to use wdBrowser ', function (done) {
|
|
wdBrowser.title().then(function (title) {
|
|
expect(title).toEqual('AngularJS — Superheroic JavaScript MVW Framework');
|
|
}).nodeify(done);
|
|
});
|
|
|
|
});
|
|
});
|