|
| 1 | +/** |
| 2 | + * Page object for Registered Model Details page |
| 3 | + * Handles interactions with model properties, labels, and metadata editing |
| 4 | + */ |
| 5 | + |
| 6 | +class RegisteredModelDetails { |
| 7 | + // Properties section |
| 8 | + findPropertiesExpandableSection() { |
| 9 | + return cy.findByTestId('properties-expandable-section').first(); |
| 10 | + } |
| 11 | + |
| 12 | + findPropertiesTable() { |
| 13 | + return cy.findByTestId('properties-table'); |
| 14 | + } |
| 15 | + |
| 16 | + findAddPropertyButton() { |
| 17 | + return cy.findByTestId('add-property-button'); |
| 18 | + } |
| 19 | + |
| 20 | + findPropertyKeyInput() { |
| 21 | + return cy.findByTestId('add-property-key-input'); |
| 22 | + } |
| 23 | + |
| 24 | + findPropertyValueInput() { |
| 25 | + return cy.findByTestId('add-property-value-input'); |
| 26 | + } |
| 27 | + |
| 28 | + findSavePropertyButton() { |
| 29 | + return cy.findByTestId('save-edit-button-property'); |
| 30 | + } |
| 31 | + |
| 32 | + findDiscardPropertyButton() { |
| 33 | + return cy.findByTestId('discard-edit-button-property'); |
| 34 | + } |
| 35 | + |
| 36 | + findPropertiesToggleButton() { |
| 37 | + return this.findPropertiesExpandableSection().find('button[aria-expanded]').first(); |
| 38 | + } |
| 39 | + |
| 40 | + ensurePropertiesExpanded() { |
| 41 | + this.findPropertiesToggleButton() |
| 42 | + .scrollIntoView() |
| 43 | + .then(($btn) => { |
| 44 | + if ($btn.attr('aria-expanded') === 'false') { |
| 45 | + cy.wrap($btn).click(); |
| 46 | + } |
| 47 | + }); |
| 48 | + this.findPropertiesExpandableSection() |
| 49 | + .find('.pf-v6-c-expandable-section__content') |
| 50 | + .first() |
| 51 | + .should('not.have.css', 'visibility', 'hidden'); |
| 52 | + } |
| 53 | + |
| 54 | + findExpandPropertiesButton() { |
| 55 | + return cy.findByTestId('expand-control-button'); |
| 56 | + } |
| 57 | + |
| 58 | + // Helper to add a custom property |
| 59 | + addCustomProperty(key: string, value: string) { |
| 60 | + this.findPropertiesExpandableSection().click(); |
| 61 | + this.findAddPropertyButton().click(); |
| 62 | + this.findPropertyKeyInput().type(key); |
| 63 | + this.findPropertyValueInput().type(value); |
| 64 | + this.findSavePropertyButton().click(); |
| 65 | + } |
| 66 | + |
| 67 | + // Helper to verify custom property exists |
| 68 | + shouldHaveCustomProperty(key: string, value: string) { |
| 69 | + this.findPropertiesExpandableSection().within(() => { |
| 70 | + cy.contains(key).should('be.visible'); |
| 71 | + cy.contains(value).should('be.visible'); |
| 72 | + }); |
| 73 | + return this; |
| 74 | + } |
| 75 | + |
| 76 | + // Labels section |
| 77 | + findLabel(labelText: string) { |
| 78 | + return cy.findByTestId('label').contains(labelText); |
| 79 | + } |
| 80 | + |
| 81 | + findLabelGroup() { |
| 82 | + return cy.findByTestId('popover-label-group'); |
| 83 | + } |
| 84 | + |
| 85 | + findModalLabelGroup() { |
| 86 | + return cy.findByTestId('modal-label-group'); |
| 87 | + } |
| 88 | + |
| 89 | + // Helper to verify label exists |
| 90 | + shouldHaveLabel(labelText: string) { |
| 91 | + cy.contains(labelText).should('be.visible'); |
| 92 | + return this; |
| 93 | + } |
| 94 | +} |
| 95 | + |
| 96 | +export const registeredModelDetails = new RegisteredModelDetails(); |
0 commit comments