|
| 1 | +import { expect } from '@playwright/test'; |
| 2 | +import { v4 as uuidv4 } from 'uuid'; |
| 3 | + |
| 4 | +import { test } from '../fixtures/customizations'; |
| 5 | +import { IMPORT_WITH_DUPLICATE_VALUES } from '../fixtures/importFileContents'; |
| 6 | +import { isHosted } from '../helpers/helpers'; |
| 7 | +import { ensureAuthenticated } from '../helpers/login'; |
| 8 | +import { ibFrame, navigateToLandingPage } from '../helpers/navHelpers'; |
| 9 | +import { |
| 10 | + createBlueprint, |
| 11 | + deleteBlueprint, |
| 12 | + fillInDetails, |
| 13 | + importBlueprint, |
| 14 | + importDynamicFixture, |
| 15 | + registerLater, |
| 16 | +} from '../helpers/wizardHelpers'; |
| 17 | + |
| 18 | +test('Import a blueprint with invalid customization', async ({ |
| 19 | + page, |
| 20 | + cleanup, |
| 21 | +}) => { |
| 22 | + const blueprintName = 'test-' + uuidv4(); |
| 23 | + |
| 24 | + // Delete the blueprint after the run fixture |
| 25 | + await cleanup.add(() => deleteBlueprint(page, blueprintName)); |
| 26 | + |
| 27 | + await ensureAuthenticated(page); |
| 28 | + |
| 29 | + // Navigate to IB landing page and get the frame |
| 30 | + await navigateToLandingPage(page); |
| 31 | + const frame = await ibFrame(page); |
| 32 | + |
| 33 | + await test.step('Import BP', async (step) => { |
| 34 | + step.skip(!isHosted(), 'Importing is not available in the plugin'); |
| 35 | + await importDynamicFixture(blueprintName, IMPORT_WITH_DUPLICATE_VALUES); |
| 36 | + await importBlueprint(page, blueprintName); |
| 37 | + }); |
| 38 | + |
| 39 | + await test.step('Navigate to optional steps in Wizard', async () => { |
| 40 | + await page.getByRole('checkbox', { name: 'Virtualization' }).click(); |
| 41 | + await page.getByRole('button', { name: 'Next' }).click(); |
| 42 | + await registerLater(frame); |
| 43 | + }); |
| 44 | + |
| 45 | + await test.step('Select the Locale step', async () => { |
| 46 | + await frame |
| 47 | + .getByLabel('Wizard steps') |
| 48 | + .getByRole('button', { name: 'File system configuration' }) |
| 49 | + .click(); |
| 50 | + await frame.getByRole('button', { name: 'Next' }).click(); |
| 51 | + await frame |
| 52 | + .getByRole('heading', { name: 'Danger alert: Duplicate mount' }) |
| 53 | + .first() |
| 54 | + .click(); |
| 55 | + const closeRootButton = frame |
| 56 | + .locator('td:nth-child(7) > .pf-v6-c-button') |
| 57 | + .first(); |
| 58 | + await expect(closeRootButton).toBeEnabled(); |
| 59 | + await closeRootButton.click(); |
| 60 | + const closeRootButton2 = frame |
| 61 | + .getByRole('row', { |
| 62 | + name: 'Draggable row draggable button / xfs 10 GiB', |
| 63 | + }) |
| 64 | + .getByRole('button') |
| 65 | + .nth(3); |
| 66 | + await expect(closeRootButton2).toBeDisabled(); |
| 67 | + |
| 68 | + await frame.getByRole('button', { name: 'error Timezone' }).click(); |
| 69 | + await expect(frame.getByText('Includes duplicate NTP')).toBeVisible(); |
| 70 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 71 | + await frame.getByRole('button', { name: 'Close ntp/' }).first().click(); |
| 72 | + await frame.getByRole('button', { name: 'Next' }).click(); |
| 73 | + |
| 74 | + await expect(frame.getByText('Unknown languages: random:')).toBeVisible(); |
| 75 | + await expect(frame.getByText('Duplicated languages: af_ZA.')).toBeVisible(); |
| 76 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 77 | + await frame.getByRole('button', { name: 'Close random' }).click(); |
| 78 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 79 | + await frame |
| 80 | + .getByRole('button', { name: 'Close Afrikaans - South' }) |
| 81 | + .nth(1) |
| 82 | + .click(); |
| 83 | + await frame.getByRole('button', { name: 'Next' }).click(); |
| 84 | + |
| 85 | + await frame.getByRole('button', { name: 'error Firewall' }).click(); |
| 86 | + await expect(frame.getByText('Includes duplicate ports:')).toBeVisible(); |
| 87 | + await expect(frame.getByText('Includes duplicate enabled')).toBeVisible(); |
| 88 | + await expect(frame.getByText('Includes duplicate disabled')).toBeVisible(); |
| 89 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 90 | + await frame |
| 91 | + .getByRole('button', { name: 'Close 2020:port' }) |
| 92 | + .first() |
| 93 | + .click(); |
| 94 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 95 | + await frame.getByRole('button', { name: 'Close service1' }).first().click(); |
| 96 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 97 | + await frame.getByRole('button', { name: 'Close service2' }).first().click(); |
| 98 | + await frame.getByRole('button', { name: 'Next' }).click(); |
| 99 | + |
| 100 | + await expect(frame.getByText('Includes duplicate enabled')).toBeVisible(); |
| 101 | + await expect(frame.getByText('Includes duplicate disabled')).toBeVisible(); |
| 102 | + await expect(frame.getByText('Includes duplicate masked')).toBeVisible(); |
| 103 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 104 | + await frame.getByRole('button', { name: 'Close auditd' }).first().click(); |
| 105 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 106 | + await frame.getByRole('button', { name: 'Close sssd' }).first().click(); |
| 107 | + await expect(frame.getByRole('button', { name: 'Next' })).toBeDisabled(); |
| 108 | + await frame.getByRole('button', { name: 'Close masked' }).first().click(); |
| 109 | + await frame.getByRole('button', { name: 'Review and finish' }).click(); |
| 110 | + }); |
| 111 | + |
| 112 | + await test.step('Fill the BP details', async () => { |
| 113 | + await fillInDetails(frame, blueprintName); |
| 114 | + }); |
| 115 | + |
| 116 | + await test.step('Create BP', async () => { |
| 117 | + await createBlueprint(frame, blueprintName); |
| 118 | + }); |
| 119 | +}); |
0 commit comments