Skip to content

Commit 2001142

Browse files
authored
chore(test): special handling for iso builds (#669)
* chore(test): special handling for iso builds
1 parent fcc0e9c commit 2001142

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

tests/playwright/src/bootc-extension.spec.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ const isWindows = os.platform() === 'win32';
4848
const containerFilePath = path.resolve(__dirname, '..', 'resources', 'bootable-containerfile');
4949
const contextDirectory = path.resolve(__dirname, '..', 'resources');
5050
const skipInstallation = process.env.SKIP_INSTALLATION;
51+
const buildISOImage = process.env.BUILD_ISO_IMAGE;
52+
let timeoutForBuild = 600000;
5153

5254
beforeEach<RunnerTestContext>(async ctx => {
5355
ctx.pdRunner = pdRunner;
@@ -124,9 +126,18 @@ describe('BootC Extension', async () => {
124126
await playExpect.poll(async () => await imagesPage.waitForImageExists(imageName)).toBeTruthy();
125127
}, 150000);
126128

127-
test.skipIf(isLinux).each(['QCOW2', 'AMI', 'RAW', 'VMDK', 'ISO'])(
128-
`Building bootable image type: %s`,
129-
async type => {
129+
describe.skipIf(isLinux).each(['QCOW2', 'AMI', 'RAW', 'VMDK', 'ISO'])('Building images ', async type => {
130+
test(`Building bootable image type: ${type}`, async context => {
131+
if (type === 'ISO') {
132+
if (buildISOImage) {
133+
timeoutForBuild = 1200000;
134+
console.log(`Building ISO image requested, extending timeout to ${timeoutForBuild}`);
135+
} else {
136+
console.log(`Building ISO image not requested, skipping test`);
137+
context.skip();
138+
}
139+
}
140+
130141
const imagesPage = await navBar.openImages();
131142
await playExpect(imagesPage.heading).toBeVisible();
132143

@@ -136,7 +147,13 @@ describe('BootC Extension', async () => {
136147
const pathToStore = path.resolve(__dirname, '..', 'tests', 'output', 'images', `${type}-${architecture}`);
137148
[page, webview] = await handleWebview();
138149
const bootcPage = new BootcPage(page, webview);
139-
const result = await bootcPage.buildDiskImage(`${imageName}:${imageTag}`, pathToStore, type, architecture);
150+
const result = await bootcPage.buildDiskImage(
151+
`${imageName}:${imageTag}`,
152+
pathToStore,
153+
type,
154+
architecture,
155+
timeoutForBuild,
156+
);
140157
console.log(
141158
`Building disk image for platform ${os.platform()} and architecture ${architecture} and type ${type} is ${result}`,
142159
);
@@ -147,9 +164,8 @@ describe('BootC Extension', async () => {
147164
console.log('Expected to pass on Linux, Windows and macOS');
148165
playExpect(result).toBeTruthy();
149166
}
150-
},
151-
620000,
152-
);
167+
}, 1250000);
168+
});
153169
},
154170
);
155171

tests/playwright/src/model/bootc-page.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export class BootcPage {
7171
pathToStore: string,
7272
type: string,
7373
architecture: ArchitectureType,
74+
timeout = 600000,
7475
): Promise<boolean> {
7576
let result = false;
7677

@@ -130,12 +131,12 @@ export class BootcPage {
130131
await this.buildButton.focus();
131132
await this.buildButton.click();
132133

133-
await playExpect(this.goBackButton).toBeEnabled();
134+
await playExpect(this.goBackButton).toBeEnabled({ timeout: 30000 });
134135
await this.goBackButton.click();
135-
await playExpect(this.bootcListPage).toBeVisible();
136+
await playExpect(this.bootcListPage).toBeVisible({ timeout: 10000 });
136137

137138
await playExpect(this.getTypeOfLatestBuildImage).toContainText(type.toLocaleLowerCase(), { timeout: 10000 });
138-
await this.waitUntilCurrentBuildIsFinished();
139+
await this.waitUntilCurrentBuildIsFinished(timeout);
139140
if ((await this.getCurrentStatusOfLatestEntry()) === 'error') {
140141
console.log('Error building image! Retuning false.');
141142
return false;
@@ -170,13 +171,13 @@ export class BootcPage {
170171
return '';
171172
}
172173

173-
async waitUntilCurrentBuildIsFinished(): Promise<void> {
174+
async waitUntilCurrentBuildIsFinished(timeout = 600000): Promise<void> {
174175
await waitUntil(
175176
async () =>
176177
(await this.getCurrentStatusOfLatestEntry()) === 'error' ||
177178
(await this.getCurrentStatusOfLatestEntry()) === 'success',
178179
{
179-
timeout: 600000,
180+
timeout: timeout,
180181
diff: 2500,
181182
message: `Build didn't finish before timeout!`,
182183
},

0 commit comments

Comments
 (0)