@@ -4,6 +4,9 @@ import $errUtils from '../../cypress/error_utils'
4
4
5
5
export default ( Commands , Cypress , cy ) => {
6
6
Commands . addQuery ( 'url' , function url ( options : Partial < Cypress . UrlOptions > = { } ) {
7
+ // Make sure the url command can communicate with the AUT.
8
+ // otherwise, it yields an empty string
9
+ Cypress . ensure . commandCanCommunicateWithAUT ( cy )
7
10
this . set ( 'timeout' , options . timeout )
8
11
9
12
Cypress . log ( { message : '' , hidden : options . log === false , timeout : options . timeout } )
@@ -16,6 +19,8 @@ export default (Commands, Cypress, cy) => {
16
19
} )
17
20
18
21
Commands . addQuery ( 'hash' , function url ( options : Partial < Cypress . Loggable & Cypress . Timeoutable > = { } ) {
22
+ // Make sure the hash command can communicate with the AUT.
23
+ Cypress . ensure . commandCanCommunicateWithAUT ( cy )
19
24
this . set ( 'timeout' , options . timeout )
20
25
21
26
Cypress . log ( { message : '' , hidden : options . log === false , timeout : options . timeout } )
@@ -26,6 +31,10 @@ export default (Commands, Cypress, cy) => {
26
31
Commands . addQuery ( 'location' , function location ( key , options : Partial < Cypress . Loggable & Cypress . Timeoutable > = { } ) {
27
32
// normalize arguments allowing key + options to be undefined
28
33
// key can represent the options
34
+
35
+ // Make sure the location command can communicate with the AUT.
36
+ // otherwise the command just yields 'null' and the reason may be unclear to the user.
37
+ Cypress . ensure . commandCanCommunicateWithAUT ( cy )
29
38
if ( _ . isObject ( key ) ) {
30
39
options = key
31
40
}
0 commit comments