Skip to content

Commit

Permalink
[RFR] Archetype association - Application creation before archetype c…
Browse files Browse the repository at this point in the history
…reation (#904)

* Archetype association - Application creation before archetype creation

* Moved selectors out

Signed-off-by: Nandini Chandra <[email protected]>

* Add Polarion TC number

Signed-off-by: Nandini Chandra <[email protected]>

* Minor changes

Signed-off-by: Nandini Chandra <[email protected]>

* Minor changes

Signed-off-by: Nandini Chandra <[email protected]>

* Minor change

Signed-off-by: Nandini Chandra <[email protected]>

---------

Signed-off-by: Nandini Chandra <[email protected]>
  • Loading branch information
nachandr authored Jan 12, 2024
1 parent 6be8c3a commit 15bd7f2
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export class Assessment {
public static validateAssessmentField(name: string, page: string, risk: string): void {
sidedrawerTab(name, "Details");
cy.get(commonView.sideDrawer.risk).contains(`${page} risk`);
cy.get(commonView.sideDrawer.riskValue).contains(risk);
cy.get(commonView.sideDrawer.labelContent).contains(risk);
click(commonView.sideDrawer.closeDrawer);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
Copyright © 2021 the Konveyor Contributors (https://konveyor.io/)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/// <reference types="cypress" />

import * as data from "../../../../../utils/data_utils";
import * as commonView from "../../../../views/common.view";
import {
click,
login,
createMultipleTags,
deleteByList,
sidedrawerTab,
} from "../../../../../utils/utils";
import { Application } from "../../../../models/migration/applicationinventory/application";
import { Archetype } from "../../../../models/migration/archetypes/archetype";
import { SEC } from "../../../../types/constants";
import { Tag } from "../../../../models/migration/controls/tags";

let applicationList: Array<Application> = [];
let archetypeList: Array<Archetype> = [];
let tags: Tag[];

describe(["@tier2"], "Tests related to application-archetype association ", () => {
before("Login", function () {
login();
tags = createMultipleTags(2);
});

it("Archetype association - Application creation before archetype creation ", function () {
// Automates Polarion MTA-400
const appdata = {
name: data.getAppName(),
description: data.getDescription(),
tags: [tags[0].name],
comment: data.getDescription(),
};

const application = new Application(appdata);
applicationList.push(application);
application.create();
cy.wait(2 * SEC);

const archetypeList = [];
const archetype = new Archetype(
data.getRandomWord(8),
[tags[0].name],
[tags[1].name],
null
);
archetype.create();
cy.wait(2 * SEC);
archetypeList.push(archetype);

// Assert that associated archetypes are listed on app drawer after application gets associated with archetype(s)
Application.open();
sidedrawerTab(application.name, "Details");
cy.get(commonView.sideDrawer.associatedArchetypes).contains("Associated archetypes");
cy.get(commonView.sideDrawer.labelContent).contains(archetype.name);
click(commonView.sideDrawer.closeDrawer);
});

after("Perform test data clean up", function () {
deleteByList(applicationList);
deleteByList(archetypeList);
deleteByList(tags);
});
});
3 changes: 2 additions & 1 deletion cypress/e2e/views/common.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export const actionSelectToggle = "#action-select-toggle";
// Application/Archetype side drawer
export enum sideDrawer {
risk = "h3.pf-v5-c-title.pf-m-md",
riskValue = "span.pf-v5-c-label__content",
labelContent = "span.pf-v5-c-label__content",
closeDrawer = "button[aria-label='Close drawer panel']",
pageDrawerContent = "#page-drawer-content",
associatedArchetypes = "span.pf-v5-c-description-list__text",
}

0 comments on commit 15bd7f2

Please sign in to comment.