github.com/minio/console@v1.4.1/web-app/tests/permissions-3/bucketDeleteAllVersions.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 roles from "../utils/roles";
    18  import * as elements from "../utils/elements";
    19  import * as functions from "../utils/functions";
    20  import { testBucketBrowseButtonFor } from "../utils/functions";
    21  import { Selector } from "testcafe";
    22  
    23  fixture("For user with Bucket Read & Write permissions").page(
    24    "http://localhost:9090",
    25  );
    26  
    27  test
    28    .before(async (t) => {
    29      // Create a bucket
    30      await functions.setUpBucket(t, "bucketdelete3");
    31      await functions.setVersioned(t, "bucketdelete3");
    32      await t
    33        .useRole(roles.bucketReadWrite)
    34        .navigateTo("http://localhost:9090/browser")
    35        .click(testBucketBrowseButtonFor("bucketdelete3"))
    36        // Upload object to bucket
    37        .setFilesToUpload(elements.uploadInput, "../uploads/test.txt")
    38        .wait(1000)
    39        .navigateTo("http://localhost:9090/browser")
    40        .click(testBucketBrowseButtonFor("bucketdelete3"))
    41        // Upload object to bucket
    42        .setFilesToUpload(elements.uploadInput, "../uploads/test.txt")
    43        .wait(1000);
    44    })("All versions of an object can be deleted from a bucket", async (t) => {
    45      const versionRows = Selector(
    46        "div.ReactVirtualized__Grid.ReactVirtualized__Table__Grid > div > div:nth-child(1)",
    47      );
    48      await t
    49        .useRole(roles.bucketReadWrite)
    50        .navigateTo("http://localhost:9090/browser")
    51        .click(testBucketBrowseButtonFor("bucketdelete3"))
    52        .click(
    53          "div.ReactVirtualized__Grid.ReactVirtualized__Table__Grid > div > div:nth-child(1)",
    54        )
    55        .click(elements.deleteButton)
    56        .click(elements.deleteAllVersions)
    57        .click(Selector("button:enabled").withExactText("Delete").nth(1))
    58        .expect(versionRows.exists)
    59        .notOk();
    60    })
    61    .after(async (t) => {
    62      // Cleanup created bucket and corresponding uploads
    63      await functions.cleanUpBucketAndUploads(t, "bucketdelete3");
    64    });