Deprecated Lifecycle and Tiering UI (#3470)

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
Alex
2024-11-11 17:36:14 -06:00
committed by GitHub
parent 4e5dcf0fc3
commit 2ca484c691
107 changed files with 18 additions and 16906 deletions

View File

@@ -1,112 +0,0 @@
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import { expect, Page } from "@playwright/test";
import { test as baseTest } from "./fixtures/baseFixture";
import { minioadminFile } from "./consts";
import { BucketsListPage } from "./pom/BucketsListPage";
import { CreateBucketPage } from "./pom/CreateBucketPage";
import { BucketSummaryPage } from "./pom/BucketSummaryPage";
type LifeCycleObjectVersionFx = {
activeBucketName: string;
bucketsListPage: BucketsListPage;
createBucketPage: CreateBucketPage;
bucketSummaryPage: any;
};
const test = baseTest.extend<LifeCycleObjectVersionFx>({
activeBucketName: "",
bucketListPage: async ({ page }: { page: Page }, use: any) => {
let bucketListPage = new BucketsListPage(page);
await bucketListPage.loadPage();
await bucketListPage.goToCreateBucket();
await use(bucketListPage);
},
createBucketPage: async ({ page }: { page: Page }, use: any) => {
let createBucketPage = new CreateBucketPage(page);
await use(createBucketPage);
},
//bucket name is dynamic in parallel test runs.
bucketSummaryPage: async ({ page }: { page: Page }, use: any) => {
await use((bucketName: string) => {
return new BucketSummaryPage(page, bucketName);
});
},
});
test.use({ storageState: minioadminFile });
const versionedBucketName = "versioned-bucket";
const nonVersionedBucketName = "non-versioned-bucket";
test.describe("Add Lifecycle Rule Modal in bucket settings tests for object version ", () => {
test("Test if Object Version selector is present in Lifecycle rule modal", async ({
page,
bucketListPage,
createBucketPage,
bucketSummaryPage,
}) => {
await test.step("Create Versioned Bucket", async () => {
await createBucketPage.createVersionedBucket(versionedBucketName);
await bucketListPage.clickOnBucketRow(versionedBucketName);
bucketSummaryPage = bucketSummaryPage(versionedBucketName);
await bucketSummaryPage.clickOnTab("lifecycle"); //Tab Text is used.
});
await test.step("Check if object version option is available on a versioned bucket", async () => {
const objectVersionsEl = await bucketSummaryPage.getObjectVersionOption();
await expect(await objectVersionsEl).toHaveText("Current Version");
await expect(await objectVersionsEl).toBeTruthy();
await bucketSummaryPage.getLocator("#close").click();
});
await test.step("Clean up bucket and verify the clean up", async () => {
await bucketSummaryPage.confirmDeleteBucket();
const existBukCount =
await bucketListPage.isBucketExist(versionedBucketName);
await expect(existBukCount).toEqual(0);
});
});
test("Test if Object Version selector is NOT present in Lifecycle rule modal", async ({
page,
createBucketPage,
bucketListPage,
bucketSummaryPage,
}) => {
await test.step("Create NON Versioned Bucket and navigate to lifecycle settings in summary page", async () => {
await createBucketPage.createBucket(nonVersionedBucketName);
await bucketListPage.clickOnBucketRow(nonVersionedBucketName);
bucketSummaryPage = bucketSummaryPage(versionedBucketName);
await bucketSummaryPage.clickOnTab("lifecycle");
});
await test.step("Check if object version option is NOT available on a non versioned bucket", async () => {
const objectVersionsEl = await bucketSummaryPage.getObjectVersionOption();
await expect(await objectVersionsEl.count()).toEqual(0);
await bucketSummaryPage.getLocator("#close").click();
});
await test.step("Clean up bucket and verify the clean up", async () => {
await bucketSummaryPage.confirmDeleteBucket();
const existBukCount = await bucketListPage.isBucketExist(
nonVersionedBucketName,
);
await expect(existBukCount).toEqual(0);
});
});
});

View File

@@ -1,45 +0,0 @@
import { Page, Locator } from "@playwright/test";
export class BucketSummaryPage {
page: Page;
bucketName: string;
/* Locators */
deleteBucketBtn: Locator | undefined;
constructor(page: Page, bucketName: string) {
this.page = page;
this.bucketName = bucketName;
this.initLocators();
}
getLocator(selector: string): Locator {
const page = this.page;
const locator: Locator = page.locator(`${selector}`);
return locator;
}
initLocators() {
this.deleteBucketBtn = this.getLocator("#delete-bucket-button");
}
async loadPage() {
await this.clickOnTab(`Summary`);
}
async clickOnTab(tabID: string) {
await this.getLocator(`#${tabID}`).click();
// await page.goto(`${BUCKET_LIST_PAGE}/${this.bucketName}/admin/${tabName}`);
}
async confirmDeleteBucket() {
await this.getLocator("#delete-bucket-button").click();
await this.getLocator("#confirm-ok").click();
}
async getObjectVersionOption() {
await this.page.getByRole("button", { name: "Add Lifecycle Rule" }).click();
return this.getLocator("#object_version-select > div").nth(0);
}
}

View File

@@ -1,58 +0,0 @@
import { Page, Locator } from "@playwright/test";
import { BUCKET_LIST_PAGE } from "../consts";
export class BucketsListPage {
page: Page;
/* Locators */
createBucketBtn: Locator | undefined;
refreshBucketsBtn: Locator | undefined;
setReplicationBtn: Locator | undefined;
bucketListItemPrefix = "#manageBucket-";
constructor(page: Page) {
this.page = page;
this.initLocators();
}
getLocator(selector: string): Locator {
const page = this.page;
const locator: Locator = page.locator(`${selector}`);
return locator;
}
initLocators() {
this.createBucketBtn = this.getLocator("#create-bucket");
this.refreshBucketsBtn = this.getLocator("#refresh-buckets");
this.setReplicationBtn = this.getLocator("#set-replication");
}
locateBucket(bucketName: string): Locator {
const bucketRow = this.getLocator(
`${this.bucketListItemPrefix}${bucketName}`,
);
return bucketRow;
}
async clickOnBucketRow(bucketName: string) {
const bucketRow = this.locateBucket(bucketName);
await this.page.waitForTimeout(2500);
await this.refreshBucketsBtn.click();
await bucketRow.click();
}
async goToCreateBucket() {
await this.createBucketBtn?.click();
}
async isBucketExist(bucketName: string) {
const existBukCount = await this.locateBucket(bucketName).count();
return existBukCount;
}
async loadPage() {
const page = this.page;
await page.goto(BUCKET_LIST_PAGE);
}
}

View File

@@ -1,114 +0,0 @@
import { Page, Locator } from "@playwright/test";
import { BUCKET_LIST_PAGE } from "../consts";
export class CreateBucketPage {
page: Page;
/* Locators */
submitBtn: Locator | undefined;
clearBtn: Locator | undefined;
bucketNameInput: Locator | undefined;
versioningToggle: Locator | undefined;
lockingToggle: Locator | undefined;
quotaToggle: Locator | undefined;
bucketNamingRules: Locator | undefined;
bucketRetentionToggle: Locator | undefined;
quotaSizeInput: Locator | undefined;
retentionModeRadio: Locator | undefined;
retentionValidity: Locator | undefined;
constructor(page: Page) {
this.page = page;
this.initLocators();
}
getLocator(selector: string): Locator {
const page = this.page;
const locator: Locator = page.locator(`${selector}`);
return locator;
}
initLocators() {
this.submitBtn = this.getLocator("#create-bucket");
this.clearBtn = this.getLocator("#clear");
this.versioningToggle = this.getLocator("#versioned-switch");
this.lockingToggle = this.getLocator("#locking-switch");
this.quotaToggle = this.getLocator("#bucket_quota-switch");
this.bucketNamingRules = this.getLocator("#toggle-naming-rules");
this.bucketNameInput = this.getLocator("#bucket-name");
}
//Lazy/Conditional selectors Note: These respective methods must be called before using them.
onVersioningToggleOn() {
this.bucketRetentionToggle = this.getLocator("#bucket_retention");
}
onBucketQuotaToggleOn() {
this.quotaSizeInput = this.getLocator("#quota_size");
}
onRetentionToggleOn() {
this.retentionModeRadio = this.getLocator("#retention_mode");
this.retentionValidity = this.getLocator("#retention_validity");
}
loadPage() {
const page = this.page;
page.goto(BUCKET_LIST_PAGE);
}
async fillBucketName(bucketName: string) {
await this.bucketNameInput?.click();
await this.bucketNameInput?.fill(bucketName);
}
async toggleBucketNamingRules() {
await this.bucketNamingRules?.click();
}
async toggleVersioning() {
await this.versioningToggle?.check();
this.onVersioningToggleOn();
//expect to be on
}
async toggleObjectLocking() {
await this.lockingToggle?.click();
this.onVersioningToggleOn();
this.onRetentionToggleOn();
}
async toggleBucketQuota() {
await this.quotaToggle?.click();
this.onBucketQuotaToggleOn();
}
async toggleRetention() {
await this.bucketRetentionToggle?.click();
}
async submitForm() {
await this.submitBtn?.click();
}
//Convenience Methods for easy testing
//create a bucket without any features like versioning, locking, quota etc.
async createBucket(bucketName: string) {
await this.fillBucketName(bucketName);
await this.submitForm();
}
//create a bucket with versioning feature
async createVersionedBucket(bucketName: string) {
await this.fillBucketName(bucketName);
await this.toggleVersioning();
await this.submitForm();
}
//create a bucket with locking feature
async goToCreateBucket() {
await this.submitBtn?.click();
}
}