angular.js/test/scenario/output/jsonSpec.js
Vojta Jina 1abdc097b2 JSTD adapter for running e2e tests
Couple of changes into angular.scenario runner:
 - add autotest config (runs tests when document ready)
 - update ObjectModel (forwards events)
 - use only one ObjectModel instance for all outputters
 - expose error msg and line number in ObjectModel.Spec and ObjectModel.Step
 - fix generating spec.ids
 - fix 'html' output so that it does not mutate ObjectModel

Couple of changes into docs / generator:
 - rename copy -> copyTpl
 - move docs/static into docs/examples (to avoid conflict with jstd proxy)

Running all docs e2e tests:
========================================================
1/ compile angular-scenario, jstd-scenario-adapter
>> rake compile

2/ build docs
>> rake docs

3/ start jstd server
>> ./server-scenario.sh

4/ capture some browser

5/ run node server to serve static content
>> node ../lib/nodeserver/server.js

6/ run tests
>> ./test-scenario.sh
2011-05-19 09:43:56 -07:00

35 lines
972 B
JavaScript

describe('angular.scenario.output.json', function() {
var output, context;
var runner, model, $window;
var spec, step;
beforeEach(function() {
$window = {};
context = _jQuery('<div></div>');
runner = new angular.scenario.testing.MockRunner();
model = new angular.scenario.ObjectModel(runner);
output = angular.scenario.output.json(context, runner, model);
spec = {
name: 'test spec',
definition: {
id: 10,
name: 'describe'
}
};
step = {
name: 'some step',
line: function() { return 'unknown:-1'; }
};
});
it('should put json in context on RunnerEnd', function() {
runner.emit('SpecBegin', spec);
runner.emit('StepBegin', spec, step);
runner.emit('StepEnd', spec, step);
runner.emit('SpecEnd', spec);
runner.emit('RunnerEnd');
expect(angular.fromJson(context.html()).children['describe']
.specs['test spec'].status).toEqual('success');
});
});