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][TA] Fixes for administration/custom targets test #715

Merged
merged 5 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
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
@@ -1,6 +1,7 @@
import {
click,
clickByText,
clickJs,
inputText,
selectUserPerspective,
uploadXml,
Expand All @@ -9,7 +10,6 @@ import {
createNewButton,
customMigrationTargets,
button,
SEC,
deleteAction,
editAction,
RepositoryType,
Expand All @@ -18,6 +18,7 @@ import {
import { navMenu } from "../../../views/menu.view";
import { CustomMigrationTargetView } from "../../../views/custom-migration-target.view";
import { RulesManualFields, RulesRepositoryFields } from "../../../types/types";
import { submitButton } from "../../../views/common.view";

export interface CustomMigrationTarget {
name: string;
Expand Down Expand Up @@ -57,10 +58,7 @@ export class CustomMigrationTarget {
public create() {
CustomMigrationTarget.openNewForm();
CustomMigrationTarget.fillForm(this);

cy.get(CustomMigrationTargetView.createSubmitButton, { timeout: 10 * SEC })
.should("be.enabled")
.click();
clickJs(submitButton);
}

public edit(updateValues: Partial<CustomMigrationTarget>) {
Expand All @@ -70,9 +68,7 @@ export class CustomMigrationTarget {

CustomMigrationTarget.fillForm(updateValues);

cy.get(CustomMigrationTargetView.editSubmitButton, { timeout: 10 * SEC })
.should("be.enabled")
.click({ force: true });
clickJs(submitButton);
}

public delete() {
Expand Down Expand Up @@ -161,7 +157,7 @@ export class CustomMigrationTarget {

private expandActionsMenu() {
cy.contains(this.name)
.parents("article")
.parents(CustomMigrationTargetView.card)
.within(() => {
cy.get(CustomMigrationTargetView.actionsButton).then(($btn) => {
if ($btn.attr("aria-expanded") === "false") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,26 @@ describe(["@tier1", "@dc", "@interop"], "Custom Migration Targets CRUD operation
this.analysisData = analysisData;
});

cy.intercept("POST", "/hub/rulesets*").as("postRule");
cy.intercept("GET", "/hub/rulesets*").as("getRule");
cy.intercept("PUT", "/hub/rulesets*/*").as("putRule");
cy.intercept("DELETE", "/hub/rulesets*/*").as("deleteRule");
cy.intercept("POST", "/hub/targets/*").as("postRule");
cy.intercept("GET", "/hub/targets*").as("getRule");
cy.intercept("PUT", "/hub/targets*/*").as("putRule");
cy.intercept("DELETE", "/hub/targets*/*").as("deleteRule");
});

it("Custom Migration Targets CRUD with rules uploaded manually", function () {
const targetData = this.customMigrationTargets.manual_rules;
const targetData = this.customMigrationTargets["manual_rules"];
const target = new CustomMigrationTarget(
data.getRandomWord(8),
data.getDescription(),
targetData.image,
getRulesData(targetData)
);
target.create();
cy.wait("@postRule");
cy.contains(CustomMigrationTargetView.takeMeThereNotification).click();
cy.get("article", { timeout: 12 * SEC }).should("contain", target.name);
cy.get(CustomMigrationTargetView.card, { timeout: 12 * SEC }).should(
"contain",
target.name
);

const newName = data.getRandomWord(8);
const newRules = {
Expand All @@ -82,14 +84,16 @@ describe(["@tier1", "@dc", "@interop"], "Custom Migration Targets CRUD operation
name: newName,
ruleTypeData: newRules,
});
cy.wait("@putRule");
cy.get("article", { timeout: 12 * SEC }).should("contain", newName);
cy.get(CustomMigrationTargetView.card, { timeout: 12 * SEC }).should("contain", newName);
target.name = newName;
target.ruleTypeData = newRules;

target.delete();
cy.wait("@deleteRule");
cy.get("article", { timeout: 12 * SEC }).should("not.contain", target.name);
cy.get(CustomMigrationTargetView.card, { timeout: 12 * SEC }).should(
"not.contain",
target.name
);
});

it("Create Custom Migration Target with rules from repository with credentials", function () {
Expand All @@ -102,7 +106,7 @@ describe(["@tier1", "@dc", "@interop"], "Custom Migration Targets CRUD operation
);

sourceCredential.create();
const targetData = this.customMigrationTargets.rules_from_tackle_testApp;
const targetData = this.customMigrationTargets["rules_from_tackle_testApp"];
const repositoryData = {
...getRulesData(targetData),
credentials: sourceCredential,
Expand All @@ -116,41 +120,45 @@ describe(["@tier1", "@dc", "@interop"], "Custom Migration Targets CRUD operation
);

target.create();
cy.wait("@postRule");
cy.contains(CustomMigrationTargetView.takeMeThereNotification).click();
cy.get("article", { timeout: 12 * SEC }).should("contain", target.name);
cy.get(CustomMigrationTargetView.card, { timeout: 12 * SEC }).should(
"contain",
target.name
);

target.delete();
cy.wait("@deleteRule");
cy.get("article", { timeout: 12 * SEC }).should("not.contain", target.name);
cy.get(CustomMigrationTargetView.card, { timeout: 12 * SEC }).should(
"not.contain",
target.name
);

sourceCredential.delete();
});

it("Change layout", function () {
const targetData = this.customMigrationTargets.manual_rules;
const targetData = this.customMigrationTargets["manual_rules"];
const target = new CustomMigrationTarget(
data.getRandomWord(8),
data.getDescription(),
targetData.image,
getRulesData(targetData)
);
target.create();
cy.wait("@postRule");

const dragButton = cy
.get("article", { timeout: 12 * SEC })
.contains(target.name)
.parents("article")
.contains(CustomMigrationTargetView.card, target.name, { timeout: 12 * SEC })
.find(CustomMigrationTargetView.dragButton);

// Moves the custom migration target to the first place
cy.wait(SEC);
dragButton.move({
deltaX: Number.MIN_SAFE_INTEGER,
deltaY: Number.MIN_SAFE_INTEGER,
force: true,
waitForAnimations: false,
});
cy.wait(SEC);

const application = new Analysis(
getRandomApplicationData("bookserverApp", {
Expand All @@ -163,13 +171,14 @@ describe(["@tier1", "@dc", "@interop"], "Custom Migration Targets CRUD operation
Analysis.open();
selectItemsPerPage(100);
application.selectApplication();
cy.contains("button", analyzeButton, { timeout: 20000 }).should("be.enabled").click();
cy.contains(button, analyzeButton, { timeout: 20 * SEC })
.should("be.enabled")
.click();

application.selectSourceofAnalysis(application.source);
cy.contains("button", "Next", { timeout: 200 }).click();
cy.contains(button, "Next", { timeout: 200 }).click();

cy.get("form article", { timeout: 12 * SEC })
.children()
cy.get(".pf-v5-c-card__body", { timeout: 12 * SEC })
.first()
.should("contain", target.name);
clickByText(button, "Cancel");
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/views/custom-migration-target.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export enum CustomMigrationTargetView {
credentialsDropdown = "#associated-credentials-select-toggle",
retrieveFromARepositoryRadio = "#repository",
dragButton = "#drag-button",
card = ".pf-v5-c-card",
}
Loading