Added Create Delete App test

This commit is contained in:
Rashmi P 2020-05-20 11:04:39 +00:00
parent af7bf9b70a
commit 345fcdea21
3 changed files with 35 additions and 4 deletions

View File

@ -0,0 +1,10 @@
describe("Create and Delete App Functionality", function() {
it("Delete App Functionality", function() {
cy.log("appname: " + localStorage.getItem("AppName"));
const appname = localStorage.getItem("AppName");
cy.openPropertyPane("textwidget");
cy.DeleteApp(appname);
cy.wait("@deleteApplication");
cy.get("@deleteApplication").should("have.property", "status", 200);
});
});

View File

@ -32,6 +32,21 @@ Cypress.Commands.add("CreateApp", appname => {
cy.get("@getUser").should("have.property", "status", 200);
});
Cypress.Commands.add("DeleteApp", appName => {
cy.get(commonlocators.homeIcon).click({ force: true });
cy.wait("@applications").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
cy.get('button span[icon="chevron-down"]').should("be.visible");
cy.get(homePage.searchInput).type(appName, { force: true });
cy.get(homePage.appMoreIcon).should("have.length",1)
.first()
.click({ force: true });
cy.get(homePage.deleteButton).should("be.visible").click({ force: true });
});
Cypress.Commands.add("LogintoApp", (uname, pword) => {
cy.visit("/user/login");
cy.get(loginPage.username).should("be.visible");
@ -458,12 +473,16 @@ Cypress.Commands.add("DeleteAppByApi", () => {
const myRegexp = /applications(.*)/;
const match = myRegexp.exec(currentURL);
appId = match[1].split("/")[1];
cy.log(appId + "appId");
cy.request("DELETE", "api/v1/applications/" + appId).then(response => {
expect(response.status).equal(200);
});
if (appId != null) {
cy.log(appId + "appId");
cy.request("DELETE", "api/v1/applications/" + appId).then(response => {
expect(response.status).equal(200);
});
}
});
});
Cypress.Commands.add("togglebar", value => {
cy.get(value)
.check({ force: true })

View File

@ -76,6 +76,7 @@ before(function() {
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
cy.route("DELETE", "/api/v1/applications/*").as("deleteApplication");
cy.route("PUT", "/api/v1/actions/*").as("saveQuery");
@ -84,6 +85,7 @@ before(function() {
cy.generateUUID().then(id => {
appId = id;
cy.CreateApp(id);
localStorage.setItem("AppName", appId);
});
cy.generateUUID().then(uid => {