package getit import scala.concurrent.duration._ import io.gatling.core.Predef._ import io.gatling.http.Predef._ import io.gatling.jdbc.Predef._ class new4 extends Simulation { val server :String = "v217s08r2643" val port :String = "8080" val cPath :String = "getit" val baseurl = s"http://$server:$port/$cPath" val wsurl = s"ws://$server:$port/$cPath" val httpProtocol = http .baseURL(baseurl) .inferHtmlResources(BlackList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.(t|o)tf""", """.*\.png"""), WhiteList()) .acceptHeader("""*/*""") .acceptHeader("""*/*""") .acceptEncodingHeader("""gzip,deflate,sdch""") .acceptLanguageHeader("""en-GB,en-US;q=0.8,en;q=0.6""") .connection("""keep-alive""") .contentTypeHeader("""application/x-www-form-urlencoded""") .userAgentHeader("""Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36""") .wsBaseURL(wsurl) val headers_1 = Map( """Accept-Encoding""" -> """gzip,deflate""", """Origin""" -> """http://v217s08r2643:8080""") val headers_2 = Map( """Origin""" -> baseurl, """Host""" -> """v217s08r2643:8080""") val epoch = System.currentTimeMillis() val uri1 = baseurl val scn = scenario("new4") .exec(http("Get CSRF Token") .post(uri1 + """/?v-""" + epoch) .headers(headers_1) .formParam("""v-browserDetails""", """1""") .formParam("""v-loc""", """http%3A%2F%2Fv217s08r2643%3A8080%2Fgetit%2F""") .check(regex("""Vaadin-Security-Key\\":\\"([^\\]+)""").saveAs("seckey"))) .exec( http("Get Atmo Key") .get(uri1 + "/PUSH/?v-uiId=0&v-csrfToken=${seckey}&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.5.vaadin4-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true") .headers(headers_2) .check(header("X-Atmosphere-tracking-id").saveAs("atmokey"))) .exec(ws("Open Push Channel") .open("/PUSH/?v-uiId=0&v-csrfToken=${seckey}&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.5.vaadin4-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true") .headers(headers_2)) .exec(ws("Login") .sendText("""523|{"csrfToken":"${seckey}", "rpc":[["0","com.vaadin.shared.ui.ui.UIServerRpc","resize",["968","1280","1280","968"]],["10","v","v",["text",["s","jamie"]]],["10","v","v",["c",["i","5"]]],["11","v","v",["text",["s","jamie"]]],["11","v","v",["c",["i","5"]]],["12","com.vaadin.shared.ui.button.ButtonServerRpc","click",[{"metaKey":false, "altKey":false, "ctrlKey":false, "relativeX":"29", "relativeY":"27", "clientY":"476", "clientX":"796", "shiftKey":false, "button":"LEFT", "type":"1"}]]], "syncId":1}""") .check(wsAwait.within(15).until(1).regex("Maintain")) .check(wsAwait.within(15).until(1).regex("Data Entry")) .check(wsAwait.within(15).until(1).regex("Searches")) .check(wsAwait.within(15).until(1).regex("""(..)\",\"org.jamie.web.frontend.navigation.circle.rpc.ServerToClientRpc""").saveAs("location"))) .pause(2) .exec(ws("Intermediate step") .sendText("""353|{"csrfToken":"${seckey}", "rpc":[["2","com.vaadin.ui.JavaScript$JavaScriptCallbackRpc","call",["notvitic.navigation.ViewsNavigator.containersSwapped",["org_jamie_web_frontend_navigation_containers_FullScreenContainer","org_jamie_web_frontend_navigation_containers_BreadcrumbsAndContentContainer"]]]], "syncId":2}""")) .exec(ws("Search") .sendText("""182|{"csrfToken":"${seckey}", "rpc":[["${location}","org.jamie.web.frontend.navigation.circle.rpc.ClientToServerRpc","notifyUriChanged",[""\/search""]]], "syncId":3}""") setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol) }