github.com/minio/console@v1.4.1/web-app/e2e/auth.setup.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  import { test as setup } from "@playwright/test";
    17  import { adminAccessKey, adminSecretKey, minioadminFile } from "./consts";
    18  import { BUCKET_LIST_PAGE } from "./consts";
    19  
    20  setup("authenticate as admin", async ({ page }) => {
    21    // Perform authentication steps. Replace these actions with your own.
    22    await page.goto(BUCKET_LIST_PAGE);
    23    await page.getByPlaceholder("Username").click();
    24    await page.getByPlaceholder("Username").fill(adminAccessKey);
    25    await page.getByPlaceholder("Password").click();
    26    await page.getByPlaceholder("Password").fill(adminSecretKey);
    27    await page.getByRole("button", { name: "Login" }).click();
    28  
    29    // we need to give the browser time to store the cookies
    30    await page.waitForTimeout(1000);
    31    // End of authentication steps.
    32  
    33    await page.context().storageState({ path: minioadminFile });
    34  });