Skip to content

Commit

Permalink
Align test classes and structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jgyselov committed Jul 26, 2023
1 parent 68a5909 commit 54c32d3
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -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' },
Expand Down Expand Up @@ -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.',
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
23 changes: 0 additions & 23 deletions libs/ui-lib-tests/cypress/views/components/Alert.ts

This file was deleted.

18 changes: 18 additions & 0 deletions libs/ui-lib-tests/cypress/views/forms/Storage/StorageForm.ts
Original file line number Diff line number Diff line change
@@ -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"]');
}
}
23 changes: 0 additions & 23 deletions libs/ui-lib-tests/cypress/views/pages/StoragePage.ts

This file was deleted.

20 changes: 20 additions & 0 deletions libs/ui-lib-tests/cypress/views/reusableComponents/Alert.ts
Original file line number Diff line number Diff line change
@@ -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');
}
}

0 comments on commit 54c32d3

Please sign in to comment.