-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(OAS3): servers component update on definition change (#6280)
* fix(OAS3): servers component should use nextProps * test(OAS3): cypress tests for selecting multiple servers * test(OAS3): multiple server test with definition change
- Loading branch information
Showing
4 changed files
with
116 additions
and
2 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
16 changes: 16 additions & 0 deletions
16
test/e2e-cypress/static/documents/features/oas3-multiple-servers-switch.yaml
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,16 @@ | ||
openapi: 3.0.2 | ||
servers: | ||
- url: /test-url-switch-1 | ||
- url: /test-url-switch-2 | ||
info: | ||
title: multi-server test, switch | ||
version: 0.0.1 | ||
description: |- | ||
a simple test to select different servers | ||
paths: | ||
/: | ||
get: | ||
summary: an operation | ||
responses: | ||
"200": | ||
description: OK |
16 changes: 16 additions & 0 deletions
16
test/e2e-cypress/static/documents/features/oas3-multiple-servers.yaml
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,16 @@ | ||
openapi: 3.0.2 | ||
servers: | ||
- url: /test-url-1 | ||
- url: /test-url-2 | ||
info: | ||
title: multi-server test | ||
version: 0.0.1 | ||
description: |- | ||
a simple test to select different servers | ||
paths: | ||
/: | ||
get: | ||
summary: an operation | ||
responses: | ||
"200": | ||
description: OK |
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,82 @@ | ||
/** | ||
* @prettier | ||
*/ | ||
|
||
describe("OpenAPI 3.0 Multiple Servers", () => { | ||
it("should render and execute for server '/test-url-1'", () => { | ||
cy.visit( | ||
"/?url=/documents/features/oas3-multiple-servers.yaml" | ||
) | ||
.get(".scheme-container .schemes .servers label > select") | ||
.select("/test-url-1") | ||
.get("#operations-default-get_") | ||
.click() | ||
// Expand Try It Out | ||
.get(".try-out__btn") | ||
.click() | ||
// Execute | ||
.get(".execute.opblock-control__btn") | ||
.click() | ||
.get(".responses-wrapper .request-url") | ||
.should("contains.text", "/test-url-1") | ||
}) | ||
it("should render and execute for server '/test-url-2'", () => { | ||
cy.visit( | ||
"/?url=/documents/features/oas3-multiple-servers.yaml" | ||
) | ||
.get(".scheme-container .schemes .servers label > select") | ||
.select("/test-url-2") | ||
.get("#operations-default-get_") | ||
.click() | ||
// Expand Try It Out | ||
.get(".try-out__btn") | ||
.click() | ||
// Execute | ||
.get(".execute.opblock-control__btn") | ||
.click() | ||
.get(".responses-wrapper .request-url") | ||
.should("contains.text", "/test-url-2") | ||
}) | ||
it("should render and execute for server '/test-url-1' after sequence: select '/test-url-2' -> Try-It-Out -> select '/test-url-1'", () => { | ||
cy.visit( | ||
"/?url=/documents/features/oas3-multiple-servers.yaml" | ||
) | ||
.get(".scheme-container .schemes .servers label > select") | ||
.select("/test-url-2") | ||
.get("#operations-default-get_") | ||
.click() | ||
// Expand Try It Out | ||
.get(".try-out__btn") | ||
.click() | ||
// Select a different server | ||
.get(".scheme-container .schemes .servers label > select") | ||
.select("/test-url-1") | ||
// Execute | ||
.get(".execute.opblock-control__btn") | ||
.click() | ||
.get(".responses-wrapper .request-url") | ||
.should("contains.text", "/test-url-1") | ||
}) | ||
it("should render and execute for server '/test-url-switch-1' after changing api defintion", () => { | ||
cy.visit( | ||
"/?url=/documents/features/oas3-multiple-servers.yaml" | ||
) | ||
.get(".scheme-container .schemes .servers label > select") | ||
.select("/test-url-2") | ||
cy.visit( | ||
"/?url=/documents/features/oas3-multiple-servers-switch.yaml" | ||
) | ||
.get(".scheme-container .schemes .servers label > select") | ||
.select("/test-url-switch-2") | ||
.get("#operations-default-get_") | ||
.click() | ||
// Expand Try It Out | ||
.get(".try-out__btn") | ||
.click() | ||
// Execute | ||
.get(".execute.opblock-control__btn") | ||
.click() | ||
.get(".responses-wrapper .request-url") | ||
.should("contains.text", "/test-url-switch-2") | ||
}) | ||
}) |