pet.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. describe("render store api container", function () {
  2. let mainPage
  3. let apiWrapper
  4. beforeEach(function (client, done) {
  5. mainPage = client
  6. .url("localhost:3230")
  7. .page.main()
  8. client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
  9. .clearValue(".download-url-input")
  10. .setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
  11. .click("button.download-url-button")
  12. .pause(1000)
  13. apiWrapper = mainPage.section.apiWrapper
  14. done()
  15. })
  16. afterEach(function (client, done) {
  17. done()
  18. })
  19. it("test rendered store container", function (client) {
  20. apiWrapper.waitForElementVisible("@storeAPIWrapper", 5000)
  21. .expect.element("@storeAPIWrapper").to.be.visible
  22. client.end()
  23. })
  24. it("callapse store wrapper", function (client) {
  25. apiWrapper.waitForElementVisible("@storeAPIWrapper", 5000)
  26. .click("@storeAPIWrapperBar")
  27. .assert.cssClassNotPresent("@storeAPIWrapper", "is-open")
  28. client.end()
  29. })
  30. it("render get /store/inventory api container", function (client) {
  31. apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
  32. .assert.containsText("@storeOperationGetTitle", "/store/inventory")
  33. .click("@storeOperationGetCollpase")
  34. .waitForElementVisible("@storeOperationGetCollapseContainer", 5000)
  35. .click("@storeOperationGetTryBtn")
  36. .waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
  37. .click("@storeOperationGetTryBtn")
  38. .assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
  39. client.end()
  40. })
  41. it("Testing get /store/inventory api Mock data ", function (client) {
  42. apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
  43. .assert.containsText("@storeOperationGetTitle", "/store/inventory")
  44. .click("@storeOperationGetCollpase")
  45. .waitForElementVisible("@storeOperationGetCollapseContainer", 3000)
  46. .click("@storeOperationGetTryBtn")
  47. .waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
  48. .click("@storeOperationGetExecuteBtn")
  49. .waitForElementVisible("@storeOperationResponseProps1")
  50. .assert.containsText("@storeOperationResponseProps1", "0")
  51. .assert.containsText("@storeOperationResponseProps2", "0")
  52. .assert.containsText("@storeOperationResponseProps3", "0")
  53. .click("@storeOperationGetTryBtn")
  54. .assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
  55. client.end()
  56. })
  57. it("render post /store/order api container", function (client) {
  58. apiWrapper.waitForElementVisible("@storeOperationPostContainer")
  59. .assert.containsText("@storeOperationPostTitle", "/store/order")
  60. .click("@storeOperationPostCollpase")
  61. .waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
  62. .click("@storeOperationPostTryBtn")
  63. .waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
  64. .click("@storeOperationPostTryBtn")
  65. .assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
  66. client.end()
  67. })
  68. it("Testing post /store/order api Mock Data", function (client) {
  69. apiWrapper.waitForElementVisible("@storeOperationPostContainer")
  70. .assert.containsText("@storeOperationPostTitle", "/store/order")
  71. .click("@storeOperationPostCollpase")
  72. .waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
  73. .click("@storeOperationPostTryBtn")
  74. .waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
  75. .click("@storeOperationPostExecuteBtn")
  76. .waitForElementVisible("@storeOperationPostResponseId")
  77. .assert.containsText("@storeOperationPostResponseId", "0")
  78. .assert.containsText("@storeOperationPostResponsePetId", "0")
  79. .assert.containsText("@storeOperationPostResponseQuantity", "0")
  80. .assert.containsText("@storeOperationPostResponseStatus", "placed")
  81. .assert.containsText("@storeOperationPostResponseComplete", "false")
  82. .click("@storeOperationPostTryBtn")
  83. .assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
  84. client.end()
  85. })
  86. it("render delete /store/order/{orderId} api container", function (client) {
  87. apiWrapper.waitForElementVisible("@storeOperationDeleteContainer")
  88. .assert.containsText("@storeOperationDeleteTitle", "/store/order/{orderId}")
  89. .click("@storeOperationDeleteCollpase")
  90. .waitForElementVisible("@storeOperationDeleteCollapseContainer", 3000)
  91. .click("@storeOperationDeleteTryBtn")
  92. .waitForElementVisible("@storeOperationDeleteExecuteBtn", 1000)
  93. .click("@storeOperationDeleteExecuteBtn")
  94. .waitForElementVisible("@storeOperationGetResponseHeaders", "content-type: application/xml")
  95. .click("@storeOperationDeleteTryBtn")
  96. .assert.cssClassNotPresent("@storeOperationDeleteTryBtn", "cancel")
  97. client.end()
  98. })
  99. })