Skip to content

Commit

Permalink
A few minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: Nandini Chandra <[email protected]>
  • Loading branch information
nachandr committed Sep 5, 2023
1 parent 31684a0 commit 0a857c8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ describe(["@tier2"], "Application import operations", () => {
openErrorReport();
verifyImportErrorMsg("Tag 'TypeScript' could not be found");

businessService.delete();
notExists(businessService.name);
// businessService.delete();
// notExists(businessService.name);
});

it("Applications import for non existing business service", function () {
Expand Down Expand Up @@ -224,30 +224,26 @@ describe(["@tier2"], "Application import operations", () => {
verifyImportErrorMsg(errorMsgs);
});

it("Applications import for with inavlid record type", function () {
it("Applications import with inavlid record type", function () {
// The only valid record types for records in a CSV file are 1(application) or 2(dependency).
// In this test, we import a CSV file that has records with a record type that's neither 1 nor 2.
// Automates https://issues.redhat.com/browse/TACKLE-634
Application.open();
cy.wait("@getApplication");

// Import csv with invalid record type
const fileName = "invalid_record_type_21.csv";
importApplication(filePath + fileName);
cy.wait(2000);

// Open application imports page
openManageImportsPage();

// Verify import applications page shows correct information
verifyAppImport(fileName, "Completed", 0, 2);

var errorMsgs = [
const errorMsgs = [
"Invalid or unknown Record Type '3'. Must be '1' for Application or '2' for Dependency.",
"Invalid or unknown Record Type '100'. Must be '1' for Application or '2' for Dependency.",
];

// Verify the error report message
openErrorReport();
verifyImportErrorMsg(errorMsgs);
});
Expand All @@ -257,22 +253,17 @@ describe(["@tier2"], "Application import operations", () => {
Application.open();
cy.wait("@getApplication");

// Import csv with invalid record type
const fileName = "missing_application_name.csv";
importApplication(filePath + fileName);
cy.wait(2000);

// Open application imports page
openManageImportsPage();

// Verify import applications page shows correct information
verifyAppImport(fileName, "Completed", 0, 1);

var errorMsgs = ["Application Name is mandatory."];

// Verify the error report message
const errorMsg = ["Application Name is mandatory."];
openErrorReport();
verifyImportErrorMsg(errorMsgs);
verifyImportErrorMsg(errorMsg);
});

after("Perform test data clean up", function () {
Expand Down
44 changes: 25 additions & 19 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,25 +828,31 @@ export function deleteApplicationTableRows(): void {
// are imported. For all other tests use deleteByList(appList)
navigate_to_application_inventory();
cy.get(commonView.appTable)
.find(trTag)
.not(".pf-c-table__expandable-row")
.each(($tableRow) => {
const name = $tableRow.find("td[data-label=Name]").text();
cy.get(tdTag)
.contains(name)
.closest(trTag)
.within(() => {
click(actionButton);
})
.contains(button, deleteAction)
.then(($delete_btn) => {
if (!$delete_btn.hasClass("pf-m-aria-disabled")) {
$delete_btn.click();
cy.wait(800);
click(commonView.confirmButton);
cy.wait(2000);
}
});
.next()
.then(($div) => {
if (!$div.hasClass("pf-c-empty-state")) {
cy.get("tbody")
.find(trTag)
.not(".pf-c-table__expandable-row")
.each(($tableRow) => {
const name = $tableRow.find("td[data-label=Name]").text();
cy.get(tdTag)
.contains(name)
.closest(trTag)
.within(() => {
click(actionButton);
})
.contains(button, deleteAction)
.then(($delete_btn) => {
if (!$delete_btn.hasClass("pf-m-aria-disabled")) {
$delete_btn.click();
cy.wait(800);
click(commonView.confirmButton);
cy.wait(2000);
}
});
});
}
});
}

Expand Down

0 comments on commit 0a857c8

Please sign in to comment.