Skip to content

Commit

Permalink
Create POMs for installation process
Browse files Browse the repository at this point in the history
  • Loading branch information
rakoenig committed Oct 17, 2023
1 parent 6920f8e commit d4dfab4
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 150 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
30 changes: 30 additions & 0 deletions actors/install-actor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { expect, type Page } from '@playwright/test';
import { MainPage } from '../pages/main-page';
import { ConfirmInstallationPage } from '../pages/confirm-installation-page';
import { InstallingPage } from '../pages/installing-page';
import { InstallationFinishedPage } from '../pages/installation-finished-page';

export class InstallActor {
readonly page: Page;
readonly mainPage: MainPage;
readonly confirmInstallationPage: ConfirmInstallationPage;
readonly installationProgressPage: InstallingPage;
readonly installationFinishedPage: InstallationFinishedPage;

constructor(page: Page,
mainPage: MainPage) {
this.page = page;
this.mainPage = mainPage;
}

async handleInstallation() {
await expect(this.page.getByText("Installation will take")).toBeVisible({ timeout: 2 * 60 * 1000 });
await this.mainPage.install();
const confirmInstallationPage = new ConfirmInstallationPage(this.page);
const installationProgressPage = new InstallingPage(this.page);
const installationFinishedPage = new InstallationFinishedPage(this.page);
await confirmInstallationPage.confirm();
await installationProgressPage.expectProgress();
await installationFinishedPage.expectCongratulations();
}
}
22 changes: 22 additions & 0 deletions pages/confirm-installation-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect, type Locator, type Page } from '@playwright/test';

export class ConfirmInstallationPage {
readonly page: Page;
readonly confirmButton: Locator;
readonly cancelButton: Locator;

constructor(page: Page) {
this.page = page;
this.confirmButton = page.getByRole('button', { name: 'Continue' });
this.cancelButton = page.getByRole('button', { name: 'Cancel' });
}

async confirm() {
await this.confirmButton.click();
}

async cancel() {
await this.cancelButton.click();
}

}
25 changes: 25 additions & 0 deletions pages/installation-finished-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { expect, type Locator, type Page } from '@playwright/test';

export class InstallationFinishedPage {
readonly page: Page;
readonly heading: Locator;

constructor(page: Page) {
this.page = page;
this.heading = page.getByRole("heading", { name: 'Congratulations!' });
}

async expectCongratulations() {
while (true) {
try {
await this.heading.waitFor({ timeout: 30 * 1000 });
break;
}
catch (error) {
// do not ignore other errors
if (error.constructor.name !== 'TimeoutError') throw (error);
}
}
}

}
16 changes: 16 additions & 0 deletions pages/installing-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, type Locator, type Page } from '@playwright/test';

export class InstallingPage {
readonly page: Page;
readonly progressText: Locator;

constructor(page: Page) {
this.page = page;
this.progressText = page.getByText('Installing packages');
}

async expectProgress() {
await expect(this.progressText).toBeVisible({ timeout: 8 * 60 * 1000 });
}

}
33 changes: 0 additions & 33 deletions storageState.json

This file was deleted.

28 changes: 7 additions & 21 deletions tests/add-home-file-system.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { UserActor } from "../actors/user-actor";
import { MainPage } from '../pages/main-page';
import { ProductSelectionOpensusePage } from '../pages/product-selection-opensuse-page';
import { StoragePage } from '../pages/storage-page';
import { InstallActor } from '../actors/install-actor';

const minute = 60 * 1000;
test.describe('The main page', () => {
Expand All @@ -20,39 +21,24 @@ test.describe('The main page', () => {
const mainPage = new MainPage(page);
await test.step("Start to add home file system", async () => {
await mainPage.accessStorage();

const storagePage = new StoragePage(page);
await storagePage.accessAddFileSystem();
const addFileSystemPage = new AddFileSystemPage(page);
await addFileSystemPage.accept();
await storagePage.back();

});

await test.step("set mandatory user and root password", async () => {
await mainPage.accessUsers();
await (new UserActor(page)).handleUser();
});

await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
// start the installation
await expect(page.getByText("Installation will take")).toBeVisible({ timeout: 2 * minute });
await page.getByRole("button", { name: "Install", exact: true }).click();
await expect(page.getByText("Confirm Installation")).toBeVisible({ timeout: 2 * minute });
await page.getByRole("button", { name: "Continue" }).click();
// wait for the package installation progress
await expect(page.getByText("Installing packages")).toBeVisible({ timeout: 8 * minute });
while (true) {
try {
await page.getByRole("heading", { name: "Congratulations!" }).waitFor({ timeout: minute / 2 });
break;
}
catch (error) {
// do not ignore other errors
if (error.constructor.name !== "TimeoutError") throw (error);
}
}
});
const installActor = new InstallActor(page, mainPage);
await installActor.handleInstallation();
})
});
});
24 changes: 5 additions & 19 deletions tests/default_installation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IndexActor } from "../actors/index-actor";
import { UserActor } from "../actors/user-actor";
import { MainPage } from '../pages/main-page';
import { ProductSelectionOpensusePage } from '../pages/product-selection-opensuse-page';
import { InstallActor } from '../actors/install-actor';

