angular.js/scenario/widgets-scenario.js
Elliott Sprehn 03df6cbddb New Angular Scenario runner and DSL system with redesigned HTML UI.
Uses the Jasmine syntax for tests, ex:

describe('widgets', function() {
  it('should verify that basic widgets work', function(){
    navigateTo('widgets.html');
    input('text.basic').enter('Carlos');
    expect(binding('text.basic')).toEqual('Carlos');
    input('text.basic').enter('Carlos Santana');
    expect(binding('text.basic')).not().toEqual('Carlos Boozer');
    input('text.password').enter('secret');
    expect(binding('text.password')).toEqual('secret');
    expect(binding('text.hidden')).toEqual('hiddenValue');
    expect(binding('gender')).toEqual('male');
    input('gender').select('female');
    expect(binding('gender')).toEqual('female');
  });
});

Note: To create new UI's implement the interface shown in angular.scenario.ui.Html.
2010-10-14 09:47:39 -07:00

58 lines
2.1 KiB
JavaScript

describe('widgets', function() {
it('should verify that basic widgets work', function(){
navigateTo('widgets.html');
input('text.basic').enter('Carlos');
expect(binding('text.basic')).toEqual('Carlos');
pause(2);
input('text.basic').enter('Carlos Santana');
pause(2);
expect(binding('text.basic')).not().toEqual('Carlos Boozer');
pause(2);
input('text.password').enter('secret');
expect(binding('text.password')).toEqual('secret');
expect(binding('text.hidden')).toEqual('hiddenValue');
expect(binding('gender')).toEqual('male');
pause(2);
input('gender').select('female');
expect(binding('gender')).toEqual('female');
pause(2);
});
describe('do it again', function() {
it('should verify that basic widgets work', function(){
navigateTo('widgets.html');
input('text.basic').enter('Carlos');
expect(binding('text.basic')).toEqual('Carlos');
pause(2);
input('text.basic').enter('Carlos Santana');
pause(2);
expect(binding('text.basic')).toEqual('Carlos Santana');
pause(2);
input('text.password').enter('secret');
expect(binding('text.password')).toEqual('secret');
expect(binding('text.hidden')).toEqual('hiddenValue');
expect(binding('gender')).toEqual('male');
pause(2);
input('gender').select('female');
expect(binding('gender')).toEqual('female');
pause(2);
});
});
it('should verify that basic widgets work', function(){
navigateTo('widgets.html');
input('text.basic').enter('Carlos');
expect(binding('text.basic')).toEqual('Carlos');
pause(2);
input('text.basic').enter('Carlos Santana');
pause(2);
expect(binding('text.basic')).toEqual('Carlos Santana');
pause(2);
input('text.password').enter('secret');
expect(binding('text.password')).toEqual('secret');
expect(binding('text.hidden')).toEqual('hiddenValue');
expect(binding('gender')).toEqual('male');
pause(2);
input('gender').select('female');
expect(binding('gender')).toEqual('female');
pause(2);
});
});