github.com/minio/console@v1.4.1/web-app/tests/permissions-1/trace.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 { monitoringElement, traceElement } from "../utils/elements-menu";
    20  import { Selector } from "testcafe";
    21  
    22  export const traceStartButton = Selector('[data-test-id="trace-start-button"]');
    23  export const traceStopButton = Selector('[data-test-id="trace-stop-button"]');
    24  
    25  fixture("For user with Trace permissions")
    26    .page("http://localhost:9090")
    27    .beforeEach(async (t) => {
    28      await t.useRole(roles.trace);
    29    });
    30  
    31  test("Monitoring sidebar item exists", async (t) => {
    32    await t.expect(monitoringElement.exists).ok();
    33  });
    34  
    35  test("Trace link exists in Monitoring menu", async (t) => {
    36    await t
    37      .expect(monitoringElement.exists)
    38      .ok()
    39      .click(monitoringElement)
    40      .expect(traceElement.exists)
    41      .ok();
    42  });
    43  
    44  test("Trace page can be opened", async (t) => {
    45    await t.navigateTo("http://localhost:9090/tools/trace");
    46  });
    47  
    48  test("Start button can be clicked", async (t) => {
    49    await t
    50      .navigateTo("http://localhost:9090/tools/trace")
    51      .click(traceStartButton);
    52  });
    53  
    54  test("Stop button appears after Start button has been clicked", async (t) => {
    55    const stopButtonExists = traceStopButton.exists;
    56    await t
    57      .navigateTo("http://localhost:9090/tools/trace")
    58      .click(traceStartButton)
    59      .expect(stopButtonExists)
    60      .ok();
    61  });
    62  
    63  test("Stop button can be clicked after Start button has been clicked", async (t) => {
    64    await t
    65      .navigateTo("http://localhost:9090/tools/trace")
    66      .click(traceStartButton)
    67      .click(traceStopButton);
    68  });