diff --git a/libs/ui-lib-tests/cypress/integration/storage/storage-step-disk-holders.cy.ts b/libs/ui-lib-tests/cypress/integration/storage/storage-step-disk-holders.cy.ts index b23744906e..46c56a2dfb 100644 --- a/libs/ui-lib-tests/cypress/integration/storage/storage-step-disk-holders.cy.ts +++ b/libs/ui-lib-tests/cypress/integration/storage/storage-step-disk-holders.cy.ts @@ -1,9 +1,9 @@ import { commonActions } from '../../views/common'; import { ValidateDiskHoldersParams, hostsTableSection } from '../../views/hostsTableSection'; -import { StoragePage } from '../../views/pages/StoragePage'; +import { StorageForm } from '../../views/forms/Storage/StorageForm'; describe(`Assisted Installer Storage Step`, () => { - let storagePage; + let storageForm; const disks = [ { name: 'vda' }, { name: 'vdb' }, @@ -39,21 +39,21 @@ describe(`Assisted Installer Storage Step`, () => { commonActions.visitClusterDetailsPage(); commonActions.startAtWizardStep('Storage'); - storagePage = new StoragePage(); + storageForm = new StorageForm(); }); it('Should display the correct alerts', () => { - storagePage.diskLimitationAlert.title.should( + storageForm.diskLimitationAlert.title.should( 'contain.text', 'Warning alert:Installation disk limitations', ); - storagePage.diskLimitationAlert.description.find('li').then(($res) => { + storageForm.diskLimitationAlert.description.find('li').then(($res) => { expect($res).to.have.length(3); warningTexts.forEach((text, index) => expect($res[index]).to.contain(text)); }); - storagePage.diskFormattingAlert.title.should( + storageForm.diskFormattingAlert.title.should( 'contain.text', 'Warning alert:All bootable disks, except for read-only disks, will be formatted during installation. Make sure to back up any critical data before proceeding.', ); diff --git a/libs/ui-lib-tests/cypress/integration/use-cases/create-cluster/with-mce-operator.cy.ts b/libs/ui-lib-tests/cypress/integration/use-cases/create-cluster/with-mce-operator.cy.ts index e7a862a883..1acaf10ca8 100644 --- a/libs/ui-lib-tests/cypress/integration/use-cases/create-cluster/with-mce-operator.cy.ts +++ b/libs/ui-lib-tests/cypress/integration/use-cases/create-cluster/with-mce-operator.cy.ts @@ -1,5 +1,5 @@ import { commonActions } from '../../../views/common'; -import OperatorsForm from '../../../views/forms/OperatorsForm'; +import OperatorsForm from '../../../views/forms/Operators/OperatorsForm'; describe(`Create cluster with mce operator enabled`, () => { const setTestStartSignal = (activeSignal: string) => { diff --git a/libs/ui-lib-tests/cypress/views/components/Alert.ts b/libs/ui-lib-tests/cypress/views/components/Alert.ts deleted file mode 100644 index bf4a5bb0fe..0000000000 --- a/libs/ui-lib-tests/cypress/views/components/Alert.ts +++ /dev/null @@ -1,23 +0,0 @@ -export class Alert { - constructor(parentAlias: string, dataTestId?: string) { - dataTestId - ? cy.get(parentAlias).findByTestId(dataTestId).as(Alert.name) - : cy.get(parentAlias).find('.pf-c-alert').as(Alert.name); - } - - static get alias() { - return `@${Alert.name}`; - } - - get body() { - return cy.get(Alert.alias); - } - - get title() { - return this.body.find('.pf-c-alert__title'); - } - - get description() { - return this.body.find('.pf-c-alert__description'); - } -} diff --git a/libs/ui-lib-tests/cypress/views/forms/OperatorsForm.ts b/libs/ui-lib-tests/cypress/views/forms/Operators/OperatorsForm.ts similarity index 100% rename from libs/ui-lib-tests/cypress/views/forms/OperatorsForm.ts rename to libs/ui-lib-tests/cypress/views/forms/Operators/OperatorsForm.ts diff --git a/libs/ui-lib-tests/cypress/views/forms/Storage/StorageForm.ts b/libs/ui-lib-tests/cypress/views/forms/Storage/StorageForm.ts new file mode 100644 index 0000000000..448a377eed --- /dev/null +++ b/libs/ui-lib-tests/cypress/views/forms/Storage/StorageForm.ts @@ -0,0 +1,18 @@ +import { Alert } from '../../reusableComponents/Alert'; + +export class StorageForm { + static readonly alias = `@${StorageForm.name}`; + static readonly selector = '.pf-c-wizard__main-body'; + + constructor() { + cy.findWithinOrGet(StorageForm.selector).as(StorageForm.name); + } + + get diskLimitationAlert() { + return new Alert(StorageForm.alias, '[data-testid="diskLimitationsAlert"]'); + } + + get diskFormattingAlert() { + return new Alert(StorageForm.alias, '[data-testid="alert-format-bootable-disks"]'); + } +} diff --git a/libs/ui-lib-tests/cypress/views/pages/StoragePage.ts b/libs/ui-lib-tests/cypress/views/pages/StoragePage.ts deleted file mode 100644 index 4cd62479f6..0000000000 --- a/libs/ui-lib-tests/cypress/views/pages/StoragePage.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Alert } from '../components/Alert'; - -export class StoragePage { - constructor() { - cy.get('.cluster-wizard').as(StoragePage.name); - } - - static get alias() { - return `@${StoragePage.name}`; - } - - get body() { - return cy.get(StoragePage.alias); - } - - get diskLimitationAlert() { - return new Alert(StoragePage.alias, 'diskLimitationsAlert'); - } - - get diskFormattingAlert() { - return new Alert(StoragePage.alias, 'alert-format-bootable-disks'); - } -} diff --git a/libs/ui-lib-tests/cypress/views/reusableComponents/Alert.ts b/libs/ui-lib-tests/cypress/views/reusableComponents/Alert.ts new file mode 100644 index 0000000000..c3c53e637b --- /dev/null +++ b/libs/ui-lib-tests/cypress/views/reusableComponents/Alert.ts @@ -0,0 +1,20 @@ +export class Alert { + static readonly alias = `@${Alert.name}`; + static readonly selector = '.pf-c-alert'; + + constructor(parentAlias: string, id: string = Alert.selector) { + cy.findWithinOrGet(id, parentAlias).as(Alert.name); + } + + get body() { + return cy.get(Alert.alias); + } + + get title() { + return this.body.find('.pf-c-alert__title'); + } + + get description() { + return this.body.find('.pf-c-alert__description'); + } +}