Skip to content

Commit

Permalink
[RFR] Task manager - table column management validation (#1306)
Browse files Browse the repository at this point in the history
* Task manager - table column management validation

Signed-off-by: Maayan Hadasi <[email protected]>

* Changes after review

Signed-off-by: Maayan Hadasi <[email protected]>

---------

Signed-off-by: Maayan Hadasi <[email protected]>
  • Loading branch information
mguetta1 authored Jan 16, 2025
1 parent 18fcb8f commit 9b25c16
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 1 deletion.
74 changes: 74 additions & 0 deletions cypress/e2e/tests/migration/task-manager/manage_columns.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
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 {
clickByText,
login,
openManageColumns,
restoreColumnsToDefault,
selectColumns,
validateCheckBoxIsDisabled,
validateTextPresence,
} from "../../../../utils/utils";
import { TaskManager } from "../../../models/migration/task-manager/task-manager";
import { button, cancel, save } from "../../../types/constants";
import { tableHead } from "../../../views/common.view";
import { TaskManagerTableHeaders } from "../../../views/taskmanager.view";

describe(["@tier3"], "Task manager - table column management validation", function () {
const taskManagerDefaultColumns = Object.values(TaskManagerTableHeaders).slice(0, 6);
const columnsToSelect = [
TaskManagerTableHeaders.pod,
TaskManagerTableHeaders.started,
TaskManagerTableHeaders.terminated,
];

before("Login", function () {
login();
});

it("Open task manager page - table default columns should be visible", function () {
TaskManager.open();
taskManagerDefaultColumns.forEach((column) => validateTextPresence(tableHead, column));
columnsToSelect.forEach((column) => validateTextPresence(tableHead, column, false));
});

it("Select columns to display in the table view - they should be visible", function () {
// Check the unchecked columns and verify that all columns are visible
selectColumns(columnsToSelect);
Object.values(TaskManagerTableHeaders).forEach((column) =>
validateTextPresence(tableHead, column)
);
});

it("Validate ID checbox in the manage columns window is checked and disabled", function () {
openManageColumns();
validateCheckBoxIsDisabled(TaskManagerTableHeaders.id, true);
clickByText(button, save);
});

it("Validate restoring columns to default", function () {
restoreColumnsToDefault();
taskManagerDefaultColumns.forEach((column) => validateTextPresence(tableHead, column));
});

it("Validate cancel button in the manage columns window", function () {
openManageColumns();
clickByText(button, cancel);
taskManagerDefaultColumns.forEach((column) => validateTextPresence(tableHead, column));
});
});
1 change: 1 addition & 0 deletions cypress/e2e/views/common.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const kebabMenuItem = "a.pf-c-dropdown__menu-item";
export const kebabActionButton = "li.pf-v5-c-menu__list-item";
export const commonTable = "table.pf-v5-c-table.pf-m-grid-md";
export const tableRowActions = ".pf-v5-c-table__tr.actions-row";
export const tableHead = "thead[class='pf-v5-c-table__thead']";
export const plainButton = "button.pf-v5-c-button.pf-m-plain";
export const dropdownClearSelection = "pf-v5-c-select__toggle-clear";
export const footer = "footer";
Expand Down
12 changes: 12 additions & 0 deletions cypress/e2e/views/taskmanager.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ export enum TaskManagerColumns {
createdBy = 'td[data-label="Created By"]',
}
export const tasksTable = "table[aria-label='Tasks table']";
export enum TaskManagerTableHeaders {
id = "ID",
application = "Application",
status = "Status",
kind = "Kind",
priority = "Priority",
preemption = "Preemption",
createdBy = "Created By",
pod = "Pod",
started = "Started",
terminated = "Terminated",
}
2 changes: 1 addition & 1 deletion cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ export function validateCheckBoxIsDisabled(checkBoxText: string, isChecked?: boo
}

export function getCheckboxSelector(text: string) {
text = text.charAt(0).toLowerCase() + text.slice(1).replace(/\s+/g, "");
text = text.toLowerCase().replace(/\s+/g, "");
return `input[aria-labelledby='check-${text}']`;
}

Expand Down

0 comments on commit 9b25c16

Please sign in to comment.