github.com/minio/console@v1.4.1/web-app/tests/utils/elements.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 * as constants from "./constants"; 18 import { Selector } from "testcafe"; 19 //---------------------------------------------------- 20 // Buttons 21 //---------------------------------------------------- 22 export const uploadButton = Selector("button:enabled").withAttribute( 23 "id", 24 "upload-main", 25 ); 26 export const createPolicyButton = 27 Selector("button:enabled").withText("Create Policy"); 28 export const saveButton = Selector("button:enabled").withText("Save"); 29 export const deleteButton = Selector("button:enabled").withExactText("Delete"); 30 31 export const addEventDestination = Selector("button:enabled").withText( 32 "Add Event Destination", 33 ); 34 export const createTierButton = 35 Selector("button:enabled").withText("Create Tier"); 36 export const createUserButton = 37 Selector("button:enabled").withText("Create User"); 38 export const createGroupButton = 39 Selector("button:enabled").withText("Create Group"); 40 export const addAccessRuleButton = 41 Selector("button:enabled").withText("Add Access Rule"); 42 export const startDiagnosticButton = Selector("button:disabled").withText( 43 "Start Health Report", 44 ); 45 export const startNewDiagnosticButton = Selector("#start-new-diagnostic"); 46 export const downloadButton = Selector("button:enabled").withText("Download"); 47 export const startButton = Selector("button:enabled").withText("Start"); 48 export const assignPoliciesButton = Selector("button").withAttribute( 49 "id", 50 "assign-policies", 51 ); 52 53 //---------------------------------------------------- 54 // Switches 55 //---------------------------------------------------- 56 export const switchInput = Selector("#group-status").sibling("span"); 57 export const deleteAllVersions = 58 Selector("#delete-versions").sibling("span.switchRail"); 59 60 //---------------------------------------------------- 61 // Inputs 62 //---------------------------------------------------- 63 export const bucketNameInput = Selector("#bucket-name-select"); 64 export const bucketsPrefixInput = Selector("#prefix"); 65 export const bucketsAccessInput = Selector("div.selectContainer"); 66 export const bucketsAccessReadOnlyInput = Selector("div").withAttribute( 67 "label", 68 "readonly", 69 ); 70 export const bucketsAccessWriteOnlyInput = Selector("div").withAttribute( 71 "label", 72 "writeonly", 73 ); 74 export const bucketsAccessReadWriteInput = Selector("div").withAttribute( 75 "label", 76 "readwrite", 77 ); 78 export const uploadInput = Selector("input").withAttribute("type", "file"); 79 export const createPolicyName = Selector("#policy-name"); 80 export const createPolicyTextfield = Selector(".w-tc-editor-text"); 81 export const usersAccessKeyInput = Selector("#accesskey-input"); 82 export const usersSecretKeyInput = Selector("#standard-multiline-static"); 83 export const groupNameInput = Selector("#group-name"); 84 export const searchResourceInput = Selector("#search-resource"); 85 export const filterUserInput = searchResourceInput.withAttribute( 86 "placeholder", 87 "Filter Users", 88 ); 89 export const groupUserCheckbox = Selector(".ReactVirtualized__Table__row input") 90 .withAttribute("type", "checkbox") 91 .withAttribute("value", constants.TEST_USER_NAME) 92 .sibling("span"); 93 94 //---------------------------------------------------- 95 // Dropdowns and options 96 //---------------------------------------------------- 97 export const bucketDropdownOptionFor = (modifier) => { 98 return Selector("#bucket-name-options-selector div").withText( 99 `${constants.TEST_BUCKET_NAME}-${modifier}`, 100 ); 101 }; 102 103 //---------------------------------------------------- 104 // Text 105 //---------------------------------------------------- 106 export const groupStatusText = Selector("#group-status-label"); 107 108 //---------------------------------------------------- 109 // Tables, table headers and content 110 //---------------------------------------------------- 111 export const table = Selector(".ReactVirtualized__Table"); 112 export const bucketsTableDisabled = Selector("#empty-results").withText( 113 "You require additional permissions in order to view Objects in this bucket. Please ask your MinIO administrator to grant you", 114 ); 115 export const createGroupUserTable = Selector( 116 ".MuiDialog-container .ReactVirtualized__Table", 117 ); 118 119 //---------------------------------------------------- 120 // Bucket page vertical tabs 121 //---------------------------------------------------- 122 export const bucketAccessRulesTab = Selector("button").withAttribute( 123 "id", 124 "anonymous", 125 ); 126 127 //---------------------------------------------------- 128 // Settings window 129 //---------------------------------------------------- 130 export const settingsWindow = Selector("#settings-container"); 131 132 //---------------------------------------------------- 133 // Settings page vertical tabs 134 //---------------------------------------------------- 135 export const settingsRegionTab = Selector("button").withAttribute( 136 "id", 137 "settings-tab-Region", 138 ); 139 export const settingsCompressionTab = Selector("button").withAttribute( 140 "id", 141 "settings-tab-Compression", 142 ); 143 export const settingsApiTab = Selector("button").withAttribute( 144 "id", 145 "settings-tab-API", 146 ); 147 export const settingsHealTab = Selector("button").withAttribute( 148 "id", 149 "settings-tab-Heal", 150 ); 151 export const settingsScannerTab = Selector("button").withAttribute( 152 "id", 153 "settings-tab-Scanner", 154 ); 155 export const settingsEtcdTab = Selector("button").withAttribute( 156 "id", 157 "settings-tab-Etcd", 158 ); 159 export const settingsLoggerWebhookTab = Selector("button").withAttribute( 160 "id", 161 "settings-tab-Logger Webhook", 162 ); 163 export const settingsAuditWebhookTab = Selector("button").withAttribute( 164 "id", 165 "settings-tab-Audit Webhook", 166 ); 167 export const settingsAuditKafkaTab = Selector("button").withAttribute( 168 "id", 169 "settings-tab-Audit Kafka", 170 ); 171 172 //---------------------------------------------------- 173 // Log window 174 //---------------------------------------------------- 175 export const logWindow = Selector('[data-test-id="logs-list-container"]'); 176 //Node selector 177 export const nodeSelector = Selector("#node-selector-select"); 178 //---------------------------------------------------- 179 // User Details 180 //---------------------------------------------------- 181 export const userPolicies = Selector(".optionsList button").withAttribute( 182 "id", 183 "policies", 184 ); 185 //---------------------------------------------------- 186 // Rewind Options 187 //---------------------------------------------------- 188 export const rewindButton = Selector("button").withAttribute( 189 "id", 190 "rewind-objects-list", 191 ); 192 export const rewindToBaseInput = Selector("div").withAttribute( 193 "id", 194 "rewind-selector-DateTimeInput", 195 ); 196 export const rewindToInput = Selector("input").withAttribute( 197 "id", 198 "rewind-selector", 199 ); 200 export const rewindDataButton = Selector("button").withAttribute( 201 "id", 202 "rewind-apply-button", 203 ); 204 export const locationEmpty = Selector("div").withAttribute( 205 "id", 206 "empty-results", 207 ); 208 //---------------------------------------------------- 209 // Login Window 210 //---------------------------------------------------- 211 export const loginButton = Selector("button").withAttribute("id", "do-login");