From e1cdb71b494615dc5edb971dd0c34a6b7199f0c8 Mon Sep 17 00:00:00 2001 From: ben-smartbear Date: Wed, 2 Sep 2020 14:11:26 +0100 Subject: [PATCH] Allowing servers dropdown to change when oas3Actions.setSelectedServer is called --- src/core/plugins/oas3/components/servers.jsx | 3 ++- test/e2e-cypress/static/documents/bugs/6351.yaml | 13 +++++++++++++ test/e2e-cypress/tests/bugs/6351.js | 13 +++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/e2e-cypress/static/documents/bugs/6351.yaml create mode 100644 test/e2e-cypress/tests/bugs/6351.js diff --git a/src/core/plugins/oas3/components/servers.jsx b/src/core/plugins/oas3/components/servers.jsx index 948b4296f44..37c3f386e51 100644 --- a/src/core/plugins/oas3/components/servers.jsx +++ b/src/core/plugins/oas3/components/servers.jsx @@ -109,7 +109,8 @@ export default class Servers extends React.Component { ( server ) => diff --git a/test/e2e-cypress/static/documents/bugs/6351.yaml b/test/e2e-cypress/static/documents/bugs/6351.yaml new file mode 100644 index 00000000000..853953eefca --- /dev/null +++ b/test/e2e-cypress/static/documents/bugs/6351.yaml @@ -0,0 +1,13 @@ +openapi: 3.0.2 +info: + title: OAS 3.0 sample with multiple servers + version: 0.1.0 +servers: + - url: http://testserver1.com + - url: http://testserver2.com +paths: + /test/: + get: + responses: + '200': + description: Successful Response diff --git a/test/e2e-cypress/tests/bugs/6351.js b/test/e2e-cypress/tests/bugs/6351.js new file mode 100644 index 00000000000..63c37b71257 --- /dev/null +++ b/test/e2e-cypress/tests/bugs/6351.js @@ -0,0 +1,13 @@ +// http://github.com/swagger-api/swagger-ui/issues/6351 + +describe("#6351: Server dropdown should change when switched via oas3Actions.setSelectedServer", () => { + it("should show different selected server", () => { + cy.visit("/?url=/documents/bugs/6351.yaml") + .get("select") + .contains("http://testserver1.com") + .window() + .then(win => win.ui.oas3Actions.setSelectedServer("http://testserver2.com")) + .get("select") + .contains("http://testserver2.com") + }) +})