No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

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