forked from wso2/apim-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24c90f5
commit e250b02
Showing
9 changed files
with
273 additions
and
236 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
...ion/publisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.js
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,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); | ||
}) | ||
}); |
59 changes: 0 additions & 59 deletions
59
...ublisher/021-api-linter-feature/07-lint-when-importing-api-with-swagger-file.spec.skip.js
This file was deleted.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
...n/publisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.js
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,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); | ||
}) | ||
}); |
58 changes: 0 additions & 58 deletions
58
...lisher/021-api-linter-feature/08-lint-when-importing-api-with-swagger-v2-url.spec.skip.js
This file was deleted.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
.../publisher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.js
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,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); | ||
}) | ||
}); |
59 changes: 0 additions & 59 deletions
59
...isher/021-api-linter-feature/09-lint-when-importing-api-with-swagger-v2-file.spec.skip.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.