File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
examples/stubbing-spying__window-fetch/cypress/integration Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 22// @ts -check
33
44describe ( 'stubbing' , function ( ) {
5+ it ( 'shows no Response message' , ( ) => {
6+ cy . visit ( '/' , {
7+ onBeforeLoad ( win ) {
8+ cy . stub ( win , 'fetch' ) . withArgs ( '/favorite-fruits' )
9+ . resolves ( {
10+ ok : true ,
11+ json : ( ) => [ ] ,
12+ } )
13+ } ,
14+ } )
15+
16+ cy . contains ( 'No favorites' ) . should ( 'be.visible' )
17+ } )
18+
519 it ( 'directly stubs window.fetch to test loading indicator' , ( ) => {
620 // stub the "fetch(/favorite-fruits)" call from the app
721 cy . visit ( '/' , {
@@ -113,6 +127,7 @@ describe('stubbing', function () {
113127 url : '/favorite-fruits' ,
114128 status : 500 ,
115129 response : '' ,
130+ delay : 2000 ,
116131 headers : {
117132 'status-text' : 'Orchard under maintenance' ,
118133 } ,
You can’t perform that action at this time.
0 commit comments