Skip to content

Commit

Permalink
Adding an actor
Browse files Browse the repository at this point in the history
  • Loading branch information
rakoenig committed Aug 25, 2023
1 parent 70467d6 commit bb3eaee
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
32 changes: 32 additions & 0 deletions actors/install-actor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { expect, type Page } from '@playwright/test';
import { MainPage } from '../pages/main-page';
import { ConfirmInstallationPage } from '../pages/confirm-installation-page';
import { InstallationProgressPage } from '../pages/installing-page';
import { CongratulationsPage } from '../pages/installation-finisihed-page';

export class InstallActor {
readonly page: Page;
readonly mainPage: MainPage;
readonly confirmInstallationPage: ConfirmInstallationPage;
readonly installationProgressPage: InstallationProgressPage;
readonly congratulationsPage: CongratulationsPage;

constructor(page: Page,
mainPage: MainPage,
confirmInstallationPage: ConfirmInstallationPage,
installationProgressPage: InstallationProgressPage,
congratulationsPage: CongratulationsPage) {
this.page = page;
this.mainPage = mainPage;
this.confirmInstallationPage = confirmInstallationPage;
this.installationProgressPage = installationProgressPage;
this.congratulationsPage = congratulationsPage;
}

async handleInstallation() {
await this.mainPage.install();
await this.confirmInstallationPage.confirm();
await this.installationProgressPage.expectProgress();
await this.congratulationsPage.expectCongratulations();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export class CongratulationsPage {
}
}

}
}
2 changes: 1 addition & 1 deletion pages/installing-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export class InstallationProgressPage {
await expect(this.progressText).toBeVisible({ timeout: 8 * 60 * 1000 });
}

}
}
21 changes: 8 additions & 13 deletions tests/full-disk-encryption.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { DefineUserPage } from '../pages/define-user-page';
import { ConfigureRootPasswordPage } from '../pages/configure-root-password-page';
import { ConfirmInstallationPage } from '../pages/confirm-installation-page';
import { InstallationProgressPage } from '../pages/installing-page';
import { CongratulationsPage } from '../pages/installation-finsihed-page';
import { CongratulationsPage } from '../pages/installation-finisihed-page';
import { InstallActor } from '../actors/install-actor';

const minute = 60 * 1000;
test.describe('The main page', () => {
Expand All @@ -21,7 +22,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 Down Expand Up @@ -57,19 +58,13 @@ 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();
const confirmInstallationPopup = new ConfirmInstallationPage(page);
await confirmInstallationPopup.confirm();
// wait for the package installation progress
const confirmInstallationPage = new ConfirmInstallationPage(page);
const installationProgressPage = new InstallationProgressPage(page);
await installationProgressPage.expectProgress();

const congratulationsPage = new CongratulationsPage(page);
await congratulationsPage.expectCongratulations();

test.setTimeout(30 * minute);
await expect(page.getByText("Installation will take")).toBeVisible({ timeout: 2 * minute });
const installActor = new InstallActor(page, mainPage, confirmInstallationPage, installationProgressPage, congratulationsPage);
installActor.handleInstallation();
})
})
})

0 comments on commit bb3eaee

Please sign in to comment.