github.com/minio/console@v1.4.1/web-app/tests/utils/elements-menu.ts (about) 1 // This file is part of MinIO Console Server 2 // Copyright (c) 2022 MinIO, Inc. 3 // 4 // This program is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Affero General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Affero General Public License for more details. 13 // 14 // You should have received a copy of the GNU Affero General Public License 15 // along with this program. If not, see <http://www.gnu.org/licenses/>. 16 17 import { Selector } from "testcafe"; 18 19 //---------------------------------------------------- 20 // Functions to get elements 21 //---------------------------------------------------- 22 23 export const getMenuElement = (item) => { 24 return Selector("div.menuItems").find("button").withAttribute("id", item); 25 }; 26 27 export const getSubmenuBlock = (item) => { 28 return getMenuElement(item).sibling("div.subItemsBox"); 29 }; 30 31 //---------------------------------------------------- 32 // General sidebar element 33 //---------------------------------------------------- 34 export const logoutItem = getMenuElement("sign-out"); 35 36 //---------------------------------------------------- 37 // Specific sidebar elements 38 //---------------------------------------------------- 39 export const monitoringElement = getMenuElement("tools"); 40 export const monitoringChildren = getSubmenuBlock("tools"); 41 42 export const dashboardElement = monitoringChildren 43 .find("button") 44 .withAttribute("id", "monitorMetrics"); 45 export const logsElement = monitoringChildren 46 .find("button") 47 .withAttribute("id", "monitorLogs"); 48 export const traceElement = monitoringChildren 49 .find("button") 50 .withAttribute("id", "monitorTrace"); 51 export const drivesElement = monitoringChildren 52 .find("button") 53 .withAttribute("id", "monitorDrives"); 54 export const watchElement = monitoringChildren 55 .find("button") 56 .withAttribute("id", "monitorWatch"); 57 58 export const bucketsElement = getMenuElement("buckets"); 59 60 export const serviceAcctsElement = getMenuElement("nav-accesskeys"); 61 62 export const identityElement = getMenuElement("identity"); 63 export const identityChildren = getSubmenuBlock("identity"); 64 65 export const usersElement = identityChildren 66 .find("button") 67 .withAttribute("id", "users"); 68 export const groupsElement = identityChildren 69 .find("button") 70 .withAttribute("id", "groups"); 71 72 export const iamPoliciesElement = getMenuElement("policies"); 73 74 export const configurationsElement = getMenuElement("configurations"); 75 76 export const notificationEndpointsElement = getMenuElement("lambda"); 77 78 export const tiersElement = getMenuElement("tiers"); 79 80 export const diagnosticsElement = getMenuElement("diagnostics"); 81 export const performanceElement = getMenuElement("performance"); 82 export const inspectElement = getMenuElement("inspectObjects"); 83 84 export const licenseElement = getMenuElement("license");