From e250b0210f52e56afbd023335ae1356565beb5bb Mon Sep 17 00:00:00 2001 From: Bathiya Ladduwahetty Date: Tue, 8 Nov 2022 14:02:32 +0530 Subject: [PATCH] UI Test : fix tests 07-10 --- ...en-importing-api-with-swagger-file.spec.js | 69 ++++++++++++++++++ ...porting-api-with-swagger-file.spec.skip.js | 59 ---------------- ...-importing-api-with-swagger-v2-url.spec.js | 64 +++++++++++++++++ ...rting-api-with-swagger-v2-url.spec.skip.js | 58 --------------- ...importing-api-with-swagger-v2-file.spec.js | 69 ++++++++++++++++++ ...ting-api-with-swagger-v2-file.spec.skip.js | 59 ---------------- ...ng-api-with-errornous-swagger-file.spec.js | 70 +++++++++++++++++++ ...i-with-errornous-swagger-file.spec.skip.js | 59 ---------------- .../pages/publisher/APIDefinitionPage.js | 2 +- 9 files changed, 273 insertions(+), 236 deletions(-) create mode 100644 tests/cypress/integration/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.js delete mode 100644 tests/cypress/integration/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.skip.js create mode 100644 tests/cypress/integration/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.js delete mode 100644 tests/cypress/integration/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.skip.js create mode 100644 tests/cypress/integration/publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.js delete mode 100644 tests/cypress/integration/publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.skip.js create mode 100644 tests/cypress/integration/publisher/021-api-linter-feature/10-lint-when-importing-api-with-errornous-swagger-file.spec.js delete mode 100644 tests/cypress/integration/publisher/021-api-linter-feature/10-lint-when-importing-api-with-errornous-swagger-file.spec.skip.js diff --git a/tests/cypress/integration/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.js b/tests/cypress/integration/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.js new file mode 100644 index 00000000000..f5c4f19f5aa --- /dev/null +++ b/tests/cypress/integration/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import Utils from "@support/utils"; +import APIDefinitionPage from "../../../support/pages/publisher/APIDefinitionPage"; +import PublisherMenu from "../../../support/functions/publisher/PublisherMenu"; + +describe("publisher-021-07 : Lint when importing API with swagger file", () => { + const publisher = 'publisher'; + const password = 'test123'; + const carbonUsername = 'admin'; + const carbonPassword = 'admin'; + const apiName = 'newapi' + Math.floor(Date.now() / 1000); + const apiVersion = '1.0.0'; + + Cypress.on('uncaught:exception', (err, runnable) => { + return false; + }); + before(function () { + //cy.carbonLogin(carbonUsername, carbonPassword); + //cy.addNewUser(publisher, ['Internal/publisher', 'Internal/creator', 'Internal/everyone'], password); + cy.loginToPublisher(publisher, password); + APIDefinitionPage.waitUntillLoadingComponentsExit() + }) + + it.only("Lint when importing API with swagger file", () => { + cy.createAPIByRestAPIDesign(apiName, apiVersion); + cy.wait(3000) + PublisherMenu.goToAPIDefinitionByUI() + + APIDefinitionPage.importDefinitionButton().click() + // select the option from the menu item + APIDefinitionPage.openFileSelectRadioButton().click() + + // // provide the swagger url + cy.intercept('GET', '**/linter-custom-rules').as('linter-custom-rules'); + cy.get(APIDefinitionPage.browseToUploadButton()).then(function () { + const filepath = 'api_artifacts/petstore_open_api_3.json' + APIDefinitionPage.fileUploadInput().attachFile(filepath); + }); + cy.wait('@linter-custom-rules',{timeout: 25000}).its('response.statusCode').should('equal', 204) + APIDefinitionPage.linterResultDivBlock().should('be.visible'); + // TODO : click on errors, warnings toggle buttons and verify it loads, currently there is an issue on this + + }); + + after(function () { + + // Test is done. Now delete the api + cy.deleteApi(apiName, apiVersion); + cy.logoutFromPublisher(); + + // cy.visit(`${Utils.getAppOrigin()}/carbon/user/user-mgt.jsp`); + //cy.deleteUser(publisher); + }) +}); \ No newline at end of file diff --git a/tests/cypress/integration/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.skip.js b/tests/cypress/integration/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.skip.js deleted file mode 100644 index 09fc97fb287..00000000000 --- a/tests/cypress/integration/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.skip.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import Utils from "@support/utils"; - -describe("Lint when importing API with swagger file", () => { - const publisher = 'publisher'; - const password = 'test123'; - const carbonUsername = 'admin'; - const carbonPassword = 'admin'; - const apiName = 'newapi' + Math.floor(Date.now() / 1000); - const apiVersion = '1.0.0'; - - before(function () { - cy.carbonLogin(carbonUsername, carbonPassword); - cy.addNewUser(publisher, ['Internal/publisher', 'Internal/creator', 'Internal/everyone'], password); - cy.loginToPublisher(publisher, password); - }) - - it.only("Lint when importing API with swagger file", () => { - cy.createAPIByRestAPIDesign(apiName, apiVersion); - cy.get('#itest-api-details-api-config-acc').click(); - cy.get('#left-menu-itemAPIdefinition').click(); - cy.get('#import-definition-btn').click(); - cy.get('#open-api-file-select-radio').click(); - - // upload the swagger - cy.get('#browse-to-upload-btn').then(function () { - const filepath = 'api_artifacts/petstore_open_api_3.json' - cy.get('input[type="file"]').attachFile(filepath); - }); - - // check linter results - cy.get('[data-testid="itest-id-linter-results"]').should('be.visible'); - - }); - - after(function () { - cy.logoutFromPublisher(); - // Test is done. Now delete the api - cy.deleteApi(apiName, apiVersion); - - cy.visit(`${Utils.getAppOrigin()}/carbon/user/user-mgt.jsp`); - cy.deleteUser(publisher); - }) -}); \ No newline at end of file diff --git a/tests/cypress/integration/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.js b/tests/cypress/integration/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.js new file mode 100644 index 00000000000..0ca043c52cc --- /dev/null +++ b/tests/cypress/integration/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import Utils from "@support/utils"; +import APIDefinitionPage from "../../../support/pages/publisher/APIDefinitionPage"; +import PublisherMenu from "../../../support/functions/publisher/PublisherMenu"; +describe("publisher-021-08 : Lint when importing API with swagger v2 URL", () => { + const publisher = 'publisher'; + const password = 'test123'; + const carbonUsername = 'admin'; + const carbonPassword = 'admin'; + const apiName = 'newapi' + Math.floor(Date.now() / 1000); + const apiVersion = '1.0.0'; + + Cypress.on('uncaught:exception', (err, runnable) => { + return false; + }); + before(function () { + //cy.carbonLogin(carbonUsername, carbonPassword); + //cy.addNewUser(publisher, ['Internal/publisher', 'Internal/creator', 'Internal/everyone'], password); + cy.loginToPublisher(publisher, password); + APIDefinitionPage.waitUntillLoadingComponentsExit() + }) + + it.only("Lint when importing API with swagger v2 URL", () => { + cy.createAPIByRestAPIDesign(apiName, apiVersion); + cy.wait(3000) + PublisherMenu.goToAPIDefinitionByUI() + + APIDefinitionPage.importDefinitionButton().click() + // select the option from the menu item + APIDefinitionPage.openAPIURLRadioButton().click() + + // // provide the swagger url + APIDefinitionPage.openAPIURLTextBox().type('https://petstore.swagger.io/v2/swagger.json') + APIDefinitionPage.waitUntilGetUrlValidatedDiv(30000) + APIDefinitionPage.linterResultDivBlock().should('be.visible'); + // TODO : click on errors, warnings toggle buttons and verify it loads, currently there is an issue on this + + }); + + after(function () { + + // Test is done. Now delete the api + cy.deleteApi(apiName, apiVersion); + cy.logoutFromPublisher(); + + //cy.visit(`${Utils.getAppOrigin()}/carbon/user/user-mgt.jsp`); + //cy.deleteUser(publisher); + }) +}); \ No newline at end of file diff --git a/tests/cypress/integration/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.skip.js b/tests/cypress/integration/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.skip.js deleted file mode 100644 index daba956d8b4..00000000000 --- a/tests/cypress/integration/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.skip.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import Utils from "@support/utils"; - -describe("Lint when importing API with swagger v2 URL", () => { - const publisher = 'publisher'; - const password = 'test123'; - const carbonUsername = 'admin'; - const carbonPassword = 'admin'; - const apiName = 'newapi' + Math.floor(Date.now() / 1000); - const apiVersion = '1.0.0'; - - before(function () { - cy.carbonLogin(carbonUsername, carbonPassword); - cy.addNewUser(publisher, ['Internal/publisher', 'Internal/creator', 'Internal/everyone'], password); - cy.loginToPublisher(publisher, password); - }) - - it.only("Lint when importing API with swagger v2 URL", () => { - cy.createAPIByRestAPIDesign(apiName, apiVersion); - cy.get('#itest-api-details-api-config-acc').click(); - cy.get('#left-menu-itemAPIdefinition').click(); - cy.get('#import-definition-btn').click(); - cy.get('#open-api-url-select-radio').click(); - - // provide the swagger url - cy.get('[data-testid="swagger-url-endpoint"]').type('https://petstore.swagger.io/v2/swagger.json'); - // go to the next step - cy.get('#url-validated', { timeout: 30000 }); - - // check linter results - cy.get('[data-testid="itest-id-linter-results"]').should('be.visible'); - - }); - - after(function () { - cy.logoutFromPublisher(); - // Test is done. Now delete the api - cy.deleteApi(apiName, apiVersion); - - cy.visit(`${Utils.getAppOrigin()}/carbon/user/user-mgt.jsp`); - cy.deleteUser(publisher); - }) -}); \ No newline at end of file diff --git a/tests/cypress/integration/publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.js b/tests/cypress/integration/publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.js new file mode 100644 index 00000000000..5adb528d208 --- /dev/null +++ b/tests/cypress/integration/publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import Utils from "@support/utils"; +import APIDefinitionPage from "../../../support/pages/publisher/APIDefinitionPage"; +import PublisherMenu from "../../../support/functions/publisher/PublisherMenu"; +describe("publisher-021-09 : Lint when importing API with swagger v2 file", () => { + const publisher = 'publisher'; + const password = 'test123'; + const carbonUsername = 'admin'; + const carbonPassword = 'admin'; + const apiName = 'newapi' + Math.floor(Date.now() / 1000); + const apiVersion = '1.0.0'; + + Cypress.on('uncaught:exception', (err, runnable) => { + return false; + }); + before(function () { + //cy.carbonLogin(carbonUsername, carbonPassword); + //cy.addNewUser(publisher, ['Internal/publisher', 'Internal/creator', 'Internal/everyone'], password); + cy.loginToPublisher(publisher, password); + APIDefinitionPage.waitUntillLoadingComponentsExit() + }) + + it.only("Lint when importing API with swagger v2 file", () => { + + cy.createAPIByRestAPIDesign(apiName, apiVersion); + cy.wait(3000) + PublisherMenu.goToAPIDefinitionByUI() + + APIDefinitionPage.importDefinitionButton().click() + // select the option from the menu item + APIDefinitionPage.openFileSelectRadioButton().click() + + // // provide the swagger url + cy.intercept('GET', '**/linter-custom-rules').as('linter-custom-rules'); + cy.get(APIDefinitionPage.browseToUploadButton()).then(function () { + const filepath = 'api_artifacts/petstore_open_api_2.json' + APIDefinitionPage.fileUploadInput().attachFile(filepath); + }); + cy.wait('@linter-custom-rules',{timeout: 25000}).its('response.statusCode').should('equal', 204) + APIDefinitionPage.linterResultDivBlock().should('be.visible'); + // TODO : click on errors, warnings toggle buttons and verify it loads, currently there is an issue on this + + }); + + after(function () { + + // Test is done. Now delete the api + cy.deleteApi(apiName, apiVersion); + cy.logoutFromPublisher(); + + //cy.visit(`${Utils.getAppOrigin()}/carbon/user/user-mgt.jsp`); + //cy.deleteUser(publisher); + }) +}); \ No newline at end of file diff --git a/tests/cypress/integration/publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.skip.js b/tests/cypress/integration/publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.skip.js deleted file mode 100644 index f97bac230d2..00000000000 --- a/tests/cypress/integration/publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.skip.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import Utils from "@support/utils"; - -describe("Lint when importing API with swagger v2 file", () => { - const publisher = 'publisher'; - const password = 'test123'; - const carbonUsername = 'admin'; - const carbonPassword = 'admin'; - const apiName = 'newapi' + Math.floor(Date.now() / 1000); - const apiVersion = '1.0.0'; - - before(function () { - cy.carbonLogin(carbonUsername, carbonPassword); - cy.addNewUser(publisher, ['Internal/publisher', 'Internal/creator', 'Internal/everyone'], password); - cy.loginToPublisher(publisher, password); - }) - - it.only("Lint when importing API with swagger v2 file", () => { - cy.createAPIByRestAPIDesign(apiName, apiVersion); - cy.get('#itest-api-details-api-config-acc').click(); - cy.get('#left-menu-itemAPIdefinition').click(); - cy.get('#import-definition-btn').click(); - cy.get('#open-api-file-select-radio').click(); - - // upload the swagger - cy.get('#browse-to-upload-btn').then(function () { - const filepath = 'api_artifacts/petstore_open_api_2.json' - cy.get('input[type="file"]').attachFile(filepath); - }); - - // check linter results - cy.get('[data-testid="itest-id-linter-results"]').should('be.visible'); - - }); - - after(function () { - cy.logoutFromPublisher(); - // Test is done. Now delete the api - cy.deleteApi(apiName, apiVersion); - - cy.visit(`${Utils.getAppOrigin()}/carbon/user/user-mgt.jsp`); - cy.deleteUser(publisher); - }) -}); \ No newline at end of file diff --git a/tests/cypress/integration/publisher/021-api-linter-feature/10-lint-when-importing-api-with-errornous-swagger-file.spec.js b/tests/cypress/integration/publisher/021-api-linter-feature/10-lint-when-importing-api-with-errornous-swagger-file.spec.js new file mode 100644 index 00000000000..92103d78e64 --- /dev/null +++ b/tests/cypress/integration/publisher/021-api-linter-feature/10-lint-when-importing-api-with-errornous-swagger-file.spec.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import Utils from "@support/utils"; +import APIDefinitionPage from "../../../support/pages/publisher/APIDefinitionPage"; +import PublisherMenu from "../../../support/functions/publisher/PublisherMenu"; +describe("publisher-021-10 : Lint when importing API with errounous swagger file", () => { + const publisher = 'publisher'; + const password = 'test123'; + const carbonUsername = 'admin'; + const carbonPassword = 'admin'; + const apiName = 'newapi' + Math.floor(Date.now() / 1000); + const apiVersion = '1.0.0'; + + Cypress.on('uncaught:exception', (err, runnable) => { + return false; + }); + before(function () { + //cy.carbonLogin(carbonUsername, carbonPassword); + //cy.addNewUser(publisher, ['Internal/publisher', 'Internal/creator', 'Internal/everyone'], password); + cy.loginToPublisher(publisher, password); + APIDefinitionPage.waitUntillLoadingComponentsExit() + }) + + it.only("Lint when importing API with errounous swagger file", () => { + cy.createAPIByRestAPIDesign(apiName, apiVersion); + cy.wait(3000) + PublisherMenu.goToAPIDefinitionByUI() + + APIDefinitionPage.importDefinitionButton().click() + // select the option from the menu item + APIDefinitionPage.openFileSelectRadioButton().click() + + // // provide the swagger url + cy.intercept('GET', '**/linter-custom-rules').as('linter-custom-rules'); + cy.get(APIDefinitionPage.browseToUploadButton()).then(function () { + const filepath = 'api_artifacts/errornous_petstore_open_api_3.json' + APIDefinitionPage.fileUploadInput().attachFile(filepath); + }); + cy.wait('@linter-custom-rules',{timeout: 25000}).its('response.statusCode').should('equal', 204) + APIDefinitionPage.linterResultDivBlock().should('be.visible'); + cy.contains("attribute info2 is unexpected") + cy.contains("attribute info is missing") + // TODO : click on errors, warnings toggle buttons and verify it loads, currently there is an issue on this + + }); + + after(function () { + + // Test is done. Now delete the api + cy.deleteApi(apiName, apiVersion); + cy.logoutFromPublisher(); + + //cy.visit(`${Utils.getAppOrigin()}/carbon/user/user-mgt.jsp`); + //cy.deleteUser(publisher); + }) +}); \ No newline at end of file diff --git a/tests/cypress/integration/publisher/021-api-linter-feature/10-lint-when-importing-api-with-errornous-swagger-file.spec.skip.js b/tests/cypress/integration/publisher/021-api-linter-feature/10-lint-when-importing-api-with-errornous-swagger-file.spec.skip.js deleted file mode 100644 index 8f6982a7479..00000000000 --- a/tests/cypress/integration/publisher/021-api-linter-feature/10-lint-when-importing-api-with-errornous-swagger-file.spec.skip.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import Utils from "@support/utils"; - -describe("Lint when importing API with errounous swagger file", () => { - const publisher = 'publisher'; - const password = 'test123'; - const carbonUsername = 'admin'; - const carbonPassword = 'admin'; - const apiName = 'newapi' + Math.floor(Date.now() / 1000); - const apiVersion = '1.0.0'; - - before(function () { - cy.carbonLogin(carbonUsername, carbonPassword); - cy.addNewUser(publisher, ['Internal/publisher', 'Internal/creator', 'Internal/everyone'], password); - cy.loginToPublisher(publisher, password); - }) - - it.only("Lint when importing API with errounous swagger file", () => { - cy.createAPIByRestAPIDesign(apiName, apiVersion); - cy.get('#itest-api-details-api-config-acc').click(); - cy.get('#left-menu-itemAPIdefinition').click(); - cy.get('#import-definition-btn').click(); - cy.get('#open-api-file-select-radio').click(); - - // upload the swagger - cy.get('#browse-to-upload-btn').then(function () { - const filepath = 'api_artifacts/errornous_petstore_open_api_3.json' - cy.get('input[type="file"]').attachFile(filepath); - }); - - // check linter results - cy.get('[data-testid="itest-id-linter-results"]').should('be.visible'); - - }); - - after(function () { - cy.logoutFromPublisher(); - // Test is done. Now delete the api - cy.deleteApi(apiName, apiVersion); - - cy.visit(`${Utils.getAppOrigin()}/carbon/user/user-mgt.jsp`); - cy.deleteUser(publisher); - }) -}); \ No newline at end of file diff --git a/tests/cypress/support/pages/publisher/APIDefinitionPage.js b/tests/cypress/support/pages/publisher/APIDefinitionPage.js index f5e763873f0..4d4d378a1c4 100644 --- a/tests/cypress/support/pages/publisher/APIDefinitionPage.js +++ b/tests/cypress/support/pages/publisher/APIDefinitionPage.js @@ -46,7 +46,7 @@ class APIDefinitionPage extends PublisherComonPage{ return cy.get('div[data-testid="itest-id-linter-results"]>div>div>div>div>div>div>button[value="1"]') } static browseToUploadButton(){ - return cy.get(' #browse-to-upload-btn') + return cy.get('#browse-to-upload-btn') } static fileUploadInput(){ return cy.get('input[type="file"]')