@@ -107,6 +107,16 @@ declare namespace Cypress {
107107 fromAutWindow : WindowPosition & { x : number , y : number }
108108 }
109109
110+ /**
111+ * Window type for Application Under Test(AUT)
112+ */
113+ type AUTWindow = Window & typeof globalThis & ApplicationWindow
114+
115+ /**
116+ * The interface for user-defined properties in Window object under test.
117+ */
118+ interface ApplicationWindow { } // tslint:disable-line
119+
110120 /**
111121 * Several libraries are bundled with Cypress by default.
112122 *
@@ -1038,7 +1048,7 @@ declare namespace Cypress {
10381048 *
10391049 * @see https://on.cypress.io/go
10401050 */
1041- go ( direction : HistoryDirection | number , options ?: Partial < Loggable & Timeoutable > ) : Chainable < Window >
1051+ go ( direction : HistoryDirection | number , options ?: Partial < Loggable & Timeoutable > ) : Chainable < AUTWindow >
10421052
10431053 /**
10441054 * Get the current URL hash of the page that is currently active.
@@ -1375,7 +1385,7 @@ declare namespace Cypress {
13751385 * @example
13761386 * cy.reload()
13771387 */
1378- reload ( options ?: Partial < Loggable & Timeoutable > ) : Chainable < Window >
1388+ reload ( options ?: Partial < Loggable & Timeoutable > ) : Chainable < AUTWindow >
13791389 /**
13801390 * Reload the page without cache
13811391 *
@@ -1386,7 +1396,7 @@ declare namespace Cypress {
13861396 * cy.visit('http://localhost:3000/admin')
13871397 * cy.reload(true)
13881398 */
1389- reload ( forceReload : boolean ) : Chainable < Window >
1399+ reload ( forceReload : boolean ) : Chainable < AUTWindow >
13901400
13911401 /**
13921402 * Make an HTTP GET request.
@@ -1929,8 +1939,8 @@ declare namespace Cypress {
19291939 * })
19301940 *
19311941 */
1932- visit ( url : string , options ?: Partial < VisitOptions > ) : Chainable < Window >
1933- visit ( options : Partial < VisitOptions > & { url : string } ) : Chainable < Window >
1942+ visit ( url : string , options ?: Partial < VisitOptions > ) : Chainable < AUTWindow >
1943+ visit ( options : Partial < VisitOptions > & { url : string } ) : Chainable < AUTWindow >
19341944
19351945 /**
19361946 * Wait for a number of milliseconds.
@@ -2001,7 +2011,7 @@ declare namespace Cypress {
20012011 })
20022012 ```
20032013 */
2004- window ( options ?: Partial < Loggable & Timeoutable > ) : Chainable < Window >
2014+ window ( options ?: Partial < Loggable & Timeoutable > ) : Chainable < AUTWindow >
20052015
20062016 /**
20072017 * Scopes all subsequent cy commands to within this element.
@@ -2715,16 +2725,16 @@ declare namespace Cypress {
27152725 /**
27162726 * Called before your page has loaded all of its resources.
27172727 *
2718- * @param {Window } contentWindow the remote page's window object
2728+ * @param {AUTWindow } contentWindow the remote page's window object
27192729 */
2720- onBeforeLoad ( win : Window ) : void
2730+ onBeforeLoad ( win : AUTWindow ) : void
27212731
27222732 /**
27232733 * Called once your page has fired its load event.
27242734 *
2725- * @param {Window } contentWindow the remote page's window object
2735+ * @param {AUTWindow } contentWindow the remote page's window object
27262736 */
2727- onLoad ( win : Window ) : void
2737+ onLoad ( win : AUTWindow ) : void
27282738
27292739 /**
27302740 * Cypress will automatically apply the right authorization headers
@@ -4632,12 +4642,12 @@ declare namespace Cypress {
46324642 * Fires as the page begins to load, but before any of your applications JavaScript has executed. This fires at the exact same time as `cy.visit()` `onBeforeLoad` callback. Useful to modify the window on a page transition.
46334643 * @see https://on.cypress.io/catalog-of-events#App-Events
46344644 */
4635- ( action : 'window:before:load' , fn : ( win : Window ) => void ) : void
4645+ ( action : 'window:before:load' , fn : ( win : AUTWindow ) => void ) : void
46364646 /**
46374647 * Fires after all your resources have finished loading after a page transition. This fires at the exact same time as a `cy.visit()` `onLoad` callback.
46384648 * @see https://on.cypress.io/catalog-of-events#App-Events
46394649 */
4640- ( action : 'window:load' , fn : ( win : Window ) => void ) : void
4650+ ( action : 'window:load' , fn : ( win : AUTWindow ) => void ) : void
46414651 /**
46424652 * Fires when your application is about to navigate away. The real event object is provided to you. Your app may have set a `returnValue` on the event, which is useful to assert on.
46434653 * @see https://on.cypress.io/catalog-of-events#App-Events
0 commit comments