Kubeusz

Untitled

Oct 16th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1.  
  2. import scala.concurrent.duration._
  3.  
  4. import io.gatling.core.Predef._
  5. import io.gatling.http.Predef._
  6. import io.gatling.jdbc.Predef._
  7.  
  8. class logingood extends Simulation {
  9.  
  10. val httpProtocol = http
  11. .baseUrl("https://webapi.wage.iteodev.com")
  12. .inferHtmlResources()
  13. .userAgentHeader("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36")
  14. .proxy(Proxy("localhost", 8888).httpsPort(8888))
  15.  
  16. val headers_0 = Map(
  17. "Accept" -> "application/json, text/plain, */*",
  18. "Origin" -> "https://frontend.iteodev.com",
  19. "Sec-Fetch-Mode" -> "cors")
  20.  
  21. val headers_1 = Map(
  22. "Access-Control-Request-Headers" -> "authorization",
  23. "Access-Control-Request-Method" -> "GET",
  24. "Origin" -> "https://frontend.iteodev.com",
  25. "Sec-Fetch-Mode" -> "cors")
  26.  
  27. val headers_2 = Map(
  28. "Accept" -> "application/json, text/plain, */*",
  29. "Origin" -> "https://frontend.iteodev.com",
  30. "Sec-Fetch-Mode" -> "cors",
  31. "authorization" -> "Bearer ${authToken}")
  32.  
  33.  
  34. val headers_3 = Map("Sec-Fetch-Mode" -> "no-cors")
  35.  
  36. val headers_7 = Map(
  37. "Origin" -> "https://frontend.iteodev.com",
  38. "Sec-Fetch-Mode" -> "cors",
  39. "content-type" -> "application/x-www-form-urlencoded; charset=UTF-8")
  40.  
  41. val uri1 = "https://api.wage.iteodev.com/signalr"
  42. val uri2 = "https://frontend.iteodev.com/static/media/download-app-headline.a2c2b312.svg"
  43.  
  44. val scn = scenario("logingood")
  45. .exec(http("request_0")
  46. .post("/api/oauth/token")
  47. .headers(headers_0)
  48. .formParam("username", "[email protected]")
  49. .formParam("password", "Zaq1@wsx")
  50. .formParam("grant_type", "password")
  51. .check(jsonPath("$..access_token").exists.saveAs("authToken"))
  52. .resources(http("request_1")
  53. .options("/api/account")
  54. .headers(headers_1),
  55. http("request_2")
  56. .get("/api/account")
  57. .headers(headers_2),
  58. http("request_3")
  59. .get(uri2)
  60. .headers(headers_3),
  61. http("request_4")
  62. .options("/api/conversations/")
  63. .headers(headers_1),
  64. http("request_5")
  65. .get("/api/conversations/")
  66. .headers(headers_2),
  67. http("request_6")
  68. .options("/api/notifications")
  69. .headers(headers_1)))
  70.  
  71. .exec(http("request_7")
  72. .get(uri1 + "/negotiate?clientProtocol=1.5&Authorization=Bearer%20${authToken}&connectionData=%5B%7B%22name%22%3A%22livechat%22%7D%5D")
  73. .headers(headers_7),
  74. http("request_8")
  75. .get("/api/notifications")
  76. .headers(headers_2),
  77. http("request_9")
  78. .get(uri1 + "/start?transport=serverSentEvents&clientProtocol=1.5&Authorization=Bearer%20${authToken}&connectionToken=${MyConnectionToken}&connectionData=%5B%7B%22name%22%3A%22livechat%22%7D%5D")
  79. .headers(headers_7))
  80.  
  81.  
  82. setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
  83. }
Advertisement
Add Comment
Please, Sign In to add comment