import { assert } from "chai" ; import { ProcessDetector } from "@itwin/core-bentley" ; import { BentleyCloudRpcManager , RpcConfiguration } from "@itwin/core-common" ; import { rpcInterfaces } from "../common/RpcInterfaces" ; RpcConfiguration . developmentMode = true ; RpcConfiguration . disableRoutingValidation = true ; if ( ! ProcessDetector . isElectronAppFrontend ) { const config = BentleyCloudRpcManager . initializeClient ( { info : { title : "full-stack-test" , version : "v1.0" } } , rpcInterfaces ) ; config . protocol . pathPrefix = `http://${ window . location . hostname }:${ Number ( window . location . port ) + 2000 }` ; describe ( "Web Test Fixture" , ( ) => { it ( "Backend server should be accessible" , async ( ) => { const req = new XMLHttpRequest ( ) ; req . open ( "GET" , `${ config . protocol . pathPrefix }/v3/swagger.json` ) ; const loaded = new Promise ( ( resolve ) => req . addEventListener ( "load" , resolve ) ) ; req . send ( ) ; await loaded ; assert . equal ( 200 , req . status ) ; const desc = JSON . parse ( req . responseText ) ; assert . equal ( desc . info . title , "full-stack-test" ) ; assert . equal ( desc . info . version , "v1.0" ) ; } ) ; } ) ; }