interface DeviceList { model : string ; width : number ; height : number ; } type Device = object ; type DeviceListArray = Device [ ] ; type Urls = string [ ] ; function prepareTestsForDevices ( deviceList ) { return function setPagesToTest ( pageList , callback ) : void { pageList . forEach ( ( page ) => { context ( `${ page }` , ( ) => { deviceList . forEach ( ( device ) => { context ( `Testing on ${ device . model }` , ( ) => { beforeEach ( ( ) => { cy . viewport ( device . width , device . height ) ; cy . visit ( page ) ; } ) ; callback ( ) ; } ) ; } ) ; } ) ; } ) ; } ; } module . exports = prepareTestsForDevices ;