|
| 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 = Selector(".message-text").withText("Access Denied."); |
| 34 | + |
| 35 | +test |
| 36 | + .before(async (t) => { |
| 37 | + await functions.setUpNamedBucket(t, bucketName); |
| 38 | + await functions.uploadNamedObjectToBucket( |
| 39 | + t, |
| 40 | + bucketName, |
| 41 | + "test.txt", |
| 42 | + "portal-ui/tests/uploads/test.txt", |
| 43 | + ); |
| 44 | + await functions.uploadNamedObjectToBucket( |
| 45 | + t, |
| 46 | + bucketName, |
| 47 | + "home/UserY/test.txt", |
| 48 | + "portal-ui/tests/uploads/test.txt", |
| 49 | + ); |
| 50 | + await functions.uploadNamedObjectToBucket( |
| 51 | + t, |
| 52 | + bucketName, |
| 53 | + "home/UserX/test.txt", |
| 54 | + "portal-ui/tests/uploads/test.txt", |
| 55 | + ); |
| 56 | + })( |
| 57 | + "Error Notification is shown in Object Browser when no privileges are set", |
| 58 | + async (t) => { |
| 59 | + await t |
| 60 | + .useRole(roles.conditions3) |
| 61 | + .navigateTo(`http://localhost:9090/browser`) |
| 62 | + .click(bucketBrowseButton) |
| 63 | + .click(Selector(".ReactVirtualized__Table__rowColumn").withText("home")) |
| 64 | + .click( |
| 65 | + Selector(".ReactVirtualized__Table__rowColumn").withText("UserX"), |
| 66 | + ) |
| 67 | + .expect(deniedError.exists) |
| 68 | + .ok(); |
| 69 | + }, |
| 70 | + ) |
| 71 | + .after(async (t) => { |
| 72 | + await functions.cleanUpNamedBucketAndUploads(t, bucketName); |
| 73 | + }); |
| 74 | + |
| 75 | +test |
| 76 | + .before(async (t) => { |
| 77 | + await functions.setUpNamedBucket(t, bucketName2); |
| 78 | + await functions.setVersionedBucket(t, bucketName2); |
| 79 | + await functions.uploadNamedObjectToBucket( |
| 80 | + t, |
| 81 | + bucketName2, |
| 82 | + "test.txt", |
| 83 | + "portal-ui/tests/uploads/test.txt", |
| 84 | + ); |
| 85 | + await functions.uploadNamedObjectToBucket( |
| 86 | + t, |
| 87 | + bucketName2, |
| 88 | + "home/UserY/test.txt", |
| 89 | + "portal-ui/tests/uploads/test.txt", |
| 90 | + ); |
| 91 | + await functions.uploadNamedObjectToBucket( |
| 92 | + t, |
| 93 | + bucketName2, |
| 94 | + "home/UserX/test.txt", |
| 95 | + "portal-ui/tests/uploads/test.txt", |
| 96 | + ); |
| 97 | + })( |
| 98 | + "Error Notification is shown in Object Browser with Rewind request set", |
| 99 | + async (t) => { |
| 100 | + await t |
| 101 | + .useRole(roles.conditions4) |
| 102 | + .navigateTo(`http://localhost:9090/browser`) |
| 103 | + .click(bucketBrowseButton2) |
| 104 | + .click(Selector("label").withText("Show deleted objects")) |
| 105 | + .wait(1500) |
| 106 | + .click(Selector(".ReactVirtualized__Table__rowColumn").withText("home")) |
| 107 | + .click( |
| 108 | + Selector(".ReactVirtualized__Table__rowColumn").withText("UserX"), |
| 109 | + ) |
| 110 | + .expect(deniedError.exists) |
| 111 | + .ok(); |
| 112 | + }, |
| 113 | + ) |
| 114 | + .after(async (t) => { |
| 115 | + await functions.cleanUpNamedBucketAndUploads(t, bucketName2); |
| 116 | + }); |
0 commit comments