diff --git a/test/e2e-cypress/e2e/bugs/9158.cy.js b/test/e2e-cypress/e2e/bugs/9158.cy.js new file mode 100644 index 000000000000..93eab66585e4 --- /dev/null +++ b/test/e2e-cypress/e2e/bugs/9158.cy.js @@ -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") + }) + }) \ No newline at end of file diff --git a/test/e2e-cypress/static/documents/bugs/9158.yaml b/test/e2e-cypress/static/documents/bugs/9158.yaml new file mode 100644 index 000000000000..ec888fe3d487 --- /dev/null +++ b/test/e2e-cypress/static/documents/bugs/9158.yaml @@ -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: "jsmith@business.com" + minProperties: 1 + maxProperties: 3 \ No newline at end of file