Commit graph

21 commits

Author SHA1 Message Date
Elliott Sprehn
40d7e66f40 Lots of bug fixes in the scenario runner and a bunch of new features.
- By default the runner now creates multiple output formats as it runs. Nodes are created in the DOM with ids: json, xml, and html.

ex. $('#json').html() => json output of the runner
ex. $('#xml').html() => json output of the runner

$result is also an object tree result.

The permitted formats are html,json,xml,object.

If you don't want certain formats you can select specific ones with the new ng:scenario-output attribute on the script tag.

<script src="angular-scenario.js" ng:scenario-output="xml,json">

- Added element(...).count() that returns the number of matching elements for the selector.

- repeater(...).count() now returns 0 if no elements matched which can be used to check if a repeater is empty.

- Added toBe() matcher that does strict equality with ===

- Implement iit and ddescribe. If iit() is used instead of it() then only that test will run. If ddescribe() is used instead of describe() them only it() statements inside of it will run. Several iit/ddescribe() blocks can be used to run isolated tests.

- Implement new event based model for SpecRunner. You can now listen for events in the runner. This is useful for writing your own UI or connecting a remote process (ex. WebDriver). Event callbacks execute on the Runner instance.

Events, if fired, will always be in the below order. All events always happen
except for Failure and Error events which only happen in error conditions.

Events:
  RunnerBegin
  SpecBegin(spec)
  StepBegin(spec, step)
  StepError(spec, step, error)
  StepFailure(spec, step, error)
  StepEnd(spec, step)
  SpecError(spec, step, error)
  SpecEnd(spec)
  RunnerEnd

- Only allow the browser to repaint every 10 steps. Cuts 700ms off Firefox in benchmark, 200ms off Chrome.

- Bug Fix: Manually navigate anchors on click since trigger wont work in Firefox.
2010-10-26 15:17:57 -07:00
Misko Hevery
6ddcf91861 Fix test which was causing the Chrome runner to fail. Upgraded JSTD to latest. Cleanup whitespace. 2010-10-23 13:12:45 -07:00
Elliott Sprehn
2115db6903 Lots of stability and performance updates and UI polish too.
Polish the Scenario Runner UI to include:
- a scroll pane that steps appear in since the list can be very long
- Collapse successful tests
- Show the line where the DSL statements were when there's an error (Chrome, Firefox)

Also:
- Remove lots angular.bind calls to reduce the amount of stack space used.
- Use setTimeout(...,0) to schedule the next future to let the browser breathe and have it repaint the steps. Also prevents overflowing the stack when an it() creates many futures.
- Run afterEach() handlers even if the it() block fails.
- Make navigateTo() take a function as the second argument so you can compute a URL in the future.
- Add wait() DSL statement to allow interactive debugging of tests.
- Allow custom jQuery selectors with element(...).query(fn) DSL statement.

Known Issues:
- All afterEach() handlers run even if a beforeEach() handler fails. Only after handlers for the same level as the failure and above should run.
2010-10-20 14:38:00 -07:00
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
Misko Hevery
894ffadc8c Fixed all trivial jslint violations 2010-09-14 23:22:15 +02:00
Shyam Seshadri
86c2ef87d5 Inject jquery into future scope, and rename outer scenario to _window, which is what it is 2010-08-10 10:48:31 -07:00
Andres Ornelas
ef88eb9a71 refactoring done but Expect not working 2010-07-27 17:04:37 -07:00
Andres Ornelas
e8b477f5b1 text context extracted 2010-07-27 16:02:51 -07:00
Andres Ornelas
32c4aee1cd before pulling testcontext out 2010-07-27 15:53:55 -07:00
Andres Ornelas
da95010350 stable before refactoring 2010-07-27 15:43:14 -07:00
Andres Ornelas
b42072733c Merge branch 'master' of github.com:angular/angular.js into future 2010-07-27 10:44:46 -07:00
Misko Hevery
00bb790392 fixed IE tests 2010-07-08 15:55:00 -07:00
Andres Ornelas
9d8646b0d1 all tests passing with new futures concept 2010-06-30 09:51:54 -07:00
Andres Ornelas
fdc0bb232a add test for error in afterEach 2010-06-29 11:15:41 -07:00
Andres Ornelas
70c3dc8166 expose e2e test results 2010-06-22 17:15:14 -07:00
Andres Ornelas
85fac4d78c add beforeEach and afterEach to scenario DSL 2010-06-09 14:12:54 -07:00
Andres Ornelas
fe03ea0d1f add repeater DSL and fix typo 2010-06-09 12:35:40 -07:00
Andres Ornelas
3fab5d9879 added error handling on scenario definition 2010-05-24 15:25:30 -07:00
Andres Ornelas Mesta
f6c67e28c9 happy 2010-05-24 13:54:32 -07:00
Misko Hevery
e3368e12a6 semi working state 2010-05-20 16:55:47 -07:00
Misko Hevery
5215e2095c basic end to end runner 2010-05-20 15:55:41 -07:00