Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Fixed test that tries to remove Jira connection in use #753

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,15 @@ import {
clickByText,
createMultipleApplications,
deleteByList,
exists,
login,
performRowAction,
validateTextPresence,
} from "../../../../utils/utils";
import { getJiraConnectionData, getJiraCredentialData } from "../../../../utils/data_utils";
import {
button,
cantDeleteJiraAlert,
CredentialType,
deleteAction,
JiraIssueTypes,
JiraType,
SEC,
} from "../../../types/constants";
import { button, CredentialType, JiraType, SEC } from "../../../types/constants";
import { JiraConnectionData } from "../../../types/types";
import { Jira } from "../../../models/administration/jira-connection/jira";
import { JiraCredentials } from "../../../models/administration/credentials/JiraCredentials";
import { MigrationWave } from "../../../models/migration/migration-waves/migration-wave";
import * as data from "../../../../utils/data_utils";
import { Assessment } from "../../../models/migration/applicationinventory/assessment";
import { jiraAlert, jiraTable } from "../../../views/jira.view";

describe(["@tier2"], "Jira connection negative tests", () => {
const expectedToFail = true;
Expand All @@ -52,11 +39,9 @@ describe(["@tier2"], "Jira connection negative tests", () => {
let jiraStageConnectionDataIncorrect: JiraConnectionData;
let jiraCloudConnectionData: JiraConnectionData;
let jiraCloudConnectionDataIncorrect: JiraConnectionData;
let jiraCloudConnection: Jira;
let jiraCloudConnectionIncorrect: Jira;
let jiraStageConnectionIncorrect: Jira;
let applicationList: Array<Assessment> = [];
const targetProject = Cypress.env("jira_atlassian_cloud_project");
const now = new Date();
now.setDate(now.getDate() + 1);
const end = new Date(now.getTime());
Expand All @@ -79,8 +64,6 @@ describe(["@tier2"], "Jira connection negative tests", () => {
useTestingAccount
);

jiraCloudConnection = new Jira(jiraCloudConnectionData);

// Defining and creating dummy credentials to be used further in tests
jiraBasicCredentialInvalid = new JiraCredentials(
getJiraCredentialData(CredentialType.jiraBasic, !useTestingAccount)
Expand Down Expand Up @@ -151,54 +134,11 @@ describe(["@tier2"], "Jira connection negative tests", () => {
});
});

it("Bug MTA-1014 | Trying to remove Jira connection used by wave", () => {
/**
Implements MTA-363 - Delete Jira Instance in use
*/
const issueType = JiraIssueTypes.task;
let projectName = "";
jiraCloudConnection.create();
jiraCloudConnection.validateState(!expectedToFail);

// Defining and creating new migration wave
migrationWave = new MigrationWave(
data.getRandomWord(8),
now,
end,
null,
null,
applicationList
);
migrationWave.create();

jiraCloudConnection
.getProject(targetProject)
.then((project) => {
projectName = project.name;
return jiraCloudConnection.getIssueType(issueType);
})
.then((issue) => {
expect(!!issue).to.eq(true);
migrationWave.exportToIssueManager(
JiraType.cloud,
jiraCloudConnection.name,
projectName,
issue.untranslatedName
);
});
Jira.openList();
performRowAction(jiraCloudConnection.name, deleteAction);
validateTextPresence(jiraAlert, cantDeleteJiraAlert);
exists(jiraCloudConnection.name, jiraTable);
});

after("Clean up data", () => {
migrationWave.delete();
cy.wait("@deleteWave");
jiraCloudConnectionIncorrect.delete();
jiraCloudConnection.delete();
jiraBasicCredentialInvalid.delete();
jiraBasicCredential.delete();
deleteByList(applicationList);
});
});
Loading