Skip to content

Commit f4a7c82

Browse files
committed
test: add tests for Satellite managed systems
HMS-10056
1 parent 8c4ac54 commit f4a7c82

2 files changed

Lines changed: 66 additions & 1 deletion

File tree

playwright/UI/SystemsTests.spec.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,68 @@ test.describe('Systems Tests', () => {
181181
await expect(page.getByText(`RHEL is locked at version ${version}`)).toBeVisible();
182182
});
183183
});
184+
185+
test('Satellite-managed systems have template column label and alerts in its detail, and cannot be assigned to a template', async ({
186+
page,
187+
request,
188+
systems,
189+
cleanup,
190+
}) => {
191+
const system = await systems.add('satellite-managed-system-test', 'satellite-managed');
192+
let templateUUID: string;
193+
const templatePrefix = 'template-satellite-managed-system-test';
194+
const templateName = `${templatePrefix}-${randomName()}`;
195+
196+
await navigateToSystems(page);
197+
await closePopupsIfExist(page);
198+
const row = await getRowByName(page, system.name);
199+
200+
await test.step('Set up cleanup', async () => {
201+
await cleanup.runAndAdd(() => cleanupTemplates(request, templatePrefix));
202+
});
203+
204+
await test.step('Verify system shows "Managed by Satellite" in Template column', async () => {
205+
const cell = await getRowCellByHeader(page, row, 'Template');
206+
await expect(cell).toHaveText('Managed by Satellite');
207+
});
208+
209+
await test.step('Verify system deatil shows two alerts', async () => {
210+
await row.getByRole('link', { name: system.name }).click();
211+
await expect(
212+
page.locator('section.inventory [data-ouia-component-type="PF6/Alert"]'),
213+
).toContainText([
214+
'This system has content managed by Satellite. Installable updates are current as of the last time the system checked-in with Red Hat Insights.',
215+
'This system has content managed by Satellite. For accurate reporting of installable updates, check in to Red Hat Insights with the --build-packagecache option.',
216+
]);
217+
});
218+
219+
await test.step('Create a template via API', async () => {
220+
templateUUID = await createTemplate(
221+
request,
222+
templateName,
223+
'SatelliteManagedSystemTestDescription',
224+
'8',
225+
);
226+
expect(templateUUID).toBeDefined();
227+
});
228+
229+
await test.step('Navigate to details of created template', async () => {
230+
await navigateToTemplates(page);
231+
const templateRow = await getRowByName(page, templateName);
232+
await templateRow.getByRole('button', { name: templateName }).click();
233+
expect(page.url()).toContain(templateUUID);
234+
await expect(page.getByRole('heading', { level: 1 })).toHaveText(templateName);
235+
});
236+
237+
await test.step('Verify template cannot be assigned to the satelite-managed system', async () => {
238+
await page.getByRole('button', { name: 'Assign to systems' }).click();
239+
const modal = page.getByRole('dialog', { name: 'Assign template to systems' });
240+
await expect(modal).toBeVisible();
241+
const systemRow = await getRowByName(modal, system.name);
242+
await expect(systemRow.getByRole('checkbox')).toBeDisabled();
243+
await systemRow.locator('[data-ouia-component-id="system-list-warning-icon"]').hover();
244+
await expect(page.getByText('Cannot associate system with a template')).toBeVisible();
245+
await expect(page.getByText('This system is managed by Satellite')).toBeVisible();
246+
});
247+
});
184248
});

playwright/test-utils/helpers/templates.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const createTemplate = async (
2222
request: APIRequestContext,
2323
templateName: string,
2424
description: string,
25+
version: string = '9',
2526
) => {
2627
const appstreamRepoUUID = '00b214de-e01d-4191-ad48-59bcc859e691';
2728
const baseOSRepoUUID = '5d2861ad-0d74-4116-98b4-254880126654';
@@ -32,7 +33,7 @@ export const createTemplate = async (
3233
name: templateName,
3334
description,
3435
arch: 'x86_64',
35-
version: '9',
36+
version,
3637
repository_uuids: [appstreamRepoUUID, baseOSRepoUUID],
3738
use_latest: true,
3839
},

0 commit comments

Comments
 (0)