@@ -21,27 +21,25 @@ describe('multidomain', () => {
2121 cy . get ( 'a' ) . click ( )
2222 } )
2323
24- it ( 'runs synchronous commands in secondary domain' , ( done ) => {
25- expectTextMessage ( 'From a secondary domain' , done )
26-
24+ it ( 'runs commands in secondary domain' , ( ) => {
2725 // @ts -ignore
2826 cy . switchToDomain ( '127.0.0.1:3501' , ( ) => {
29- // @ts -ignore
30- cy . now ( 'get' , ' [data-cy="dom-check"]') . then ( ( $el ) => {
31- top . postMessage ( { host : location . host , actual : $el . text ( ) } , '* ')
32- } )
27+ cy
28+ . get ( ' [data-cy="dom-check"]')
29+ . invoke ( 'text ')
30+ . should ( 'equal' , 'From a secondary domain' )
3331 } )
34- } )
3532
36- it ( 'sets up window.Cypress in secondary domain' , ( done ) => {
37- expectTextMessage ( 'Has window.Cypress' , done )
33+ cy . log ( 'after switchToDomain' )
34+ } )
3835
36+ it ( 'sets up window.Cypress in secondary domain' , ( ) => {
3937 // @ts -ignore
4038 cy . switchToDomain ( '127.0.0.1:3501' , ( ) => {
41- // @ts -ignore
42- cy . now ( 'get' , ' [data-cy="cypress-check"]') . then ( ( $el ) => {
43- top . postMessage ( { host : location . host , actual : $el . text ( ) } , '* ')
44- } )
39+ cy
40+ . get ( ' [data-cy="cypress-check"]')
41+ . invoke ( 'text ')
42+ . should ( 'equal' , 'Has window.Cypress' )
4543 } )
4644 } )
4745
@@ -55,10 +53,7 @@ describe('multidomain', () => {
5553 top . postMessage ( { host : location . host , actual : 'form:submitted' } , '*' )
5654 } )
5755
58- // @ts -ignore
59- cy . now ( 'get' , 'button[type=submit]' ) . then ( ( $el ) => {
60- $el . trigger ( 'click' )
61- } )
56+ cy . get ( 'form' ) . submit ( )
6257 } )
6358 } )
6459
@@ -71,8 +66,7 @@ describe('multidomain', () => {
7166 top . postMessage ( { host : location . host , actual : 'window:before:unload' } , '*' )
7267 } )
7368
74- // @ts -ignore
75- cy . now ( 'window' ) . then ( ( window ) => {
69+ cy . window ( ) . then ( ( window ) => {
7670 window . location . href = '/fixtures/multidomain.html'
7771 } )
7872 } )
@@ -87,8 +81,7 @@ describe('multidomain', () => {
8781 top . postMessage ( { host : location . host , actual : 'window:unload' } , '*' )
8882 } )
8983
90- // @ts -ignore
91- cy . now ( 'window' ) . then ( ( window ) => {
84+ cy . window ( ) . then ( ( window ) => {
9285 window . location . href = '/fixtures/multidomain.html'
9386 } )
9487 } )
@@ -103,8 +96,7 @@ describe('multidomain', () => {
10396 top . postMessage ( { host : location . host , actual : 'navigation:changed' } , '*' )
10497 } )
10598
106- // @ts -ignore
107- cy . now ( 'window' ) . then ( ( window ) => {
99+ cy . window ( ) . then ( ( window ) => {
108100 window . location . hash = '#hashbrowns'
109101 } )
110102 } )
@@ -119,8 +111,7 @@ describe('multidomain', () => {
119111 top . postMessage ( { host : location . host , actual : `window:alert ${ text } ` } , '*' )
120112 } )
121113
122- // @ts -ignore
123- cy . now ( 'get' , '[data-cy="alert"]' ) . then ( ( $el ) => {
114+ cy . get ( '[data-cy="alert"]' ) . then ( ( $el ) => {
124115 $el . trigger ( 'click' )
125116 } )
126117 } )
@@ -135,8 +126,7 @@ describe('multidomain', () => {
135126 top . postMessage ( { host : location . host , actual : `window:confirm ${ text } ` } , '*' )
136127 } )
137128
138- // @ts -ignore
139- cy . now ( 'get' , '[data-cy="confirm"]' ) . then ( ( $el ) => {
129+ cy . get ( '[data-cy="confirm"]' ) . then ( ( $el ) => {
140130 $el . trigger ( 'click' )
141131 } )
142132 } )
@@ -157,7 +147,7 @@ describe('multidomain', () => {
157147 } )
158148
159149 // @ts -ignore
160- cy . now ( ' get' , '[data-cy="confirm"]' ) . then ( ( $el ) => {
150+ cy . get ( '[data-cy="confirm"]' ) . then ( ( $el ) => {
161151 $el . trigger ( 'click' )
162152 } )
163153 } )
@@ -179,7 +169,7 @@ describe('multidomain', () => {
179169 Cypress . on ( 'window:confirm' , ( ) => { } )
180170
181171 // @ts -ignore
182- cy . now ( ' get' , '[data-cy="confirm"]' ) . then ( ( $el ) => {
172+ cy . get ( '[data-cy="confirm"]' ) . then ( ( $el ) => {
183173 $el . trigger ( 'click' )
184174 } )
185175 } )
0 commit comments