-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #494 from vishmi49/vishmi_ui_main
Adding test cases to developer and admin portals
- Loading branch information
Showing
2 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
tests/cypress/integration/admin/11-change-the-owner-of-application.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,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); | ||
}); | ||
}); |
65 changes: 65 additions & 0 deletions
65
tests/cypress/integration/devportal/000-general/05-download-sdk.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,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); | ||
}); | ||
}); | ||
}); | ||
}); |