Skip to content

Instantly share code, notes, and snippets.

@lalabear
Created August 8, 2012 14:02
Show Gist options
  • Save lalabear/3295256 to your computer and use it in GitHub Desktop.
Save lalabear/3295256 to your computer and use it in GitHub Desktop.
邊學AngularJS邊做Todo List (6) -E2E測試
'use strict';
describe('Todo List', function() {
beforeEach(function() {
browser().navigateTo('../../public/todoWithUpdate.html');
});
it('should display "Todo List" when page loaded', function() {
expect(element("h1:first").text()).toMatch("Todo List");
});
describe('add one new item',function(){
beforeEach(function() {
input('newItem').enter("buy beer");
element(':submit').click();
});
it('should have one todo in list',function(){
expect(element("#todo li").count()).toEqual(1);
});
it('should have one todo named "buy beer"',function(){
expect(element("#todo li:first span").text()).toEqual("buy beer");
});
});
describe('delete one item',function(){
beforeEach(function() {
input('newItem').enter("buy beer");
element(':submit').click();
element('#todo li :checkbox').click();
});
it('should have nothing in todo list',function(){
expect(element("#todo li").count()).toEqual(0);
});
it('should have one item it finsish list',function(){
expect(element("#finish li").count()).toEqual(1);
});
it('should have "buy bear" item in finsish list',function(){
expect(element("#finish li:first").text()).toMatch("buy beer");
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment