Skip to content

Commit

Permalink
Update getRandomApplicationData()
Browse files Browse the repository at this point in the history
Signed-off-by: Nandini Chandra <[email protected]>
  • Loading branch information
nachandr committed Aug 1, 2023
1 parent f98d8f7 commit ac985de
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export class Application {

tagAndCategoryExists(tags: string | string[][]): void {
// Verify that tags and categories are present on Application details -> Tags page
this.applicationDetailsTab("Tags");
// this.applicationDetailsTab("Tags");
if (Array.isArray(tags)) {
// For Tags and Categories
for (var tagIndex = 0; tagIndex < tags.length; tagIndex++) {
Expand All @@ -332,7 +332,7 @@ export class Application {
}
// For Tags
else cy.get(applicationTag).should("contain", tags);
this.closeApplicationDetails();
// this.closeApplicationDetails();
}

static validateAssessButton(rbacRules: RbacValidationRules) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ import {
} from "../../../../types/constants";
import * as data from "../../../../../utils/data_utils";
import { CredentialsSourceControlUsername } from "../../../../models/administration/credentials/credentialsSourceControlUsername";
import { Tag } from "../../../../models/migration/controls/tags";
import { TagCategory } from "../../../../models/migration/controls/tagcategory";
let source_credential;
var applicationsList: Array<Analysis> = [];
let tagCategory;
let tag;

describe(["@tier1"], "Source Analysis", () => {
before("Login", function () {
login();

source_credential = new CredentialsSourceControlUsername(
data.getRandomCredentialsData(
CredentialType.sourceControl,
Expand All @@ -42,6 +45,16 @@ describe(["@tier1"], "Source Analysis", () => {
)
);
source_credential.create();

tagCategory = new TagCategory(
data.getRandomWord(8),
data.getColor(),
data.getRandomNumber(1, 30)
);
tagCategory.create();

tag = new Tag(data.getRandomWord(6), tagCategory.name);
tag.create();
});

beforeEach("Load data", function () {
Expand All @@ -60,7 +73,7 @@ describe(["@tier1"], "Source Analysis", () => {
it("Apply search filter on app details page", function () {
// Automates Polarion MTA-311
const application = new Analysis(
getRandomApplicationData("tackleTestApp_Source_autoTagging", {
getRandomApplicationData("tackleTestApp_Source_autoTagging", tag.name, {
sourceData: this.appData["tackle-testapp-git"],
}),
getRandomAnalysisData(this.analysisData["analysis_for_enableTagging"])
Expand All @@ -72,14 +85,14 @@ describe(["@tier1"], "Source Analysis", () => {
application.manageCredentials(source_credential.name, null);
application.analyze();
application.verifyAnalysisStatus("Completed");
application.applicationDetailsTab("Tags");
cy.wait(2000);

// Filter tags by source:Analysis
application.filterTags("Analysis");
application.tagAndCategoryExists(
this.analysisData["analysis_for_enableTagging"]["techTags"]
);
cy.get("span.pf-c-label__content").should('not.contain', tag.name);
application.closeApplicationDetails();
application.delete();
});
Expand Down
5 changes: 5 additions & 0 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ export function getRowsAmount(): number {

export function getRandomApplicationData(
appName?,
tags?,
options?: { sourceData?; binaryData? }
): applicationData {
let name = data.getAppName();
Expand Down Expand Up @@ -1154,6 +1155,10 @@ export function getRandomApplicationData(
appdata["packaging"] = options.binaryData.packaging;
}
}

if (tags) {
appdata["tags"] = tags;
}
return appdata;
}

Expand Down

0 comments on commit ac985de

Please sign in to comment.