2010-10-08 23:43:40 +00:00
|
|
|
/**
|
|
|
|
|
* This class is the "this" of the it/beforeEach/afterEach method.
|
|
|
|
|
* Responsibilities:
|
|
|
|
|
* - "this" for it/beforeEach/afterEach
|
|
|
|
|
* - keep state for single it/beforeEach/afterEach execution
|
|
|
|
|
* - keep track of all of the futures to execute
|
|
|
|
|
* - run single spec (execute each future)
|
|
|
|
|
*/
|
|
|
|
|
angular.scenario.SpecRunner = function() {
|
|
|
|
|
this.futures = [];
|
2010-10-19 20:17:49 +00:00
|
|
|
this.afterIndex = 0;
|
2010-10-08 23:43:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Executes a spec which is an it block with associated before/after functions
|
|
|
|
|
* based on the describe nesting.
|
|
|
|
|
*
|
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-24 21:14:45 +00:00
|
|
|
* @param {Object} spec A spec object
|
2011-04-19 22:24:20 +00:00
|
|
|
* @param {Function} specDone function that is called when the spec finshes. Function(error, index)
|
2010-10-08 23:43:40 +00:00
|
|
|
*/
|
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-24 21:14:45 +00:00
|
|
|
angular.scenario.SpecRunner.prototype.run = function(spec, specDone) {
|
2010-10-19 20:17:49 +00:00
|
|
|
var self = this;
|
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-24 21:14:45 +00:00
|
|
|
this.spec = spec;
|
|
|
|
|
|
|
|
|
|
this.emit('SpecBegin', spec);
|
2010-10-19 22:34:58 +00:00
|
|
|
|
2010-10-08 23:43:40 +00:00
|
|
|
try {
|
2010-10-19 20:17:49 +00:00
|
|
|
spec.before.call(this);
|
|
|
|
|
spec.body.call(this);
|
|
|
|
|
this.afterIndex = this.futures.length;
|
|
|
|
|
spec.after.call(this);
|
2010-10-08 23:43:40 +00:00
|
|
|
} catch (e) {
|
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-24 21:14:45 +00:00
|
|
|
this.emit('SpecError', spec, e);
|
|
|
|
|
this.emit('SpecEnd', spec);
|
2010-10-08 23:43:40 +00:00
|
|
|
specDone();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2010-10-19 22:34:58 +00:00
|
|
|
|
2010-10-19 20:17:49 +00:00
|
|
|
var handleError = function(error, done) {
|
|
|
|
|
if (self.error) {
|
|
|
|
|
return done();
|
|
|
|
|
}
|
|
|
|
|
self.error = true;
|
|
|
|
|
done(null, self.afterIndex);
|
|
|
|
|
};
|
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-24 21:14:45 +00:00
|
|
|
|
2010-10-08 23:43:40 +00:00
|
|
|
asyncForEach(
|
2010-10-19 22:34:58 +00:00
|
|
|
this.futures,
|
2010-10-08 23:43:40 +00:00
|
|
|
function(future, futureDone) {
|
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-24 21:14:45 +00:00
|
|
|
self.step = future;
|
|
|
|
|
self.emit('StepBegin', spec, future);
|
2010-10-08 23:43:40 +00:00
|
|
|
try {
|
|
|
|
|
future.execute(function(error) {
|
2010-10-19 20:17:49 +00:00
|
|
|
if (error) {
|
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-24 21:14:45 +00:00
|
|
|
self.emit('StepFailure', spec, future, error);
|
|
|
|
|
self.emit('StepEnd', spec, future);
|
2010-10-19 20:17:49 +00:00
|
|
|
return handleError(error, futureDone);
|
|
|
|
|
}
|
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-24 21:14:45 +00:00
|
|
|
self.emit('StepEnd', spec, future);
|
2010-10-27 20:41:31 +00:00
|
|
|
self.$window.setTimeout(function() { futureDone(); }, 0);
|
2010-10-08 23:43:40 +00:00
|
|
|
});
|
|
|
|
|
} catch (e) {
|
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-24 21:14:45 +00:00
|
|
|
self.emit('StepError', spec, future, e);
|
|
|
|
|
self.emit('StepEnd', spec, future);
|
2010-10-19 20:17:49 +00:00
|
|
|
handleError(e, futureDone);
|
2010-10-08 23:43:40 +00:00
|
|
|
}
|
2010-10-19 22:34:58 +00:00
|
|
|
},
|
2010-10-08 23:43:40 +00:00
|
|
|
function(e) {
|
2010-10-19 20:17:49 +00:00
|
|
|
if (e) {
|
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-24 21:14:45 +00:00
|
|
|
self.emit('SpecError', spec, e);
|
2010-10-19 20:17:49 +00:00
|
|
|
}
|
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-24 21:14:45 +00:00
|
|
|
self.emit('SpecEnd', spec);
|
|
|
|
|
// Call done in a timeout so exceptions don't recursively
|
|
|
|
|
// call this function
|
|
|
|
|
self.$window.setTimeout(function() { specDone(); }, 0);
|
2010-10-08 23:43:40 +00:00
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds a new future action.
|
|
|
|
|
*
|
2010-10-19 20:17:49 +00:00
|
|
|
* Note: Do not pass line manually. It happens automatically.
|
|
|
|
|
*
|
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-24 21:14:45 +00:00
|
|
|
* @param {string} name Name of the future
|
|
|
|
|
* @param {Function} behavior Behavior of the future
|
|
|
|
|
* @param {Function} line fn() that returns file/line number
|
2010-10-08 23:43:40 +00:00
|
|
|
*/
|
2010-10-19 20:17:49 +00:00
|
|
|
angular.scenario.SpecRunner.prototype.addFuture = function(name, behavior, line) {
|
|
|
|
|
var future = new angular.scenario.Future(name, angular.bind(this, behavior), line);
|
2010-10-08 23:43:40 +00:00
|
|
|
this.futures.push(future);
|
|
|
|
|
return future;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds a new future action to be executed on the application window.
|
|
|
|
|
*
|
2010-10-19 20:17:49 +00:00
|
|
|
* Note: Do not pass line manually. It happens automatically.
|
|
|
|
|
*
|
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-24 21:14:45 +00:00
|
|
|
* @param {string} name Name of the future
|
|
|
|
|
* @param {Function} behavior Behavior of the future
|
|
|
|
|
* @param {Function} line fn() that returns file/line number
|
2010-10-08 23:43:40 +00:00
|
|
|
*/
|
2010-10-19 20:17:49 +00:00
|
|
|
angular.scenario.SpecRunner.prototype.addFutureAction = function(name, behavior, line) {
|
|
|
|
|
var self = this;
|
2010-10-08 23:43:40 +00:00
|
|
|
return this.addFuture(name, function(done) {
|
2010-10-19 20:17:49 +00:00
|
|
|
this.application.executeAction(function($window, $document) {
|
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-24 21:14:45 +00:00
|
|
|
|
|
|
|
|
//TODO(esprehn): Refactor this so it doesn't need to be in here.
|
2010-10-19 20:17:49 +00:00
|
|
|
$document.elements = function(selector) {
|
2010-10-18 21:02:18 +00:00
|
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
2010-11-01 23:51:15 +00:00
|
|
|
selector = (self.selector || '') + ' ' + (selector || '');
|
2010-11-09 07:26:36 +00:00
|
|
|
selector = _jQuery.trim(selector) || '*';
|
2011-01-08 06:02:23 +00:00
|
|
|
angular.forEach(args, function(value, index) {
|
2010-10-18 21:02:18 +00:00
|
|
|
selector = selector.replace('$' + (index + 1), value);
|
|
|
|
|
});
|
|
|
|
|
var result = $document.find(selector);
|
|
|
|
|
if (!result.length) {
|
|
|
|
|
throw {
|
|
|
|
|
type: 'selector',
|
|
|
|
|
message: 'Selector ' + selector + ' did not match any elements.'
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
2010-10-19 20:17:49 +00:00
|
|
|
};
|
2010-10-19 22:34:58 +00:00
|
|
|
|
2010-10-18 21:02:18 +00:00
|
|
|
try {
|
2010-10-19 20:17:49 +00:00
|
|
|
behavior.call(self, $window, $document, done);
|
2010-10-18 21:02:18 +00:00
|
|
|
} catch(e) {
|
|
|
|
|
if (e.type && e.type === 'selector') {
|
|
|
|
|
done(e.message);
|
|
|
|
|
} else {
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-10-19 20:17:49 +00:00
|
|
|
});
|
|
|
|
|
}, line);
|
2010-10-08 23:43:40 +00:00
|
|
|
};
|