Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add POM code for launching installation #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 62 additions & 5 deletions dist/default_installation.cjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/full_disk_encryption.cjs

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/pages/confirm-installation-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import puppeteer, { type Locator, type Page } from "puppeteer-core";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can drop puppeteer and Locator.


export class ConfirmInstallationPopup {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ending in Page.

private readonly page: Page;
private readonly continueText = () => this.page.locator("button::-p-text('Continue')");

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

async continue() {
await this.continueText().click();
}
}
14 changes: 14 additions & 0 deletions src/pages/overiew-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import puppeteer, { type Locator, type Page } from "puppeteer-core";

export class OverviewPage {
private readonly page: Page;
private readonly installText = () => this.page.locator("button::-p-text('Install')");

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

async install() {
await this.installText().click();
}
}
11 changes: 8 additions & 3 deletions src/tests/default_installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { SidebarPage } from "../pages/sidebar-page";
import { UsersPage } from "../pages/users-page";
import { SetARootPasswordPage } from "../pages/root-password-page";
import { CreateFirstUserPage } from "../pages/create-user-page"
import { OverviewPage } from "../pages/overiew-page";
import { ConfirmInstallationPopup } from "../pages/confirm-installation-page";

let page: Page;
let browser: Browser;
Expand Down Expand Up @@ -153,7 +155,8 @@ describe("Agama test", function () {
}

it("should be ready for installation", async function () {
await page.locator("a[href='#/overview']").click();
const sidebar = new SidebarPage(page);
await sidebar.goToOverview();
// In Overview, Storage section takes more time to refresh changing
// the position in the screen of text 'Ready for installation and button 'Install'
// page.waitForNetworkIdle solves this issue
Expand All @@ -163,8 +166,10 @@ describe("Agama test", function () {
// For development will be useful to stop before starting installation
if (agamaInstall === true) {
it("should start installation", async function () {
await page.locator("button::-p-text('Install')").click();
await page.locator("button::-p-text('Continue')").click();
const overview = new OverviewPage(page);
const install = new ConfirmInstallationPopup(page);
await overview.install();
await install.continue();
await page.locator("::-p-text(Installing the)").wait();
});

Expand Down