You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

121 rivejä
3.8 KiB

  1. describe("#5129: parameter required + allowEmptyValue interactions", () => {
  2. describe("allowEmptyValue parameter", () => {
  3. const opId = "#operations-default-get_aev"
  4. it("should omit the parameter by default", () => {
  5. cy
  6. .visit("/?url=/documents/bugs/5129.yaml")
  7. .get(opId)
  8. .click()
  9. .get(".btn.try-out__btn")
  10. .click()
  11. .get(".btn.execute")
  12. .click()
  13. .get(".request-url pre")
  14. .should("have.text", "http://localhost:3230/aev")
  15. })
  16. it("should include a value", () => {
  17. cy
  18. .visit("/?url=/documents/bugs/5129.yaml")
  19. .get(opId)
  20. .click()
  21. .get(".btn.try-out__btn")
  22. .click()
  23. .get(`.parameters-col_description input[type=text]`)
  24. .type("asdf")
  25. .get(".btn.execute")
  26. .click()
  27. .get(".request-url pre")
  28. .should("have.text", "http://localhost:3230/aev?param=asdf")
  29. })
  30. it("should include an empty value when empty value box is checked", () => {
  31. cy
  32. .visit("/?url=/documents/bugs/5129.yaml")
  33. .get(opId)
  34. .click()
  35. .get(".btn.try-out__btn")
  36. .click()
  37. .get(`.parameters-col_description input[type=checkbox]`)
  38. .check()
  39. .get(".btn.execute")
  40. .click()
  41. .get(".request-url pre")
  42. .should("have.text", "http://localhost:3230/aev?param=")
  43. })
  44. it("should include a value when empty value box is checked and then input is provided", () => {
  45. cy
  46. .visit("/?url=/documents/bugs/5129.yaml")
  47. .get(opId)
  48. .click()
  49. .get(".btn.try-out__btn")
  50. .click()
  51. .get(`.parameters-col_description input[type=checkbox]`)
  52. .check()
  53. .get(`.parameters-col_description input[type=text]`)
  54. .type("1234")
  55. .get(".btn.execute")
  56. .click()
  57. .get(".request-url pre")
  58. .should("have.text", "http://localhost:3230/aev?param=1234")
  59. })
  60. })
  61. describe("allowEmptyValue + required parameter", () => {
  62. const opId = "#operations-default-get_aev_and_required"
  63. it("should refuse to execute by default", () => {
  64. cy
  65. .visit("/?url=/documents/bugs/5129.yaml")
  66. .get(opId)
  67. .click()
  68. .get(".btn.try-out__btn")
  69. .click()
  70. .get(".btn.execute")
  71. .click()
  72. .wait(1000)
  73. .get(".request-url pre")
  74. .should("not.exist")
  75. })
  76. it("should include a value", () => {
  77. cy
  78. .visit("/?url=/documents/bugs/5129.yaml")
  79. .get(opId)
  80. .click()
  81. .get(".btn.try-out__btn")
  82. .click()
  83. .get(`.parameters-col_description input[type=text]`)
  84. .type("asdf")
  85. .get(".btn.execute")
  86. .click()
  87. .get(".request-url pre")
  88. .should("have.text", "http://localhost:3230/aev/and/required?param=asdf")
  89. })
  90. it("should include an empty value when empty value box is checked", () => {
  91. cy
  92. .visit("/?url=/documents/bugs/5129.yaml")
  93. .get(opId)
  94. .click()
  95. .get(".btn.try-out__btn")
  96. .click()
  97. .get(`.parameters-col_description input[type=checkbox]`)
  98. .check()
  99. .get(".btn.execute")
  100. .click()
  101. .get(".request-url pre")
  102. .should("have.text", "http://localhost:3230/aev/and/required?param=")
  103. })
  104. it("should include a value when empty value box is checked and then input is provided", () => {
  105. cy
  106. .visit("/?url=/documents/bugs/5129.yaml")
  107. .get(opId)
  108. .click()
  109. .get(".btn.try-out__btn")
  110. .click()
  111. .get(`.parameters-col_description input[type=checkbox]`)
  112. .check()
  113. .get(`.parameters-col_description input[type=text]`)
  114. .type("1234")
  115. .get(".btn.execute")
  116. .click()
  117. .get(".request-url pre")
  118. .should("have.text", "http://localhost:3230/aev/and/required?param=1234")
  119. })
  120. })
  121. })