|
| 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 resources policy").page("http://localhost:9090/"); |
| 23 | + |
| 24 | +const bucket1 = "abucket3"; |
| 25 | +const test1BucketBrowseButton = namedTestBucketBrowseButtonFor(bucket1); |
| 26 | +export const remainingFile = Selector( |
| 27 | + ".ReactVirtualized__Table__rowColumn", |
| 28 | +).withText("abcd"); |
| 29 | + |
| 30 | +test |
| 31 | + .before(async (t) => { |
| 32 | + await functions.setUpNamedBucket(t, bucket1); |
| 33 | + await functions.setVersionedBucket(t, bucket1); |
| 34 | + await functions.uploadNamedObjectToBucket( |
| 35 | + t, |
| 36 | + bucket1, |
| 37 | + "abc", |
| 38 | + "portal-ui/tests/uploads/noextension", |
| 39 | + ); |
| 40 | + await functions.uploadNamedObjectToBucket( |
| 41 | + t, |
| 42 | + bucket1, |
| 43 | + "abcd", |
| 44 | + "portal-ui/tests/uploads/noextension", |
| 45 | + ); |
| 46 | + })( |
| 47 | + "Files with similar prefixes don't get deleted with all versions", |
| 48 | + async (t) => { |
| 49 | + await t |
| 50 | + .useRole(roles.admin) |
| 51 | + .navigateTo(`http://localhost:9090/browser`) |
| 52 | + .click(test1BucketBrowseButton) |
| 53 | + .click(Selector(".ReactVirtualized__Table__rowColumn").withText("abc")) |
| 54 | + .click(Selector("#delete-element-click")) |
| 55 | + .click(Selector("#delete-versions-switch")) |
| 56 | + .click(Selector("#confirm-ok")) |
| 57 | + .expect(remainingFile.exists) |
| 58 | + .ok(); |
| 59 | + }, |
| 60 | + ) |
| 61 | + .after(async (t) => { |
| 62 | + await functions.cleanUpNamedBucketAndUploads(t, bucket1); |
| 63 | + }); |
0 commit comments