@@ -34,11 +34,14 @@ angular.scenario.dsl('sleep', function() {
3434 * browser().navigateTo(url) Loads the url into the frame
3535 * browser().navigateTo(url, fn) where fn(url) is called and returns the URL to navigate to
3636 * browser().reload() refresh the page (reload the same URL)
37- * browser().location().href() the full URL of the page
38- * browser().location().hash() the full hash in the url
39- * browser().location().path() the full path in the url
40- * browser().location().hashSearch() the hashSearch Object from angular
41- * browser().location().hashPath() the hashPath string from angular
37+ * browser().window.href() window.location.href
38+ * browser().window.path() window.location.pathname
39+ * browser().window.search() window.location.search
40+ * browser().window.hash() window.location.hash without # prefix
41+ * browser().location().url() see angular.service.$location#url
42+ * browser().location().path() see angular.service.$location#path
43+ * browser().location().search() see angular.service.$location#search
44+ * browser().location().hash() see angular.service.$location#hash
4245 */
4346angular . scenario . dsl ( 'browser' , function ( ) {
4447 var chain = { } ;
@@ -65,42 +68,60 @@ angular.scenario.dsl('browser', function() {
6568 } ) ;
6669 } ;
6770
68- chain . location = function ( ) {
71+ chain . window = function ( ) {
6972 var api = { } ;
7073
7174 api . href = function ( ) {
72- return this . addFutureAction ( 'browser url ' , function ( $window , $document , done ) {
75+ return this . addFutureAction ( 'window.location.href ' , function ( $window , $document , done ) {
7376 done ( null , $window . location . href ) ;
7477 } ) ;
7578 } ;
7679
80+ api . path = function ( ) {
81+ return this . addFutureAction ( 'window.location.path' , function ( $window , $document , done ) {
82+ done ( null , $window . location . pathname ) ;
83+ } ) ;
84+ } ;
85+
86+ api . search = function ( ) {
87+ return this . addFutureAction ( 'window.location.search' , function ( $window , $document , done ) {
88+ done ( null , $window . location . search ) ;
89+ } ) ;
90+ } ;
91+
7792 api . hash = function ( ) {
78- return this . addFutureAction ( 'browser url hash' , function ( $window , $document , done ) {
93+ return this . addFutureAction ( 'window.location. hash' , function ( $window , $document , done ) {
7994 done ( null , $window . location . hash . replace ( '#' , '' ) ) ;
8095 } ) ;
8196 } ;
8297
83- api . path = function ( ) {
84- return this . addFutureAction ( 'browser url path' , function ( $window , $document , done ) {
85- done ( null , $window . location . pathname ) ;
98+ return api ;
99+ } ;
100+
101+ chain . location = function ( ) {
102+ var api = { } ;
103+
104+ api . url = function ( ) {
105+ return this . addFutureAction ( '$location.url()' , function ( $window , $document , done ) {
106+ done ( null , $window . angular . scope ( ) . $service ( '$location' ) . url ( ) ) ;
86107 } ) ;
87108 } ;
88109
89- api . search = function ( ) {
90- return this . addFutureAction ( 'browser url search ' , function ( $window , $document , done ) {
91- done ( null , $window . angular . scope ( ) . $service ( '$location' ) . search ) ;
110+ api . path = function ( ) {
111+ return this . addFutureAction ( '$location.path() ' , function ( $window , $document , done ) {
112+ done ( null , $window . angular . scope ( ) . $service ( '$location' ) . path ( ) ) ;
92113 } ) ;
93114 } ;
94115
95- api . hashSearch = function ( ) {
96- return this . addFutureAction ( 'browser url hash search' , function ( $window , $document , done ) {
97- done ( null , $window . angular . scope ( ) . $service ( '$location' ) . hashSearch ) ;
116+ api . search = function ( ) {
117+ return this . addFutureAction ( '$location. search() ' , function ( $window , $document , done ) {
118+ done ( null , $window . angular . scope ( ) . $service ( '$location' ) . search ( ) ) ;
98119 } ) ;
99120 } ;
100121
101- api . hashPath = function ( ) {
102- return this . addFutureAction ( 'browser url hash path ' , function ( $window , $document , done ) {
103- done ( null , $window . angular . scope ( ) . $service ( '$location' ) . hashPath ) ;
122+ api . hash = function ( ) {
123+ return this . addFutureAction ( '$location. hash() ' , function ( $window , $document , done ) {
124+ done ( null , $window . angular . scope ( ) . $service ( '$location' ) . hash ( ) ) ;
104125 } ) ;
105126 } ;
106127
0 commit comments