Skip to content

Commit

Permalink
Add POM of main screen of agama
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon-suse committed Aug 17, 2023
1 parent f7ffb9d commit 72a7de1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
32 changes: 32 additions & 0 deletions pages/main-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { test, expect } from '@playwright/test';

export class MainPage {
readonly page: Page;
readonly accessStorageLink: Locator;
readonly accessUsersLink: Locator;
readonly installButton: Locator;

constructor(page: Page) {
this.page = page;
this.accessStorageLink = page.getByRole('link', { name: 'Storage' });
this.accessUsersLink = page.getByRole('link', { name: 'Users' });
this.installationPackageText = page.getByText("Installation will take");
this.installButton = page.getByRole("button", { name: "Install", exact: true });
}

async accessStorage() {
await this.accessStorageLink.click();
}

async accessUsers() {
await this.accessUsersLink.click();
}

async expectInstallationPackageStatistic() {
expect(this.installationPackageText.toBeVisible({ timeout: 2 * 60 * 1000 });
}

async install() {
await this.installButton.click();
}
}
12 changes: 6 additions & 6 deletions tests/full-disk-encryption.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { StoragePage } from './pages/storage-page';
import { MainPage } from '../pages/main-page';
import { EncryptionPasswordPopup, encryptionPasswordPopup } from './pages/encryption-password-popup';
import { mainPagePath } from "../lib/installer";
import { UsersPage } from '../pages/users-page';
Expand All @@ -13,8 +14,8 @@ test.describe('The main page', () => {
});

test('Full-disk encryption', async ({ page }) => {

await page.getByRole('link', { name: 'Storage' }).click();
const mainPage = new MainPage(page);
await mainPage.accessStorage();

const storagePage = new StoragePage(page);
await storagePage.useEncryption();
Expand All @@ -27,8 +28,8 @@ test.describe('The main page', () => {
await storagePage.validateEncryptionIsUsed();
await storagePage.back();

await expect(page.getByText("SUSE ALP Dolomite")).toBeVisible({ timeout: 2 * minute });
await page.getByRole('link', { name: 'Users' }).click();
await expect(page.getByText(process.env.PRODUCTNAME)).toBeVisible({ timeout: 2 * minute });
await mainPage.accessUsers();

const usersPage = new UsersPage(page);
await usersPage.expectNoUserDefined();
Expand All @@ -49,9 +50,8 @@ test.describe('The main page', () => {
await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
// start the installation
await expect(page.getByText("SUSE ALP Dolomite")).toBeVisible({ timeout: 2 * minute });
await expect(page.getByText("Installation will take")).toBeVisible({ timeout: 2 * minute });
await page.getByRole("button", { name: "Install", exact: true }).click();
await mainPage.install();
await expect(page.getByText("Confirm Installation")).toBeVisible({ timeout: 2 * minute });
await page.getByRole("button", { name: "Continue" }).click();
// wait for the package installation progress
Expand Down
13 changes: 7 additions & 6 deletions tests/lvm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { mainPagePath } from "../lib/installer";
import { MainPage } from '../pages/main-page';
import { StoragePage } from '../pages/storage-page';
import { UsersPage } from '../pages/users-page';
import { DefineUserPage } from '../pages/define-user-page';
Expand All @@ -8,14 +9,15 @@ import { ConfigureRootPasswordPage } from '../pages/configure-root-password-page
const minute = 60 * 1000;
test('Use logical volume management (LVM) as storage device for installation', async ({ page }) => {
await page.goto(mainPagePath());
await page.getByRole('link', { name: 'Storage' }).click();
const mainPage = new MainPage(page);
await mainPage.accessStorage();

const storagePage = new StoragePage(page);
await storagePage.useLVM();
await storagePage.back();

await expect(page.getByText("SUSE ALP Dolomite")).toBeVisible({ timeout: 2 * minute });
await page.getByRole('link', { name: 'Users' }).click();
await expect(page.getByText(process.env.PRODUCTNAME)).toBeVisible({ timeout: 2 * minute });
await mainPage.accessUsers();

const usersPage = new UsersPage(page);
await usersPage.expectNoUserDefined();
Expand All @@ -35,9 +37,8 @@ test('Use logical volume management (LVM) as storage device for installation', a
await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
// start the installation
await expect(page.getByText("SUSE ALP Dolomite")).toBeVisible({ timeout: 2 * minute });
await expect(page.getByText("Installation will take")).toBeVisible({ timeout: 2 * minute });
await page.getByRole("button", { name: "Install", exact: true }).click();
await mainPage.expectInstallationPackageStatistic();
await mainPage.install();
await expect(page.getByText("Confirm Installation")).toBeVisible({ timeout: 2 * minute });
await page.getByRole("button", { name: "Continue" }).click();
// wait for the package installation progress
Expand Down

0 comments on commit 72a7de1

Please sign in to comment.