github.com/minio/console@v1.4.1/web-app/tests/permissions-4/watch.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 { bucketDropdownOptionFor } from "../utils/elements";
    20  import * as functions from "../utils/functions";
    21  import { monitoringElement, watchElement } from "../utils/elements-menu";
    22  
    23  fixture("For user with Watch permissions")
    24    .page("http://localhost:9090")
    25    .beforeEach(async (t) => {
    26      await t.useRole(roles.watch);
    27    });
    28  
    29  test("Monitoring sidebar item exists", async (t) => {
    30    await t.expect(monitoringElement.exists).ok();
    31  });
    32  
    33  test("Watch link exists in Support page", async (t) => {
    34    await t
    35      .expect(monitoringElement.exists)
    36      .ok()
    37      .click(monitoringElement)
    38      .expect(watchElement.exists)
    39      .ok();
    40  });
    41  
    42  test("Watch page can be opened", async (t) => {
    43    await t.navigateTo("http://localhost:9090/tools/watch");
    44  });
    45  
    46  test
    47    .before(async (t) => {
    48      // Create a bucket
    49      await functions.setUpBucket(t, "watch");
    50    })("Start button can be clicked", async (t) => {
    51      await t
    52        // We need to log back in after we use the admin account to create bucket,
    53        // using the specific role we use in this module
    54        .useRole(roles.watch)
    55        .navigateTo("http://localhost:9090/tools/watch")
    56        .click(elements.bucketNameInput)
    57        .click(bucketDropdownOptionFor("watch"))
    58        .click(elements.startButton);
    59    })
    60    .after(async (t) => {
    61      // Cleanup created bucket
    62      await functions.cleanUpBucket(t, "watch");
    63    });