pet.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.openapi.yaml")
  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. describe("GET /pet/{petId}", () => {
  20. it("should render Try-It-Out flow correctly", function (client) {
  21. apiWrapper.waitForElementVisible("#operations-pet-updatePetWithForm", 10000)
  22. .assert.containsText("#operations-pet-updatePetWithForm > div > span.opblock-summary-path > a > span", "/pet")
  23. .click("#operations-pet-updatePetWithForm")
  24. .waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div", 5000)
  25. .click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.opblock-section > div.opblock-section-header > div.try-out > button")
  26. .waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", 1000)
  27. .click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button")
  28. .assert.cssClassNotPresent("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", "cancel")
  29. client.end()
  30. })
  31. it("should have stable input values", function (client) {
  32. client.waitForElementVisible("#operations-pet-updatePetWithForm", 10000)
  33. .assert.containsText("#operations-pet-updatePetWithForm > div > span.opblock-summary-path > a > span", "/pet")
  34. .click("#operations-pet-updatePetWithForm")
  35. .waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div", 5000)
  36. .click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.opblock-section > div.opblock-section-header > div.try-out > button")
  37. .waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", 1000)
  38. .setValue("#operations-pet-updatePetWithForm td.parameters-col_description > input", "12345")
  39. .click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button")
  40. .pause(800) // for swagger-api/swagger-ui#4269, which happens above 350ms
  41. .assert.containsText("#operations-pet-updatePetWithForm div.responses-inner > div > div > div:nth-child(2) > div > pre", "http://localhost:3204/pet/12345")
  42. .assert.value("#operations-pet-updatePetWithForm td.parameters-col_description > input", "12345")
  43. client.end()
  44. })
  45. })
  46. })