github.com/minio/console@v1.4.1/web-app/tests/permissions-6/errorsVisibleOB.ts (about) 1 // This file is part of MinIO Console Server 2 // Copyright (c) 2023 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 roles from "../utils/roles"; 18 import { Selector } from "testcafe"; 19 import * as functions from "../utils/functions"; 20 import { namedTestBucketBrowseButtonFor } from "../utils/functions"; 21 22 fixture("Test error visibility in Object Browser Navigation").page( 23 "http://localhost:9090/", 24 ); 25 26 const bucketName = "my-company"; 27 const bucketName2 = "my-company2"; 28 const bucketBrowseButton = namedTestBucketBrowseButtonFor(bucketName); 29 const bucketBrowseButton2 = namedTestBucketBrowseButtonFor(bucketName2); 30 export const file = Selector(".ReactVirtualized__Table__rowColumn").withText( 31 "test.txt", 32 ); 33 export const deniedError = 34 Selector(".messageTruncation").withText("Access Denied."); 35 36 test 37 .before(async (t) => { 38 await functions.setUpNamedBucket(t, bucketName); 39 await functions.uploadNamedObjectToBucket( 40 t, 41 bucketName, 42 "test.txt", 43 "web-app/tests/uploads/test.txt", 44 ); 45 await functions.uploadNamedObjectToBucket( 46 t, 47 bucketName, 48 "home/UserY/test.txt", 49 "web-app/tests/uploads/test.txt", 50 ); 51 await functions.uploadNamedObjectToBucket( 52 t, 53 bucketName, 54 "home/UserX/test.txt", 55 "web-app/tests/uploads/test.txt", 56 ); 57 })( 58 "Error Notification is shown in Object Browser when no privileges are set", 59 async (t) => { 60 await t 61 .useRole(roles.conditions3) 62 .navigateTo(`http://localhost:9090/browser`) 63 .click(bucketBrowseButton) 64 .click(Selector(".ReactVirtualized__Table__rowColumn").withText("home")) 65 .click( 66 Selector(".ReactVirtualized__Table__rowColumn").withText("UserX"), 67 ) 68 .expect(deniedError.exists) 69 .ok(); 70 }, 71 ) 72 .after(async (t) => { 73 await functions.cleanUpNamedBucketAndUploads(t, bucketName); 74 }); 75 76 test 77 .before(async (t) => { 78 await functions.setUpNamedBucket(t, bucketName2); 79 await functions.setVersionedBucket(t, bucketName2); 80 await functions.uploadNamedObjectToBucket( 81 t, 82 bucketName2, 83 "test.txt", 84 "web-app/tests/uploads/test.txt", 85 ); 86 await functions.uploadNamedObjectToBucket( 87 t, 88 bucketName2, 89 "home/UserY/test.txt", 90 "web-app/tests/uploads/test.txt", 91 ); 92 await functions.uploadNamedObjectToBucket( 93 t, 94 bucketName2, 95 "home/UserX/test.txt", 96 "web-app/tests/uploads/test.txt", 97 ); 98 })( 99 "Error Notification is shown in Object Browser with Rewind request set", 100 async (t) => { 101 await t 102 .useRole(roles.conditions4) 103 .navigateTo(`http://localhost:9090/browser`) 104 .click(bucketBrowseButton2) 105 .click(Selector("label").withText("Show deleted objects")) 106 .wait(1500) 107 .click(Selector(".ReactVirtualized__Table__rowColumn").withText("home")) 108 .click( 109 Selector(".ReactVirtualized__Table__rowColumn").withText("UserX"), 110 ) 111 .expect(deniedError.exists) 112 .ok(); 113 }, 114 ) 115 .after(async (t) => { 116 await functions.cleanUpNamedBucketAndUploads(t, bucketName2); 117 });