Skip to content

Commit

Permalink
UI Test : fix tests 07-10
Browse files Browse the repository at this point in the history
  • Loading branch information
BathiyaL authored and madushadhanushka committed Nov 10, 2022
1 parent 24c90f5 commit e250b02
Show file tree
Hide file tree
Showing 9 changed files with 273 additions and 236 deletions.
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);
})
});

This file was deleted.

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);
})
});

This file was deleted.

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);
})
});

This file was deleted.

Loading

0 comments on commit e250b02

Please sign in to comment.