github.com/minio/console@v1.4.1/web-app/tests/permissions-2/site-replication.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 { IAM_PAGES } from "../../src/common/SecureComponent/permissions";
    19  import { Selector } from "testcafe";
    20  import { getMenuElement } from "../utils/elements-menu";
    21  
    22  let testDomainUrl = "http://localhost:9090";
    23  const screenUrl = `${testDomainUrl}${IAM_PAGES.SITE_REPLICATION}`;
    24  const siteReplicationEl = getMenuElement("sitereplication");
    25  export const addSitesBtn = Selector("button").withText("Add Sites");
    26  
    27  /* Begin Local Testing config block */
    28  // For local Testing Create users and assign policies then update here.
    29  // Command to invoke the test locally: testcafe chrome tests/permissions/site-replication.ts
    30  /* End Local Testing config block */
    31  
    32  fixture("Site Replication Status for user with Admin permissions")
    33    .page(testDomainUrl)
    34    .beforeEach(async (t) => {
    35      await t.useRole(roles.settings);
    36    });
    37  
    38  test("Site replication sidebar item exists", async (t) => {
    39    await t.expect(siteReplicationEl.exists).ok();
    40  });
    41  
    42  test("Add Sites button exists", async (t) => {
    43    const addSitesBtnExists = addSitesBtn.exists;
    44    await t.navigateTo(screenUrl).expect(addSitesBtnExists).ok();
    45  });
    46  
    47  test("Add Sites button is clickable", async (t) => {
    48    await t.navigateTo(screenUrl).click(addSitesBtn);
    49  });