Skip to content

Commit

Permalink
[WIP] Automate Application imformation test case
Browse files Browse the repository at this point in the history
Signed-off-by: Karishma Punwatkar <[email protected]>

	modified:   cypress/e2e/models/migration/applicationinventory/application.ts
	modified:   cypress/e2e/tests/migration/applicationinventory/applications/crud.test.ts
	modified:   cypress/e2e/types/constants.ts
	modified:   cypress/e2e/views/applicationinventory.view.ts
  • Loading branch information
kpunwatk committed Nov 16, 2023
1 parent 29b7565 commit e6e4318
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
23 changes: 22 additions & 1 deletion cypress/e2e/models/migration/applicationinventory/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
analyzeButton,
reviewAppButton,
migration,
details,
} from "../../../types/constants";
import { navMenu, navTab } from "../../../views/menu.view";
import {
Expand All @@ -46,6 +47,7 @@ import {
packaging,
kebabMenu,
repoTypeSelect,
profileEdit,
} from "../../../views/applicationinventory.view";
import { appDetailsView } from "../../../views/applicationinventory.view";
import * as commonView from "../../../views/common.view";
Expand Down Expand Up @@ -214,11 +216,16 @@ export class Application {
owner?: string;
comment?: string;
repoType?: string;
group?: string;
},
updateAppInfo = false,
cancel = false
): void {
cy.wait(2000);
performRowActionByIcon(this.name, editButton);
if (updateAppInfo) this.applicationInformation();
else {
performRowActionByIcon(this.name, editButton);
}

if (cancel) {
cancelForm();
Expand Down Expand Up @@ -247,6 +254,14 @@ export class Application {
this.selectRepoType(updatedValues.repoType);
this.repoType = updatedValues.repoType;
}
if (updatedValues.owner && updatedValues.owner != this.owner) {
this.selectOwner(updatedValues.owner);
this.owner = updatedValues.owner;
}
if (updatedValues.group && updatedValues.group != this.group) {
this.fillBinaryModeFields();
this.group = updatedValues.group;
}
if (updatedValues) {
submitForm();
}
Expand Down Expand Up @@ -429,4 +444,10 @@ export class Application {
doesExistText("Upload a local binary", rbacRules["Upload binary"]);
clickByText(button, "Cancel");
}

applicationInformation(): void {
this.applicationDetailsTab(details);
cy.wait(2000);
cy.get(profileEdit).click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ limitations under the License.
*/
/// <reference types="cypress" />

import { exists, login, notExists, getRandomApplicationData } from "../../../../../utils/utils";
import {
exists,
login,
notExists,
getRandomApplicationData,
getRandomAnalysisData,
} from "../../../../../utils/utils";
import * as data from "../../../../../utils/data_utils";
import { Assessment } from "../../../../models/migration/applicationinventory/assessment";
import { Stakeholders } from "../../../../models/migration/controls/stakeholders";
import { Analysis } from "../../../../models/migration/applicationinventory/analysis";

describe(["@tier1"], "Application crud operations", () => {
beforeEach("Login", function () {
Expand All @@ -26,6 +34,13 @@ describe(["@tier1"], "Application crud operations", () => {
// Interceptors
cy.intercept("POST", "/hub/application*").as("postApplication");
cy.intercept("GET", "/hub/application*").as("getApplication");

cy.fixture("application").then(function (appData) {
this.appData = appData;
});
cy.fixture("analysis").then(function (analysisData) {
this.analysisData = analysisData;
});
});

it("Application crud", function () {
Expand All @@ -49,4 +64,22 @@ describe(["@tier1"], "Application crud operations", () => {
// Assert that newly created application is deleted
notExists(application.name);
});

it("Update application profile details", function () {
const stakeholder = new Stakeholders(data.getEmail(), data.getFullName());
stakeholder.create();
cy.wait(2000);
// const application = new Assessment(getRandomApplicationData());
const application = new Analysis(
getRandomApplicationData("tackleTestApp_Source", {
sourceData: this.appData["tackle-testapp-git"],
}),
getRandomAnalysisData(this.analysisData["analysis_for_enableTagging"])
);
application.create();
cy.wait("@getApplication");

var addComment = data.getDescription();
application.edit({ owner: stakeholder.name, comment: addComment }, true);
});
});
1 change: 1 addition & 0 deletions cypress/e2e/types/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const criticality = "Criticality";
export const credentials = "Credentials";
export const credentialType = "Credential type";
export const deleteAction = "Delete";
export const details = "Details";
export const editAction = "Edit";
export const startDate = "Start date";
export const endDate = "End date";
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/views/applicationinventory.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const kebabMenu = "#row-actions";
export const topKebabMenu = "#toolbar-kebab";
export const kebabMenuItem = "span.pf-v5-c-menu__item-text";
export const bulkApplicationSelectionCheckBox = "input[name='bulk-selected-items-checkbox']";
export const profileEdit = ".pf-m-1-col > .pf-v5-c-button";

// This is on the Application imports page.
export const sideKebabMenuImports = "button[aria-label='Kebab toggle']";

Expand Down

0 comments on commit e6e4318

Please sign in to comment.