1+ interface Page {
2+ url : string ;
3+ name : string ;
4+ }
5+
6+ interface Interception {
7+ response ?: {
8+ statusCode : number ;
9+ } ;
10+ request : {
11+ url : string ;
12+ } ;
13+ }
14+
115describe ( "Documentation Page Images" , ( ) => {
2- const pages = [
16+ const pages : Page [ ] = [
317 { url : "/docs" , name : "Install and Quick start" } ,
418 { url : "/docs/doc-table-instance-creation" , name : "Create Table Instance" } ,
519 { url : "/docs/doc-adding-rows" , name : "Adding Rows" } ,
@@ -28,7 +42,7 @@ describe("Documentation Page Images", () => {
2842 cy . intercept ( 'GET' , '/img/**/*' ) . as ( 'imageRequest' ) ;
2943 } ) ;
3044
31- pages . forEach ( page => {
45+ pages . forEach ( ( page : Page ) => {
3246 it ( `should load all images properly on ${ page . name } page` , ( ) => {
3347 let imageRequestCount = 0 ;
3448
@@ -51,7 +65,7 @@ describe("Documentation Page Images", () => {
5165 cy . get ( 'img' , { timeout : 10000 } ) . should ( 'exist' ) ;
5266
5367 // Get all images and verify their loading
54- cy . get ( 'img' ) . then ( $images => {
68+ cy . get ( 'img' ) . then ( ( $images ) => {
5569 // Verify each image
5670 cy . wrap ( $images ) . each ( ( $img , index ) => {
5771 // Create a unique alias for this image
@@ -60,9 +74,10 @@ describe("Documentation Page Images", () => {
6074
6175 // Wait for the image to be loaded
6276 cy . get ( `@${ imgId } ` ) . should ( ( $img ) => {
63- expect ( $img [ 0 ] . complete ) . to . be . true ;
64- expect ( $img [ 0 ] . naturalWidth ) . to . be . greaterThan ( 0 ) ;
65- expect ( $img [ 0 ] . naturalHeight ) . to . be . greaterThan ( 0 ) ;
77+ const img = $img [ 0 ] as HTMLImageElement ;
78+ expect ( img . complete ) . to . be . true ;
79+ expect ( img . naturalWidth ) . to . be . greaterThan ( 0 ) ;
80+ expect ( img . naturalHeight ) . to . be . greaterThan ( 0 ) ;
6681 } ) ;
6782
6883 // Verify src attribute
@@ -73,9 +88,10 @@ describe("Documentation Page Images", () => {
7388 } ) ;
7489
7590 // Verify all image requests were successful
76- cy . get ( '@imageRequestCounter.all' ) . then ( ( interceptions ) => {
77- if ( interceptions . length > 0 ) {
78- interceptions . forEach ( ( interception ) => {
91+ cy . get ( '@imageRequestCounter.all' ) . then ( ( interceptions : unknown ) => {
92+ const interceptArray = interceptions as Interception [ ] ;
93+ if ( interceptArray . length > 0 ) {
94+ interceptArray . forEach ( ( interception ) => {
7995 if ( interception . response ) {
8096 expect ( [ 200 , 304 ] ) . to . include ( interception . response . statusCode ) ;
8197 } else {
@@ -120,8 +136,9 @@ describe("Documentation Page Images", () => {
120136 cy . wrap ( $img ) . as ( imgId ) ;
121137
122138 cy . get ( `@${ imgId } ` ) . then ( ( $img ) => {
123- const naturalWidth = $img [ 0 ] . naturalWidth ;
124- const naturalHeight = $img [ 0 ] . naturalHeight ;
139+ const img = $img [ 0 ] as HTMLImageElement ;
140+ const naturalWidth = img . naturalWidth ;
141+ const naturalHeight = img . naturalHeight ;
125142
126143 // Images should have reasonable dimensions
127144 expect ( naturalWidth ) . to . be . within ( 50 , 2000 ) ;
0 commit comments