aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--example/personalLog/scenario/personalLogScenario.js3
-rw-r--r--src/scenario/dsl.js11
-rw-r--r--test/scenario/dslSpec.js11
3 files changed, 23 insertions, 2 deletions
diff --git a/example/personalLog/scenario/personalLogScenario.js b/example/personalLog/scenario/personalLogScenario.js
index 09ceae28..4b6d4ae5 100644
--- a/example/personalLog/scenario/personalLogScenario.js
+++ b/example/personalLog/scenario/personalLogScenario.js
@@ -64,8 +64,7 @@ describe('personal log', function() {
element('form input[type="submit"]').click();
expect(repeater('ul li').count()).toEqual(1);
- browser().navigateTo('about:blank');
- browser().navigateTo('../personalLog.html');
+ browser().reload();
expect(repeater('ul li').column('log.msg')).toEqual('my persistent message');
expect(repeater('ul li').count()).toEqual(1);
diff --git a/src/scenario/dsl.js b/src/scenario/dsl.js
index b2270cea..4ac91068 100644
--- a/src/scenario/dsl.js
+++ b/src/scenario/dsl.js
@@ -31,6 +31,7 @@ angular.scenario.dsl('pause', function() {
* Usage:
* browser().navigateTo(url) Loads the url into the frame
* browser().navigateTo(url, fn) where fn(url) is called and returns the URL to navigate to
+ * browser().reload() refresh the page (reload the same URL)
* browser().location().href() the full URL of the page
* browser().location().hash() the full hash in the url
* browser().location().path() the full path in the url
@@ -52,6 +53,16 @@ angular.scenario.dsl('browser', function() {
});
};
+ chain.reload = function() {
+ var application = this.application;
+ return this.addFutureAction('browser reload', function($window, $document, done) {
+ var href = $window.location.href;
+ application.navigateTo(href, function() {
+ done(null, href);
+ }, done);
+ });
+ };
+
chain.location = function() {
var api = {};
diff --git a/test/scenario/dslSpec.js b/test/scenario/dslSpec.js
index cc002612..d06c3ec9 100644
--- a/test/scenario/dslSpec.js
+++ b/test/scenario/dslSpec.js
@@ -88,6 +88,17 @@ describe("angular.scenario.dsl", function() {
});
describe('Browser', function() {
+ describe('Reload', function() {
+ it('should navigateTo', function() {
+ $window.location = {
+ href: '#foo'
+ };
+ $root.dsl.browser().reload();
+ expect($root.futureResult).toEqual('#foo');
+ expect($window.location).toEqual('#foo');
+ });
+ });
+
describe('NavigateTo', function() {
it('should allow a string url', function() {
$root.dsl.browser().navigateTo('http://myurl');