mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-05-24 10:18:53 +00:00
chore(tests): add arch selection for build image (#7221)
* chore(tests): add arch selection for build image for e2e tests
This commit is contained in:
parent
87413f6d38
commit
5cb3f105d7
2 changed files with 64 additions and 3 deletions
23
tests/playwright/src/model/core/platforms.ts
Normal file
23
tests/playwright/src/model/core/platforms.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**********************************************************************
|
||||
* Copyright (C) 2024 Red Hat, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
***********************************************************************/
|
||||
|
||||
export enum ArchitectureType {
|
||||
Default = 'default',
|
||||
AMD64 = 'amd64',
|
||||
ARM64 = 'arm64',
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
import type { Locator, Page } from '@playwright/test';
|
||||
import { expect as playExpect } from '@playwright/test';
|
||||
|
||||
import { ArchitectureType } from '../core/platforms';
|
||||
import { BasePage } from './base-page';
|
||||
import { ImagesPage } from './images-page';
|
||||
|
||||
|
|
@ -29,8 +30,11 @@ export class BuildImagePage extends BasePage {
|
|||
readonly buildButton: Locator;
|
||||
readonly doneButton: Locator;
|
||||
readonly containerFilePathButton: Locator;
|
||||
readonly platformRegion: Locator;
|
||||
readonly arm64Button: Locator;
|
||||
readonly amd64Button: Locator;
|
||||
readonly arm64checkbox: Locator;
|
||||
readonly amd64checkbox: Locator;
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page);
|
||||
|
|
@ -41,11 +45,19 @@ export class BuildImagePage extends BasePage {
|
|||
this.buildButton = page.getByRole('button', { name: 'Build' });
|
||||
this.doneButton = page.getByRole('button', { name: 'Done' });
|
||||
this.containerFilePathButton = page.getByRole('button', { name: 'Browse...' }).first();
|
||||
this.arm64Button = page.getByLabel('linux/arm64');
|
||||
this.amd64Button = page.getByLabel('linux/amd64');
|
||||
this.platformRegion = page.getByRole('region', { name: 'Build Platform Options' });
|
||||
this.arm64Button = this.platformRegion.getByLabel('linux/arm64');
|
||||
this.amd64Button = this.platformRegion.getByLabel('linux/amd64');
|
||||
this.arm64checkbox = this.platformRegion.getByLabel('ARM® aarch64 systems');
|
||||
this.amd64checkbox = this.platformRegion.getByLabel('Intel and AMD x86_64 systems');
|
||||
}
|
||||
|
||||
async buildImage(imageName: string, containerFilePath: string, contextDirectory: string): Promise<ImagesPage> {
|
||||
async buildImage(
|
||||
imageName: string,
|
||||
containerFilePath: string,
|
||||
contextDirectory: string,
|
||||
archType = ArchitectureType.Default,
|
||||
): Promise<ImagesPage> {
|
||||
if (!containerFilePath) {
|
||||
throw Error(`Path to containerfile is incorrect or not provided!`);
|
||||
}
|
||||
|
|
@ -58,10 +70,36 @@ export class BuildImagePage extends BasePage {
|
|||
await this.imageNameInput.pressSequentially(imageName, { delay: 50 });
|
||||
}
|
||||
|
||||
if (archType !== ArchitectureType.Default) {
|
||||
await this.uncheckedAllCheckboxes();
|
||||
|
||||
switch (archType) {
|
||||
case ArchitectureType.ARM64:
|
||||
await this.arm64Button.click();
|
||||
await playExpect(this.arm64checkbox).toBeChecked();
|
||||
break;
|
||||
case ArchitectureType.AMD64:
|
||||
await this.amd64Button.click();
|
||||
await playExpect(this.amd64checkbox).toBeChecked();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await playExpect(this.buildButton).toBeEnabled();
|
||||
await this.buildButton.click();
|
||||
await playExpect(this.doneButton).toBeEnabled({ timeout: 120000 });
|
||||
await this.doneButton.click();
|
||||
return new ImagesPage(this.page);
|
||||
}
|
||||
|
||||
async uncheckedAllCheckboxes(): Promise<void> {
|
||||
if (await this.arm64checkbox.isChecked()) {
|
||||
await this.arm64Button.click();
|
||||
await playExpect(this.arm64checkbox).not.toBeChecked();
|
||||
}
|
||||
if (await this.amd64checkbox.isChecked()) {
|
||||
await this.amd64Button.click();
|
||||
await playExpect(this.amd64checkbox).not.toBeChecked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue