mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-05-23 17:58:22 +00:00
chore: fix return type in tests folder
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
This commit is contained in:
parent
9115372583
commit
fc5f836902
10 changed files with 30 additions and 29 deletions
|
|
@ -44,7 +44,7 @@ let settingsTableLabel: string;
|
|||
|
||||
let extensionBoxVisible: boolean;
|
||||
|
||||
const _startup = async function () {
|
||||
const _startup = async function (): Promise<void> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
const navBar = page.getByRole('navigation', { name: 'AppNavigation' });
|
||||
const settingsLink = navBar.getByRole('link', { name: 'Settings' });
|
||||
await playExpect(settingsLink).toBeVisible();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { removeFolderIfExists } from '../utility/cleanup';
|
|||
let setupCalled = false;
|
||||
let teardownCalled = false;
|
||||
|
||||
export async function setup() {
|
||||
export async function setup(): Promise<void> {
|
||||
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<void> {
|
||||
if (!teardownCalled) {
|
||||
// here comes teardown logic
|
||||
teardownCalled = true;
|
||||
|
|
|
|||
|
|
@ -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<RunnerTestContext>(async ctx => {
|
|||
});
|
||||
|
||||
describe('Image workflow verification', async () => {
|
||||
async function pullImageByName(imageName: string) {
|
||||
async function pullImageByName(imageName: string): Promise<ImagesPage> {
|
||||
let imagesPage = await navBar.openImages();
|
||||
const pullImagePage = await imagesPage.openPullImage();
|
||||
imagesPage = await pullImagePage.pullImage(imageName);
|
||||
|
|
|
|||
|
|
@ -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<void> {
|
||||
const tabItem = this.page.getByRole('link', { name: tabName, exact: true });
|
||||
await tabItem.waitFor({ state: 'visible', timeout: 2000 });
|
||||
await tabItem.click();
|
||||
|
|
|
|||
|
|
@ -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<void> {
|
||||
const tabItem = this.page.getByRole('link', { name: tabName });
|
||||
await tabItem.waitFor({ state: 'visible', timeout: 2000 });
|
||||
await tabItem.click();
|
||||
|
|
|
|||
|
|
@ -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<void> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
const registryBox = await this.getRegistryRowByName(title);
|
||||
|
||||
const dropdownMenu = registryBox.getByRole('button', { name: 'kebab menu' });
|
||||
|
|
|
|||
|
|
@ -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<void> {
|
||||
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<void> {
|
||||
await this.activateTab('Basic');
|
||||
const portMapping = this.page
|
||||
.getByRole('textbox')
|
||||
|
|
|
|||
|
|
@ -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<void> {
|
||||
await this.telemetryConsent.uncheck();
|
||||
}
|
||||
|
||||
async closeWelcomePage() {
|
||||
async closeWelcomePage(): Promise<void> {
|
||||
await this.goToPodmanDesktopButton.click();
|
||||
}
|
||||
|
||||
async waitForInitialization() {
|
||||
async waitForInitialization(): Promise<void> {
|
||||
// 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<void> {
|
||||
await this.waitForInitialization();
|
||||
if (skipIfNotPresent) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ describe('Verification of Podman extension', async () => {
|
|||
});
|
||||
});
|
||||
|
||||
async function verifyPodmanExtensionStatus(enabled: boolean) {
|
||||
async function verifyPodmanExtensionStatus(enabled: boolean): Promise<void> {
|
||||
dashboardPage = await navigationBar.openDashboard();
|
||||
const podmanProviderLocator = dashboardPage.getPodmanStatusLocator();
|
||||
enabled
|
||||
|
|
|
|||
|
|
@ -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<void> {
|
||||
await this.getPage().screenshot({ path: join(this._testOutput, 'screenshots', filename) });
|
||||
}
|
||||
|
||||
public async startTracing() {
|
||||
public async startTracing(): Promise<void> {
|
||||
await this.getPage().context().tracing.start({ screenshots: true, snapshots: true });
|
||||
}
|
||||
|
||||
public async stopTracing() {
|
||||
public async stopTracing(): Promise<void> {
|
||||
let name = '';
|
||||
if (this._videoAndTraceName) name = this._videoAndTraceName;
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ export class PodmanDesktopRunner {
|
|||
return await (
|
||||
await this.getBrowserWindow()
|
||||
).evaluate((mainWindow): Promise<WindowState> => {
|
||||
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<void> {
|
||||
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<void> {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue