github.com/minio/console@v1.4.1/web-app/e2e/pom/BucketsListPage.tsx (about)

     1  import { Page, Locator } from "@playwright/test";
     2  import { BUCKET_LIST_PAGE } from "../consts";
     3  
     4  export class BucketsListPage {
     5    page: Page;
     6  
     7    /* Locators */
     8  
     9    createBucketBtn: Locator | undefined;
    10    refreshBucketsBtn: Locator | undefined;
    11    setReplicationBtn: Locator | undefined;
    12  
    13    bucketListItemPrefix = "#manageBucket-";
    14  
    15    constructor(page: Page) {
    16      this.page = page;
    17      this.initLocators();
    18    }
    19    getLocator(selector: string): Locator {
    20      const page = this.page;
    21      const locator: Locator = page.locator(`${selector}`);
    22      return locator;
    23    }
    24  
    25    initLocators() {
    26      this.createBucketBtn = this.getLocator("#create-bucket");
    27      this.refreshBucketsBtn = this.getLocator("#refresh-buckets");
    28      this.setReplicationBtn = this.getLocator("#set-replication");
    29    }
    30  
    31    locateBucket(bucketName: string): Locator {
    32      const bucketRow = this.getLocator(
    33        `${this.bucketListItemPrefix}${bucketName}`,
    34      );
    35      return bucketRow;
    36    }
    37  
    38    async clickOnBucketRow(bucketName: string) {
    39      const bucketRow = this.locateBucket(bucketName);
    40      await this.page.waitForTimeout(2500);
    41      await this.refreshBucketsBtn.click();
    42      await bucketRow.click();
    43    }
    44    async goToCreateBucket() {
    45      await this.createBucketBtn?.click();
    46    }
    47  
    48    async isBucketExist(bucketName: string) {
    49      const existBukCount = await this.locateBucket(bucketName).count();
    50  
    51      return existBukCount;
    52    }
    53  
    54    async loadPage() {
    55      const page = this.page;
    56      await page.goto(BUCKET_LIST_PAGE);
    57    }
    58  }