github.com/minio/console@v1.4.1/web-app/tests/permissions-6/sameBucketPath.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 resources policy").page("http://localhost:9090/");
    23  
    24  const bucketName = "bucket-with-dash";
    25  const testBucketBrowseButton = namedTestBucketBrowseButtonFor(bucketName);
    26  export const file = Selector(".ReactVirtualized__Table__rowColumn").withText(
    27    "test.txt",
    28  );
    29  
    30  test
    31    .before(async (t) => {
    32      await functions.setUpNamedBucket(t, bucketName);
    33      await functions.setVersionedBucket(t, bucketName);
    34      await functions.uploadNamedObjectToBucket(
    35        t,
    36        bucketName,
    37        `firstlevel/secondlevel/${bucketName}/otherlevel/test.txt`,
    38        "web-app/tests/uploads/test.txt",
    39      );
    40    })(
    41      "User can navigate through folders with the same bucket name",
    42      async (t) => {
    43        await t
    44          .useRole(roles.admin)
    45          .navigateTo(`http://localhost:9090/browser`)
    46          .click(testBucketBrowseButton)
    47          .wait(1500)
    48          .click(Selector("label").withText("Show deleted objects"))
    49          .click(
    50            Selector(".ReactVirtualized__Table__rowColumn").withText(
    51              "firstlevel",
    52            ),
    53          )
    54          .wait(1500)
    55          .click(
    56            Selector(".ReactVirtualized__Table__rowColumn").withText(
    57              "secondlevel",
    58            ),
    59          )
    60          .wait(1500)
    61          .click(
    62            Selector(".ReactVirtualized__Table__rowColumn").withText(bucketName),
    63          )
    64          .wait(1500)
    65          .click(
    66            Selector(".ReactVirtualized__Table__rowColumn").withText(
    67              "otherlevel",
    68            ),
    69          )
    70          .wait(1500)
    71          .expect(file.exists)
    72          .ok();
    73      },
    74    )
    75    .after(async (t) => {
    76      await functions.cleanUpNamedBucketAndUploads(t, bucketName);
    77    });