Skip to content

Commit

Permalink
[RFR] Git test fix (#882)
Browse files Browse the repository at this point in the history
* Fix Some Issues

Signed-off-by: Shveta Sachdeva <[email protected]>

* Fix Some Issues

Signed-off-by: Shveta Sachdeva <[email protected]>

* Fix Some Issues

Signed-off-by: Shveta Sachdeva <[email protected]>

* Fix Some Issues

Signed-off-by: Shveta Sachdeva <[email protected]>

---------

Signed-off-by: Shveta Sachdeva <[email protected]>
Co-authored-by: Shveta Sachdeva <[email protected]>
  • Loading branch information
sshveta and Shveta Sachdeva authored Dec 13, 2023
1 parent b73c134 commit d4e81a2
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 34 deletions.
17 changes: 12 additions & 5 deletions cypress/e2e/models/migration/applicationinventory/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
performRowActionByIcon,
selectCheckBox,
selectFormItems,
sidedrawerTab,
uploadApplications,
uploadXml,
} from "../../../../utils/utils";
Expand Down Expand Up @@ -81,7 +82,7 @@ import {
} from "../../../views/applicationinventory.view";
import { CustomMigrationTargetView } from "../../../views/custom-migration-target.view";
import { actionSelectToggle } from "../../../views/common.view";
import { CustomMigrationTarget } from "../../administration/custom-migration-targets/custom-migration-target";
import * as commonView from "../../../views/common.view";

