diff --git a/tests/src/extension-installation.spec.ts b/tests/src/extension-installation.spec.ts index ba8fd77ce76..1c0553ca9a3 100644 --- a/tests/src/extension-installation.spec.ts +++ b/tests/src/extension-installation.spec.ts @@ -44,7 +44,7 @@ let settingsTableLabel: string; let extensionBoxVisible: boolean; -const _startup = async function () { +const _startup = async function (): Promise { console.log('running before all'); pdRunner = new PodmanDesktopRunner(); page = await pdRunner.start(); @@ -53,7 +53,7 @@ const _startup = async function () { await welcomePage.handleWelcomePage(true); }; -const _shutdown = async function () { +const _shutdown = async function (): Promise { console.log('running after all'); await pdRunner.close(); }; @@ -199,7 +199,7 @@ describe.each([ }); }); -function initializeLocators(extensionType: string) { +function initializeLocators(extensionType: string): void { const dashboardPage = new DashboardPage(page); const settingsExtensionsPage = new SettingsExtensionsPage(page); switch (extensionType) { @@ -230,14 +230,14 @@ function initializeLocators(extensionType: string) { } } -async function goToDashboard() { +async function goToDashboard(): Promise { const navBar = page.getByRole('navigation', { name: 'AppNavigation' }); const dashboardLink = navBar.getByRole('link', { name: 'Dashboard' }); await playExpect(dashboardLink).toBeVisible(); await dashboardLink.click(); } -async function goToSettings() { +async function goToSettings(): Promise { const navBar = page.getByRole('navigation', { name: 'AppNavigation' }); const settingsLink = navBar.getByRole('link', { name: 'Settings' }); await playExpect(settingsLink).toBeVisible(); diff --git a/tests/src/globalSetup/global-setup.ts b/tests/src/globalSetup/global-setup.ts index 7212b893e15..8a439a44124 100644 --- a/tests/src/globalSetup/global-setup.ts +++ b/tests/src/globalSetup/global-setup.ts @@ -21,7 +21,7 @@ import { removeFolderIfExists } from '../utility/cleanup'; let setupCalled = false; let teardownCalled = false; -export async function setup() { +export async function setup(): Promise { if (!setupCalled) { // remove all previous testing output files // Junit reporter output file is created before we can clean up output folders @@ -37,7 +37,7 @@ export async function setup() { } } -export async function teardown() { +export async function teardown(): Promise { if (!teardownCalled) { // here comes teardown logic teardownCalled = true; diff --git a/tests/src/image-smoke.spec.ts b/tests/src/image-smoke.spec.ts index 358cc56face..84d9cd32670 100644 --- a/tests/src/image-smoke.spec.ts +++ b/tests/src/image-smoke.spec.ts @@ -26,6 +26,7 @@ import { NavigationBar } from './model/workbench/navigation'; import { ImageDetailsPage } from './model/pages/image-details-page'; import path from 'path'; import { handleConfirmationDialog } from './utility/operations'; +import type { ImagesPage } from './model/pages/images-page'; let pdRunner: PodmanDesktopRunner; let page: Page; @@ -52,7 +53,7 @@ beforeEach(async ctx => { }); describe('Image workflow verification', async () => { - async function pullImageByName(imageName: string) { + async function pullImageByName(imageName: string): Promise { let imagesPage = await navBar.openImages(); const pullImagePage = await imagesPage.openPullImage(); imagesPage = await pullImagePage.pullImage(imageName); diff --git a/tests/src/model/pages/container-details-page.ts b/tests/src/model/pages/container-details-page.ts index 94c915b305a..920d100d687 100644 --- a/tests/src/model/pages/container-details-page.ts +++ b/tests/src/model/pages/container-details-page.ts @@ -45,7 +45,7 @@ export class ContainerDetailsPage extends BasePage { this.backToContainersLink = page.getByRole('link', { name: 'Go back to Containers' }); } - async activateTab(tabName: string) { + async activateTab(tabName: string): Promise { const tabItem = this.page.getByRole('link', { name: tabName, exact: true }); await tabItem.waitFor({ state: 'visible', timeout: 2000 }); await tabItem.click(); diff --git a/tests/src/model/pages/pods-details-page.ts b/tests/src/model/pages/pods-details-page.ts index aab6297acde..0b185e9a6ca 100644 --- a/tests/src/model/pages/pods-details-page.ts +++ b/tests/src/model/pages/pods-details-page.ts @@ -46,7 +46,7 @@ export class PodDetailsPage extends BasePage { this.backToPodsLink = page.getByRole('link', { name: 'Go back to Pods' }); } - async activateTab(tabName: string) { + async activateTab(tabName: string): Promise { const tabItem = this.page.getByRole('link', { name: tabName }); await tabItem.waitFor({ state: 'visible', timeout: 2000 }); await tabItem.click(); diff --git a/tests/src/model/pages/registries-page.ts b/tests/src/model/pages/registries-page.ts index b18aa475172..4d0be2f3ebe 100644 --- a/tests/src/model/pages/registries-page.ts +++ b/tests/src/model/pages/registries-page.ts @@ -32,7 +32,7 @@ export class RegistriesPage extends SettingsPage { this.registriesTable = page.getByRole('table', { name: 'Registries' }); } - async createRegistry(url: string, username: string, pswd: string) { + async createRegistry(url: string, username: string, pswd: string): Promise { await this.addRegistryButton.click(); const registryUrl = this.page.getByLabel('Register URL'); @@ -46,7 +46,7 @@ export class RegistriesPage extends SettingsPage { await this.loginButtonHandling(loginButton); } - async editRegistry(title: string, newUsername: string, newPswd: string) { + async editRegistry(title: string, newUsername: string, newPswd: string): Promise { const registryBox = await this.getRegistryRowByName(title); const dropdownMenu = registryBox.getByRole('button', { name: 'kebab menu' }); @@ -68,7 +68,7 @@ export class RegistriesPage extends SettingsPage { * There are two types of registries, if it is custom, then it can be actually deleted * If it is default registry, it will delete only the credentials and the record will be kept there. */ - async removeRegistry(title: string) { + async removeRegistry(title: string): Promise { const registryBox = await this.getRegistryRowByName(title); const dropdownMenu = registryBox.getByRole('button', { name: 'kebab menu' }); diff --git a/tests/src/model/pages/run-image-page.ts b/tests/src/model/pages/run-image-page.ts index 498dd7c2d1e..3b07c14b440 100644 --- a/tests/src/model/pages/run-image-page.ts +++ b/tests/src/model/pages/run-image-page.ts @@ -40,14 +40,14 @@ export class RunImagePage extends BasePage { this.startContainerButton = page.getByRole('button', { name: 'Start Container' }); } - async activateTab(name: string) { + async activateTab(name: string): Promise { const tabactive = this.page.getByRole('link', { name: name, exact: true }).and(this.page.getByText(name)); await tabactive.click(); } // If the container has a defined exposed port, the mapping offers only one part of the input box, host port // Example of the placeholder: 'Enter value for port 80/tcp' : settable value - async setHostPortToExposedContainerPort(exposedPort: string, port: string) { + async setHostPortToExposedContainerPort(exposedPort: string, port: string): Promise { await this.activateTab('Basic'); const portMapping = this.page .getByRole('textbox') diff --git a/tests/src/model/pages/welcome-page.ts b/tests/src/model/pages/welcome-page.ts index 9596e458d74..61de75e39c3 100644 --- a/tests/src/model/pages/welcome-page.ts +++ b/tests/src/model/pages/welcome-page.ts @@ -32,15 +32,15 @@ export class WelcomePage extends BasePage { this.goToPodmanDesktopButton = page.getByRole('button', { name: 'Go to Podman Desktop', exact: true }); } - async turnOffTelemetry() { + async turnOffTelemetry(): Promise { await this.telemetryConsent.uncheck(); } - async closeWelcomePage() { + async closeWelcomePage(): Promise { await this.goToPodmanDesktopButton.click(); } - async waitForInitialization() { + async waitForInitialization(): Promise { // wait for an application to initialize const checkLoader = this.page.getByRole('heading', { name: 'Initializing...' }); await expect(checkLoader).toHaveCount(0, { timeout: 5000 }); @@ -49,7 +49,7 @@ export class WelcomePage extends BasePage { /** * Waits for application to initialize, turn off telemetry and closes welcome page */ - async handleWelcomePage(skipIfNotPresent: boolean) { + async handleWelcomePage(skipIfNotPresent: boolean): Promise { await this.waitForInitialization(); if (skipIfNotPresent) { try { diff --git a/tests/src/podman-extension-smoke.spec.ts b/tests/src/podman-extension-smoke.spec.ts index 3a1379c7588..ed1276ead9f 100644 --- a/tests/src/podman-extension-smoke.spec.ts +++ b/tests/src/podman-extension-smoke.spec.ts @@ -82,7 +82,7 @@ describe('Verification of Podman extension', async () => { }); }); -async function verifyPodmanExtensionStatus(enabled: boolean) { +async function verifyPodmanExtensionStatus(enabled: boolean): Promise { dashboardPage = await navigationBar.openDashboard(); const podmanProviderLocator = dashboardPage.getPodmanStatusLocator(); enabled diff --git a/tests/src/runner/podman-desktop-runner.ts b/tests/src/runner/podman-desktop-runner.ts index 52d8c3e055c..5408a57af94 100644 --- a/tests/src/runner/podman-desktop-runner.ts +++ b/tests/src/runner/podman-desktop-runner.ts @@ -104,15 +104,15 @@ export class PodmanDesktopRunner { return await this.getElectronApp().browserWindow(this.getPage()); } - public async screenshot(filename: string) { + public async screenshot(filename: string): Promise { await this.getPage().screenshot({ path: join(this._testOutput, 'screenshots', filename) }); } - public async startTracing() { + public async startTracing(): Promise { await this.getPage().context().tracing.start({ screenshots: true, snapshots: true }); } - public async stopTracing() { + public async stopTracing(): Promise { let name = ''; if (this._videoAndTraceName) name = this._videoAndTraceName; @@ -126,7 +126,7 @@ export class PodmanDesktopRunner { return await ( await this.getBrowserWindow() ).evaluate((mainWindow): Promise => { - const getState = () => { + const getState = (): { isVisible: boolean; isDevToolsOpened: boolean; isCrashed: boolean } => { return { isVisible: mainWindow.isVisible(), isDevToolsOpened: mainWindow.webContents.isDevToolsOpened(), @@ -149,7 +149,7 @@ export class PodmanDesktopRunner { }); } - async saveVideoAs(path: string) { + async saveVideoAs(path: string): Promise { const video = this.getPage().video(); if (video) { await video.saveAs(path); @@ -158,7 +158,7 @@ export class PodmanDesktopRunner { } } - public async close() { + public async close(): Promise { // Stop playwright tracing await this.stopTracing(); @@ -191,7 +191,7 @@ export class PodmanDesktopRunner { }); } - private defaultOptions() { + private defaultOptions(): object { const directory = join(this._testOutput, 'videos'); const tracesDir = join(this._testOutput, 'traces', 'raw'); console.log(`video will be written to: ${directory}`); @@ -251,11 +251,11 @@ export class PodmanDesktopRunner { return this._running; } - public setOptions(value: object) { + public setOptions(value: object): void { this._options = value; } - public setVideoAndTraceName(name: string) { + public setVideoAndTraceName(name: string): void { this._videoAndTraceName = name; }