Skip to content

Commit

Permalink
Add test to cover 9158
Browse files Browse the repository at this point in the history
  • Loading branch information
aviral-badola9 committed Dec 4, 2023
1 parent 21d3a70 commit ea44396
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/e2e-cypress/e2e/bugs/9158.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
describe("#9158: Reset button creates invalid inputs in the Try It Out form", () => {
it("it reset the user edited value and executes with the default value in case of try out reset. (#6517)", () => {
cy
.visit("?url=/documents/bugs/9158.yaml")
.get("#operations-default-post_users")
.click()
// Expand Try It Out
.get(".try-out__btn")
.click()
// replace multiple default values with bad value
.get(`.parameters[data-property-name="name"] input[type=text]`)
.type("{selectall}not the default name value")
.get(`.parameters[data-property-name="badgeid"] input[type=text]`)
.type("{selectall}not the default badge value")
// Reset Try It Out
.get(".try-out__btn.reset")
.click()
// Submit using default value
.get(".btn.execute")
.click()
// No required validation error on body parameter
.get(`.parameters[data-property-name="name"] input`)
.should("have.value", "default name")
.and("not.have.class", "invalid")
.get(`.parameters[data-property-name="badgeid"] input`)
.should("have.value", "12345")
.and("not.have.class", "invalid")
})
})
46 changes: 46 additions & 0 deletions test/e2e-cypress/static/documents/bugs/9158.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
openapi: 3.0.3
info:
title: Test API
version: 1.0.0
paths:
/users:
post:
summary: Create a user
description: Create a user, one of various ways
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/UserSource'
responses:
'204':
description: Successfully opened document
'400':
description: Invalid request
content:
application/json:
schema:
properties:
output:
type: string
example: "Invalid request"
components:
schemas:
UserSource:
type: object
properties:
name:
description: Full name
type: string
example: "default name"
badgeid:
description: Badge number
type: integer
format: uint32
example: 12345
email:
description: E-mail
type: string
example: "[email protected]"
minProperties: 1
maxProperties: 3

0 comments on commit ea44396

Please sign in to comment.