export class Analysis extends Application {
name: string;
Expand Down Expand Up @@ -368,8 +369,12 @@ export class Analysis extends Application {
}

openReport() {
// TODO: Update once the new reports feature is implemented
return;
sidedrawerTab(this.name, "Reports");
clickByText(button, "View analysis details");
cy.wait(2 * SEC);
clickByText(button, "Close");
cy.wait(2 * SEC);
commonView.sideDrawer.closeDrawer;
}

downloadReport(type: ReportTypeSelectors) {
Expand All @@ -390,9 +395,11 @@ export class Analysis extends Application {

openAnalysisDetails() {
cy.wait(2000);
performRowActionByIcon(this.name, kebabMenu);
sidedrawerTab(this.name, "Reports");
clickByText(button, analysisDetails);
cy.wait(2000);
cy.wait(2 * SEC);
commonView.sideDrawer.closeDrawer;
cy.wait(5 * SEC);
}

manageCredentials(sourceCred?: string, mavenCred?: string): void {
Expand Down
12 changes: 3 additions & 9 deletions cypress/e2e/models/migration/applicationinventory/assessment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
selectRow,
clickTab,
click,
sidedrawerTab,
} from "../../../../utils/utils";
import * as data from "../../../../utils/data_utils";
import {
Expand Down Expand Up @@ -251,7 +252,7 @@ export class Assessment {
`${entityName} - ${name}-10`,
];

this.sidedrawerTab(name, "Review");
sidedrawerTab(name, "Review");
for (let i in list) {
cy.get("dt")
.contains(list[i])
Expand Down Expand Up @@ -285,16 +286,9 @@ export class Assessment {
}

public static validateAssessmentField(name: string, page: string, risk: string): void {
this.sidedrawerTab(name, "Details");
sidedrawerTab(name, "Details");
cy.get(commonView.sideDrawer.risk).contains(`${page} risk`);
cy.get(commonView.sideDrawer.riskValue).contains(risk);
click(commonView.sideDrawer.closeDrawer);
}

public static sidedrawerTab(name: string, tab: string): void {
selectRow(name);
cy.get(commonView.sideDrawer.pageDrawerContent).within(() => {
clickTab(tab);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ describe(["@tier2"], "Jira connection negative tests", () => {
jiraBasicCredential = new JiraCredentials(
getJiraCredentialData(CredentialType.jiraBasic, useTestingAccount)
);

jiraBasicCredential.create();

// Defining Jira Cloud connection data with correct credentials
Expand All @@ -62,20 +61,17 @@ describe(["@tier2"], "Jira connection negative tests", () => {
isSecure,
useTestingAccount
);

jiraCloudConnection = new Jira(jiraCloudConnectionData);

// Defining and creating dummy credentials to be used further in tests
jiraBasicCredentialInvalid = new JiraCredentials(
getJiraCredentialData(CredentialType.jiraBasic, !useTestingAccount)
);

jiraBasicCredentialInvalid.create();

jiraBearerCredentialInvalid = new JiraCredentials(
getJiraCredentialData(CredentialType.jiraToken, !useTestingAccount)
);

jiraBearerCredentialInvalid.create();

// Defining Jira Cloud connection data with incorrect credentials
Expand All @@ -85,7 +81,6 @@ describe(["@tier2"], "Jira connection negative tests", () => {
isSecure,
useTestingAccount
);

jiraCloudConnectionIncorrect = new Jira(jiraCloudConnectionDataIncorrect);

// Defining Jira Stage connection data with incorrect credentials
Expand All @@ -95,7 +90,6 @@ describe(["@tier2"], "Jira connection negative tests", () => {
isSecure,
useTestingAccount
);

jiraStageConnectionIncorrect = new Jira(jiraStageConnectionDataIncorrect);

applicationList = createMultipleApplications(2);
Expand All @@ -112,10 +106,12 @@ describe(["@tier2"], "Jira connection negative tests", () => {
*/
jiraCloudConnectionIncorrect.create();
jiraCloudConnectionIncorrect.validateState(expectedToFail);
cy.wait(30 * SEC);
cy.wait(10 * SEC);
clickByText(button, "Not connected");
cy.get("#code-content").then(($code) => {
expect($code.text()).to.contain("401 Unauthorized");
expect($code.text()).to.contain(
"Client must be authenticated to access this resource."
);
expect($code.text().toLowerCase()).not.to.contain("html");
expect($code.text()).not.to.contain("403");
});
Expand All @@ -128,10 +124,12 @@ describe(["@tier2"], "Jira connection negative tests", () => {
*/
jiraStageConnectionIncorrect.create();
jiraStageConnectionIncorrect.validateState(expectedToFail);
cy.wait(30 * SEC);
cy.wait(10 * SEC);
clickByText(button, "Not connected");
cy.get("#code-content").then(($code) => {
expect($code.text()).to.contain("401 Unauthorized");
expect($code.text()).to.contain(
"Client must be authenticated to access this resource."
);
expect($code.text().toLowerCase()).not.to.contain("html");
expect($code.text()).not.to.contain("403");
});
Expand Down
19 changes: 10 additions & 9 deletions cypress/e2e/tests/administration/questionnaires/crud.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const yamlFileName = "questionnaire_import/cloud-native.yaml";
const importedQuestionnaire = "Cloud Native";
const legacyQuestionnaire = "Legacy Pathfinder";

describe(["@tier2"], "2 Bug: Questionnaire CRUD operations", () => {
describe(["@tier2"], "Questionnaire CRUD operations", () => {
before("Login", function () {
login();
// This test will fail if there are preexisting questionnaire.
Expand All @@ -34,22 +34,23 @@ describe(["@tier2"], "2 Bug: Questionnaire CRUD operations", () => {
closeModalWindow();
});

it("Bug MTA 1721: Export questionnaire and Import it back", function () {
it("Export questionnaire and Import it back", function () {
AssessmentQuestionnaire.export(legacyQuestionnaire);
cy.readFile("cypress/downloads/questionnaire-1.yaml").should(
"contain",
legacyQuestionnaire
);
cy.exec(
"cp cypress/downloads/questionnaire-1.yaml cypress/fixtures/questionnaire_import/questionnaire-1.yaml"
).then((result) => {
cy.log(result.stdout);
});
// Polarion TC MTA-423
AssessmentQuestionnaire.import("cypress/downloads/questionnaire-1.yaml");
checkSuccessAlert(
alertTitle,
`Success alert:Questionnaire "Legacy Pathfinder" was successfully created.`,
true
);
AssessmentQuestionnaire.import("questionnaire_import/questionnaire-1.yaml");
checkSuccessAlert(alertTitle, "UNIQUE constraint failed: Questionnaire.Name");
});

it("Bug MTA 1721: Delete questionnaire", function () {
it("Delete questionnaire", function () {
AssessmentQuestionnaire.delete(importedQuestionnaire);
checkSuccessAlert(
alertTitle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const filesToImport = [
];
const invalidSearchInput = String(data.getRandomNumber());

describe(["@tier2"], "Manage applications import filter validations", function () {
describe(["@tier2"], "1 Bug: Manage applications import filter validations", function () {
before("Login and create test data", function () {
login();
Application.open();
Expand Down
7 changes: 7 additions & 0 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ export function selectRow(name: string): void {
.click();
}

export function sidedrawerTab(name: string, tab: string): void {
selectRow(name);
cy.get(commonView.sideDrawer.pageDrawerContent).within(() => {
clickTab(tab);
});
}

export function checkSuccessAlert(fieldId: string, message: string, close = false): void {
validateTextPresence(fieldId, message);
if (close) {
Expand Down

0 comments on commit d4e81a2

Please sign in to comment.