Skip to content

Commit

Permalink
Extract StoragePage and Alert classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jgyselov committed Jul 26, 2023
1 parent 110624c commit 68a5909
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { commonActions } from '../../views/common';
import { ValidateDiskHoldersParams, hostsTableSection } from '../../views/hostsTableSection';
import { StoragePage } from '../../views/storagePage';
import { StoragePage } from '../../views/pages/StoragePage';

describe(`Assisted Installer Storage Step`, () => {
let storagePage;
Expand Down
23 changes: 23 additions & 0 deletions libs/ui-lib-tests/cypress/views/components/Alert.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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');
}
}
23 changes: 23 additions & 0 deletions libs/ui-lib-tests/cypress/views/pages/StoragePage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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');
}
}
46 changes: 0 additions & 46 deletions libs/ui-lib-tests/cypress/views/storagePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,49 +57,3 @@ export const storagePage = {
);
},
};

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');
}
}

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');
}
}

0 comments on commit 68a5909

Please sign in to comment.