@@ -228,7 +228,7 @@ describe("misc", () => {
228
228
cy . get ( ".dialog .close" ) . click ( ) ;
229
229
cy . contains ( "Changelog" ) . should ( "not.exist" ) ;
230
230
} ) ;
231
-
231
+
232
232
it ( "should display an error message if the changelog cannot be retrieved" , ( ) => {
233
233
cy . intercept ( "GET" , "/CHANGELOG.html" , { statusCode : 404 } ) . as ( "getChangelog" ) ;
234
234
cy . contains ( "Changelog" ) . should ( "not.exist" ) ;
@@ -237,5 +237,39 @@ describe("misc", () => {
237
237
cy . wait ( "@getChangelog" ) ;
238
238
cy . get ( ".dialog .changelog-error" ) . should ( "be.visible" ) ;
239
239
} ) ;
240
+
241
+ it ( "should only make one request to the changelog" , ( ) => {
242
+ const interceptedRequests = [ ] ;
243
+
244
+ // Intercept network requests to /CHANGELOG.html
245
+ cy . intercept ( "GET" , "/CHANGELOG.html" , ( req ) => {
246
+ interceptedRequests . push ( req ) ; // Track all intercepted requests
247
+ } ) . as ( "getChangelog" ) ;
248
+
249
+ // Initial state: no dialog visible
250
+ cy . contains ( "Changelog" ) . should ( "not.exist" ) ;
251
+
252
+ // First click: Request should be made
253
+ cy . get ( "#changelog-link" ) . click ( { force : true } ) ;
254
+
255
+ cy . wait ( "@getChangelog" ) . then ( ( ) => {
256
+ expect ( interceptedRequests ) . to . have . length ( 1 ) ; // Only one request should have been made
257
+ } ) ;
258
+
259
+ cy . get ( ".dialog" ) . contains ( "Changelog" ) . should ( "be.visible" ) ;
260
+
261
+ // Close the dialog
262
+ cy . get ( ".dialog .close" ) . click ( ) ;
263
+ cy . contains ( "Changelog" ) . should ( "not.exist" ) ;
264
+
265
+ // Second click: Request should not fire again
266
+ cy . get ( "#changelog-link" ) . click ( { force : true } ) ;
267
+ cy . get ( ".dialog" ) . contains ( "Changelog" ) . should ( "be.visible" ) ;
268
+
269
+ // Assert that only one request was made
270
+ cy . then ( ( ) => {
271
+ expect ( interceptedRequests ) . to . have . length ( 1 ) ; // Still only one request
272
+ } ) ;
273
+ } ) ;
240
274
} ) ;
241
275
} ) ;
0 commit comments