Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(try-it-out): reset of oas3 requestBody should use default values (#…
…8265) Co-authored-by: Mathias Spanhove <mathias.spanhove@katoennatie.com>
- Loading branch information
1 parent
0b8de2c
commit ffe24d5
Showing
6 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: Example Swagger with required default body parameter | ||
version: 1.0.0 | ||
paths: | ||
/pet: | ||
post: | ||
operationId: addPet | ||
requestBody: | ||
content: | ||
application/x-www-form-urlencoded: | ||
schema: | ||
$ref: '#/components/schemas/BodyParameter' | ||
required: true | ||
responses: | ||
405: | ||
description: Invalid input | ||
content: {} | ||
components: | ||
schemas: | ||
BodyParameter: | ||
required: | ||
- bodyParameter | ||
type: object | ||
properties: | ||
bodyParameter: | ||
type: string | ||
default: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe("#8217: Reset Request Body not using default values", () => { | ||
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/8217.yaml") | ||
.get("#operations-default-addPet") | ||
.click() | ||
// Expand Try It Out | ||
.get(".try-out__btn") | ||
.click() | ||
// replace default sample with bad value | ||
.get(`.parameters[data-property-name="bodyParameter"] input`) | ||
.type("{selectall}not the default 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="bodyParameter"] input`) | ||
.should("have.value", "default") | ||
.and("not.have.class", "invalid") | ||
}) | ||
}) |