Skip to content

Commit

Permalink
feat: Added 2 storage e2e test to increase coverage.
Browse files Browse the repository at this point in the history
- Storage pool with driver zfs
- Storage volume of type block

Signed-off-by: Nkeiruka <[email protected]>
  • Loading branch information
Kxiru committed Jun 6, 2024
1 parent 660cea8 commit 8216054
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/helpers/storagePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ export const randomPoolName = (): string => {
return `playwright-pool-${randomNameSuffix()}`;
};

export const createPool = async (page: Page, pool: string) => {
export const createPool = async (page: Page, pool: string, driver = "dir") => {
await page.goto("/ui/");
await page.getByRole("button", { name: "Storage" }).click();
await page.getByRole("link", { name: "Pools" }).click();
await page.getByRole("button", { name: "Create pool" }).click();
await page.getByPlaceholder("Enter name").fill(pool);
await page.getByLabel("Driver").selectOption("dir");
await page.getByLabel("Driver").selectOption(driver);
await page.getByRole("button", { name: "Create", exact: true }).click();
await page.waitForSelector(`text=Storage pool ${pool} created.`);
};
Expand Down
9 changes: 8 additions & 1 deletion tests/helpers/storageVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ export const randomVolumeName = (): string => {
return `playwright-volume-${randomNameSuffix()}`;
};

export const createVolume = async (page: Page, volume: string) => {
export const createVolume = async (
page: Page,
volume: string,
volumeType = "filesystem",
) => {
await page.goto("/ui/");
await page.getByRole("button", { name: "Storage" }).click();
await page.getByRole("link", { name: "Volumes" }).click();
await page.getByRole("button", { name: "Create volume" }).click();
await page.getByPlaceholder("Enter name").fill(volume);
await page.getByPlaceholder("Enter value").fill("1");
await page
.getByPlaceholder("Enter content type")
.selectOption({ label: volumeType });
await page.getByRole("button", { name: "Create", exact: true }).click();
await page.waitForSelector(`text=Storage volume ${volume} created.`);
await page.getByRole("button", { name: "Close notification" }).click();
Expand Down
25 changes: 25 additions & 0 deletions tests/storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,28 @@ test("navigate to custom volume via pool used by list", async ({ page }) => {
await page.getByRole("link", { name: volume }).click();
await expect(page).toHaveURL(/volumes\/custom\//);
});

test("storage pool with driver zfs", async ({ page }) => {
const pool = randomPoolName();
await createPool(page, pool, "ZFS");

await expect(page.getByRole("link", { name: pool })).toBeVisible();

await deletePool(page, pool);

await expect(page.getByRole("link", { name: pool })).toBeHidden();
});

test("storage volume of type block", async ({ page }) => {
const volume = randomVolumeName();
await createVolume(page, volume, "block");

await expect(
page
.getByRole("row", { name: "Name" })
.filter({ hasText: volume })
.getByRole("cell", { name: "Content Type" }),
).toHaveText("Block");

await deleteVolume(page, volume);
});

0 comments on commit 8216054

Please sign in to comment.