Skip to content

Commit

Permalink
Merge pull request #494 from vishmi49/vishmi_ui_main
Browse files Browse the repository at this point in the history
Adding test cases to developer and admin portals
  • Loading branch information
dulithsenanayake authored Sep 4, 2023
2 parents a7e7993 + 7b5ea31 commit 0d8414d
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* 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 DevportalComonPage from "../../support/pages/devportal/DevportalComonPage";
const devportalComonPage = new DevportalComonPage();

describe("Change the owner of application", () => {
const { developer, password } = Utils.getUserInfo();
const appName = Utils.generateName();
const appDescription = "Owner testing application";
const carbonUsername = "admin";
const carbonPassword = "admin";

it.only("Change the owner of application", () => {
//Create application
cy.loginToDevportal(developer, password);
cy.createApp(appName, appDescription);
cy.logoutFromDevportal();
devportalComonPage.waitUntillDevportalLoaderSpinnerExit();

//login to admin portal
cy.loginToAdmin(carbonUsername, carbonPassword);
cy.get('[data-testid="Applications-child-link"]').click({ force: true });
cy.get("#itest-application-list-table").within(() => {
cy.contains("tr", appName).within(() => {
cy.get("td > span").click({ force: true });
});
});

//change the owner
cy.get('div[role="dialog"]').contains("div", "owner");
cy.get('input[name="owner"]').click().clear();
cy.get('input[name="owner"]').type("admin");
cy.get('[data-testid="Save-btn"]').click();
cy.wait(5000);
cy.get("#itest-application-list-table").within(() => {
cy.contains("tr", appName).within(() => {
cy.get("td").eq(1).should("have.text", "admin");
});
});

cy.logoutFromAdminPortal();
cy.loginToDevportal(carbonUsername, carbonPassword);
cy.deleteApp(appName);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* 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 DevportalComonPage from "../../../support/pages/devportal/DevportalComonPage";
const devportalComonPage = new DevportalComonPage();

describe("Download sdks)", () => {
const { developer, publisher, password } = Utils.getUserInfo();
const apiName = Utils.generateName();
const apiVersion = "1.0.0";
const apiContext = apiName;

let testApiId;

it.only("Download sdks", () => {
cy.loginToPublisher(publisher, password);

Utils.addAPIWithEndpoints({
name: apiName,
version: apiVersion,
context: apiContext,
}).then((apiId) => {
cy.log("API created " + apiName);
testApiId = apiId;
Utils.publishAPI(apiId).then((result) => {
cy.log("API published " + result);
cy.logoutFromPublisher();

cy.loginToDevportal(developer, password);
cy.visit(`/devportal/apis/${apiId}/sdk?tenant=carbon.super`);
cy.get("#download-sdk-btn").click();

const fileName = `${apiName}_${apiVersion}_android`;

const downloadsFolder = Cypress.config("downloadsFolder");
const downloadedFilename = `${downloadsFolder}/${fileName}.zip`;

cy.readFile(downloadedFilename, "binary", { timeout: 15000 }).should(
(buffer) => expect(buffer.length).to.be.gt(100)
);
cy.logoutFromDevportal();
devportalComonPage.waitUntillDevportalLoaderSpinnerExit();

cy.loginToPublisher(publisher, password);
Utils.deleteAPI(apiId);
});
});
});
});

0 comments on commit 0d8414d

Please sign in to comment.