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 2, 2023
1 parent af71264 commit b62852e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
22 changes: 22 additions & 0 deletions pages/main-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export class MainPage {
readonly page: Page;
constructor(page: Page) {
this.page = page;
this.setStorage = page.getByRole('link', { name: 'Storage' });
this.setUsers = page.getByRole('link', { name: 'Users' });
this.installButton = page.getByRole("button", { name: "Install", exact: true });
this.continueButton = page.getByRole("button", { name: "Continue" });
}
async set_storage() {
await this.setStorage.click();
}
async set_users() {
await this.setUsers.click();
}
async install() {
await this.installButton.click();
}
async continue() {
await this.continueButton.click();
}
}
16 changes: 9 additions & 7 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 @@ -14,11 +15,12 @@ test.describe('The main page', () => {

test('Full-disk encryption', async ({ page }) => {
await test.step("Select the product", async () => {
await page.getByLabel('SUSE ALP Server').check();
await page.getByLabel(process.env.PRODUCTNAME).check();
await page.getByRole("button", { name: "Select" }).click();
});

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

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

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

const usersPage = new UsersPage(page);
await usersPage.expectNoUserDefined();
Expand All @@ -53,11 +55,11 @@ test.describe('The main page', () => {
await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
// start the installation
await expect(page.getByText("SUSE ALP Server")).toBeVisible({ timeout: 2 * minute });
await expect(page.getByText(process.env.PRODUCTNAME)).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();
await mainPage.continue();
// wait for the package installation progress
await expect(page.getByText("Installing packages")).toBeVisible({ timeout: 8 * minute });
while (true) {
Expand Down
16 changes: 9 additions & 7 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 @@ -9,17 +10,18 @@ const minute = 60 * 1000;
test('Use logical volume management (LVM) as storage device for installation', async ({ page }) => {
await page.goto(mainPagePath());
await test.step("Select the product", async () => {
await page.getByLabel('SUSE ALP Micro').check();
await page.getByLabel(process.env.PRODUCTNAME).check();
await page.getByRole("button", { name: "Select" }).click();
});
await page.getByRole('link', { name: 'Storage' }).click();
const mainPage = new MainPage(page);
await mainPage.set_storage();

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

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

const usersPage = new UsersPage(page);
await usersPage.expectNoUserDefined();
Expand All @@ -39,11 +41,11 @@ 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 Micro")).toBeVisible({ timeout: 2 * minute });
await expect(page.getByText(process.env.PRODUCTNAME)).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();
await mainPage.continue();
// wait for the package installation progress
await expect(page.getByText("Installing packages")).toBeVisible({ timeout: 8 * minute });
while (true) {
Expand Down

0 comments on commit b62852e

Please sign in to comment.