Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

216 linhas
10 KiB

  1. describe("render pet 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("render section", function (client) {
  20. mainPage.expect.section("@apiWrapper").to.be.visible.before(10000)
  21. client.end()
  22. })
  23. it("test rendered pet container", function (client) {
  24. apiWrapper.waitForElementVisible("@petAPIWrapper", 5000)
  25. .expect.element("@petAPIWrapper").to.be.visible
  26. client.end()
  27. })
  28. it("collapse pet wrapper", function (client) {
  29. apiWrapper.waitForElementVisible("@petAPIWrapper", 5000)
  30. .click("@petAPIWrapperBar")
  31. .assert.cssClassNotPresent("@petAPIWrapper", "is-open")
  32. client.end()
  33. })
  34. it("render post /pet api container", function (client) {
  35. apiWrapper.waitForElementVisible("@petOperationPostContainer", 10000)
  36. .assert.containsText("@petOperationPostTitle", "/pet")
  37. .click("@petOperationPostCollpase")
  38. .waitForElementVisible("@petOperationPostCollapseContainer", 5000)
  39. .click("@petOperationPostTryBtn")
  40. .waitForElementVisible("@petOperationPostTryText", 1000)
  41. .waitForElementVisible("@petOperationPostExecuteBtn", 1000)
  42. .click("@petOperationPostTryBtn")
  43. .assert.cssClassNotPresent("@petOperationPostTryBtn", "cancel")
  44. client.end()
  45. })
  46. it("Testing post /pet api Mock data", function (client) {
  47. apiWrapper.waitForElementVisible("@petOperationPostContainer", 5000)
  48. .click("@petOperationPostCollpase")
  49. .waitForElementVisible("@petOperationPostCollapseContainer", 5000)
  50. .click("@petOperationPostTryBtn")
  51. .waitForElementVisible("@petOperationPostExecuteBtn", 1000)
  52. .click("@petOperationPostExecuteBtn")
  53. .waitForElementVisible("@petOperationPostMockCategoryID", 2000)
  54. .assert.containsText("@petOperationPostMockCategoryID", "0")
  55. .assert.containsText("@petOperationPostMockCategoryName", "\"string\"")
  56. .assert.containsText("@petOperationPostMockName", "\"doggie\"")
  57. .assert.containsText("@petOperationPostTagID", "0")
  58. .assert.containsText("@petOperationPostTagName", "\"string\"")
  59. .assert.containsText("@petOperationPostStatus", "\"available\"")
  60. .click("@petOperationPostTryBtn")
  61. .assert.cssClassNotPresent("@petOperationPostTryBtn", "cancel")
  62. client.end()
  63. })
  64. it("Testing post /pet api model values", function (client) {
  65. apiWrapper.waitForElementVisible("@petOperationPostContainer", 5000)
  66. .click("@petOperationPostCollpase")
  67. .waitForElementVisible("@petOperationPostCollapseContainer", 5000)
  68. .click("a.tablinks[data-name=model]")
  69. .assert.containsText("span.model-title > .model-title__text", `Pet`)
  70. client.end()
  71. })
  72. it("render put /pet api container", function (client) {
  73. apiWrapper.waitForElementVisible("@petOperationPutContainer", 5000)
  74. .assert.containsText("@petOperationPutTitle", "/pet")
  75. .click("@petOperationPutCollpase")
  76. .waitForElementVisible("@petOperationPutCollapseContainer", 3000)
  77. .click("@petOperationPutTryBtn")
  78. .waitForElementVisible("@petOperationPutTryText", 1000)
  79. .waitForElementVisible("@petOperationPutExecuteBtn", 1000)
  80. .click("@petOperationPutTryBtn")
  81. .assert.cssClassNotPresent("@petOperationPutTryBtn", "cancel")
  82. client.end()
  83. })
  84. it("Testing put /pet api Mock data", function (client) {
  85. apiWrapper.waitForElementVisible("@petOperationPutContainer", 5000)
  86. .click("@petOperationPutCollpase")
  87. .waitForElementVisible("@petOperationPutCollapseContainer", 3000)
  88. .click("@petOperationPutTryBtn")
  89. .waitForElementVisible("@petOperationPutExecuteBtn", 1000)
  90. .click("@petOperationPutExecuteBtn")
  91. .waitForElementVisible("@petOperationPutMockCategoryID")
  92. .assert.containsText("@petOperationPutMockCategoryID", "0")
  93. .assert.containsText("@petOperationPutMockCategoryName", "\"string\"")
  94. .assert.containsText("@petOperationPutMockName", "\"doggie\"")
  95. .assert.containsText("@petOperationPutTagID", "0")
  96. .assert.containsText("@petOperationPutTagName", "\"string\"")
  97. .assert.containsText("@petOperationPutStatus", "\"available\"")
  98. .click("@petOperationPutTryBtn")
  99. .assert.cssClassNotPresent("@petOperationPutTryBtn", "Cancel")
  100. client.end()
  101. })
  102. it("render get by tag /pet api container", function (client) {
  103. apiWrapper.waitForElementVisible("@petOperationGetByTagContainer", 5000)
  104. .assert.containsText("@petOperationGetByTagTitle", "/pet/findByTags")
  105. .click("@petOperationGetByTagCollpase")
  106. .waitForElementVisible("@petOperationGetByTagCollapseContainer", 3000)
  107. .click("@petOperationGetByTagTryBtn")
  108. .waitForElementVisible("@petOperationGetByTagTryAdded", 1000)
  109. .waitForElementVisible("@petOperationGetByTagExecuteBtn", 1000)
  110. .click("@petOperationGetByTagTryBtn")
  111. .assert.cssClassNotPresent("@petOperationGetByTagTryBtn", "cancel")
  112. client.end()
  113. })
  114. it("Testing get by tag /pet api Mock data", function (client) {
  115. apiWrapper.waitForElementVisible("@petOperationGetByTagContainer", 5000)
  116. .click("@petOperationGetByTagCollpase")
  117. .waitForElementVisible("@petOperationGetByTagCollapseContainer", 3000)
  118. .click("@petOperationGetByTagTryBtn")
  119. .waitForElementVisible("@petOperationGetByTagExecuteBtn", 1000)
  120. .click("@petOperationGetByTagExecuteBtn")
  121. .waitForElementVisible("@petOperationGetByTagMockCategoryID")
  122. .assert.containsText("@petOperationGetByTagMockCategoryID", "0")
  123. .assert.containsText("@petOperationGetByTagMockCategoryName", "\"string\"")
  124. .assert.containsText("@petOperationGetByTagMockName", "\"doggie\"")
  125. .assert.containsText("@petOperationGetByTagTagID", "0")
  126. .assert.containsText("@petOperationGetByTagTagName", "\"string\"")
  127. .assert.containsText("@petOperationGetByTagStatus", "\"available\"")
  128. .click("@petOperationGetByTagTryBtn")
  129. .assert.cssClassNotPresent("@petOperationGetByTagTryBtn", "cancel")
  130. client.end()
  131. })
  132. it("render get by ID /pet/{petId} api container", function (client) {
  133. apiWrapper.waitForElementVisible("@petOperationGetByIdContainer", 5000)
  134. .assert.containsText("@petOperationGetByIdTitle", "/pet/{petId}")
  135. .click("@petOperationGetByIdCollpase")
  136. .waitForElementVisible("@petOperationGetByIdCollapseContainer", 3000)
  137. .click("@petOperationGetByIdTryBtn")
  138. .waitForElementVisible("@petOperationGetByTagExecuteBtn", 1000)
  139. .click("@petOperationGetByTagTryBtn")
  140. .assert.cssClassNotPresent("@petOperationGetByTagTryBtn", "cancel")
  141. client.end()
  142. })
  143. it("render get by ID /pet/{petId} api Mock data", function (client) {
  144. apiWrapper.waitForElementVisible("@petOperationGetByIdContainer", 5000)
  145. .assert.containsText("@petOperationGetByIdTitle", "/pet/{petId}")
  146. .click("@petOperationGetByIdCollpase")
  147. .waitForElementVisible("@petOperationGetByIdCollapseContainer", 3000)
  148. .click("@petOperationGetByIdTryBtn")
  149. .waitForElementVisible("@petOperationGetByTagExecuteBtn", 1000)
  150. .setValue("@petOperationGetByIdParameter", "abc")
  151. .click("@petOperationGetByIdExecuteBtn")
  152. .waitForElementVisible("@petOperationGetByIdResultsBox")
  153. .assert.containsText("@petOperationGetByIdParameter", "abc")
  154. .assert.cssClassPresent("@petOperationGetByIdParameter", "invalid")
  155. .assert.attributeEquals("@petOperationGetByIdParameter", "title", "Value must be an integer")
  156. .click("@petOperationGetByTagTryBtn")
  157. .assert.cssClassNotPresent("@petOperationGetByTagTryBtn", "cancel")
  158. client.end()
  159. })
  160. it("render delete /pet api container", function (client) {
  161. apiWrapper.waitForElementVisible("@petOperationDeleteContainer")
  162. .assert.containsText("@petOperationDeleteTitle", "/pet/{petId}")
  163. .click("@petOperationDeleteCollpase")
  164. .waitForElementVisible("@petOperationDeleteCollapseContainer", 3000)
  165. .click("@petOperationDeleteTryBtn")
  166. .waitForElementVisible("@petOperationDeleteExecuteBtn", 1000)
  167. .click("@petOperationDeleteTryBtn")
  168. .assert.cssClassNotPresent("@petOperationDeleteTryBtn", "cancel")
  169. client.end()
  170. })
  171. it("Testing delete /pet api Mock data", function (client) {
  172. apiWrapper.waitForElementVisible("@petOperationDeleteContainer", 3000)
  173. .click("@petOperationDeleteCollpase")
  174. .waitForElementVisible("@petOperationDeleteCollapseContainer", 3000)
  175. .click("@petOperationDeleteTryBtn")
  176. .waitForElementVisible("@petOperationDeleteExecuteBtn", 1000)
  177. .click("@petOperationDeleteExecuteBtn")
  178. .waitForElementVisible("@petOperationDeleteMockCategoryID")
  179. .assert.containsText("@petOperationDeleteMockCategoryID", "0")
  180. .assert.containsText("@petOperationDeleteMockCategoryName", "\"string\"")
  181. .assert.containsText("@petOperationDeleteMockName", "\"doggie\"")
  182. .assert.containsText("@petOperationDeleteTagID", "0")
  183. .assert.containsText("@petOperationDeleteTagName", "\"string\"")
  184. .assert.containsText("@petOperationDeleteStatus", "\"available\"")
  185. .click("@petOperationDeleteTryBtn")
  186. .assert.cssClassNotPresent("@petOperationDeleteTryBtn", "cancel")
  187. client.end()
  188. })
  189. })