const minute = 60 * 1000;
test.describe('The main page', () => {
Expand All @@ -14,7 +15,7 @@ test.describe('The main page', () => {
indexActor.handleProductSelectionIfAny();
});

test('Default installation test', async ({ page }) => {
test('Default installation test', async ({ page }) => {
const mainPage = new MainPage(page);
await test.step("set mandatory user and root password", async () => {
await mainPage.accessUsers();
Expand All @@ -24,23 +25,8 @@ test.describe('The main page', () => {
//Installation
await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
// start the installation
await expect(page.getByText("Installation will take")).toBeVisible({ timeout: 2 * minute });
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
await expect(page.getByText("Installing packages")).toBeVisible({ timeout: 8 * minute });
while (true) {
try {
await page.getByRole("heading", { name: "Congratulations!" }).waitFor({ timeout: minute / 2 });
break;
}
catch (error) {
// do not ignore other errors
if (error.constructor.name !== "TimeoutError") throw (error);
}
}
});
const installActor = new InstallActor(page, mainPage);
await installActor.handleInstallation();
})
});
});
24 changes: 5 additions & 19 deletions tests/encrypted_lvm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { StoragePage } from '../pages/storage-page';
import { MainPage } from '../pages/main-page';
import { ProductSelectionOpensusePage } from '../pages/product-selection-opensuse-page';
import { EncryptionPasswordPopup } from '../pages/encryption-password-popup';
import { InstallActor } from '../actors/install-actor';

const minute = 60 * 1000;
test.describe('The main page', () => {
Expand All @@ -16,7 +17,7 @@ test.describe('The main page', () => {
indexActor.handleProductSelectionIfAny();
});

test('Installation test with encrypted lvm file system', async ({ page }) => {
test('Installation test with encrypted lvm file system', async ({ page }) => {
const mainPage = new MainPage(page);
await test.step("set encrypted lvm file system", async () => {
await mainPage.accessStorage();
Expand All @@ -43,23 +44,8 @@ test.describe('The main page', () => {
//Installation
await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
// start the installation
await expect(page.getByText("Installation will take")).toBeVisible({ timeout: 2 * minute });
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
await expect(page.getByText("Installing packages")).toBeVisible({ timeout: 8 * minute });
while (true) {
try {
await page.getByRole("heading", { name: "Congratulations!" }).waitFor({ timeout: minute / 2 });
break;
}
catch (error) {
// do not ignore other errors
if (error.constructor.name !== "TimeoutError") throw (error);
}
}
});
const installActor = new InstallActor(page, mainPage);
await installActor.handleInstallation();
})
});
});
22 changes: 4 additions & 18 deletions tests/full-disk-encryption.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { StoragePage } from '../pages/storage-page';
import { MainPage } from '../pages/main-page';
import { ProductSelectionOpensusePage } from '../pages/product-selection-opensuse-page';
import { EncryptionPasswordPopup } from '../pages/encryption-password-popup';
import { InstallActor } from '../actors/install-actor';

const minute = 60 * 1000;
test.describe('The main page', () => {
Expand All @@ -16,7 +17,7 @@ test.describe('The main page', () => {
indexActor.handleProductSelectionIfAny();
});

test('Full-disk encryption', async ({ page }) => {
test('Full-disk encryption', async ({ page }) => {
const mainPage = new MainPage(page);
await test.step("Set for Full-disk encryption", async () => {
await mainPage.accessStorage();
Expand All @@ -42,23 +43,8 @@ test.describe('The main page', () => {
//Installation
await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
// start the installation
await expect(page.getByText("Installation will take")).toBeVisible({ timeout: 2 * minute });
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
await expect(page.getByText("Installing packages")).toBeVisible({ timeout: 8 * minute });
while (true) {
try {
await page.getByRole("heading", { name: "Congratulations!" }).waitFor({ timeout: minute / 2 });
break;
}
catch (error) {
// do not ignore other errors
if (error.constructor.name !== "TimeoutError") throw (error);
}
}
const installActor = new InstallActor(page, mainPage);
await installActor.handleInstallation();
})
})
})
28 changes: 7 additions & 21 deletions tests/lvm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { UserActor } from "../actors/user-actor";
import { ProductSelectionOpensusePage } from '../pages/product-selection-opensuse-page';
import { MainPage } from '../pages/main-page';
import { StoragePage } from '../pages/storage-page';
import { InstallActor } from '../actors/install-actor';

const minute = 60 * 1000;
test.describe('The main page', () => {
Expand All @@ -15,7 +16,7 @@ test.describe('The main page', () => {
indexActor.handleProductSelectionIfAny();
});

test("Use logical volume management (LVM) as storage device for installation", async ({ page }) => {
test("Use logical volume management (LVM) as storage device for installation", async ({ page }) => {
const mainPage = new MainPage(page);
await test.step("Set LVM and Users", async () => {
await mainPage.accessStorage();
Expand All @@ -31,25 +32,10 @@ test.describe('The main page', () => {
await (new UserActor(page)).handleUser();
});

await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
// start the installation
await expect(page.getByText("Installation will take")).toBeVisible({ timeout: 2 * minute });
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
await expect(page.getByText("Installing packages")).toBeVisible({ timeout: 8 * minute });
while (true) {
try {
await page.getByRole("heading", { name: "Congratulations!" }).waitFor({ timeout: minute / 2 });
break;
}
catch (error) {
// do not ignore other errors
if (error.constructor.name !== "TimeoutError") throw (error);
}
}
});
await test.step("Run installation", async () => {
test.setTimeout(30 * minute);
const installActor = new InstallActor(page, mainPage);
await installActor.handleInstallation();
})
});
});

0 comments on commit d4dfab4

Please sign in to comment.