Skip to content

Commit b447040

Browse files
Modified form elements validations
1 parent e1c50cb commit b447040

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

cypress/e2e/ui/Automation/Embedded-Automate/Explorer/namespace.cy.js

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ const textConstants = {
3636
editedNamespaceName: 'Test_Namespace_Edited',
3737
editedDescription: 'Test description edited',
3838
invalidNamespaceName: 'Test Namespace',
39-
addNamespaceFormHeader: 'Adding a new Automate Namespace',
40-
editNamespaceFormHeader: 'Editing Automate Namespace',
39+
namespaceFormHeader: 'Automate Namespace',
4140
namespaceFormSubHeader: 'Info',
4241

4342
// List items
@@ -83,8 +82,7 @@ const {
8382
toolbarAddNewNamespace,
8483
toolbarEditNamespace,
8584
toolbarRemoveNamespace,
86-
addNamespaceFormHeader,
87-
editNamespaceFormHeader,
85+
namespaceFormHeader,
8886
namespaceFormSubHeader,
8987
namespaceName,
9088
editedNamespaceName,
@@ -136,50 +134,50 @@ function selectAccordionTree(textValue) {
136134
}
137135

138136
function validateNamespaceFormFields(isEditForm = false) {
139-
// Validate form header visibility
140-
cy.expect_explorer_title(
141-
isEditForm
142-
? `${editNamespaceFormHeader} "${namespaceName}"`
143-
: addNamespaceFormHeader
144-
);
145-
// Validate sub header visibility
137+
// Assert form header is visible
138+
cy.expect_explorer_title(namespaceFormHeader);
139+
// Assert sub header is visible
146140
cy.get('#main-content #datastore-form-wrapper h3').contains(
147141
namespaceFormSubHeader
148142
);
149-
// Validate name-space path field visibility
143+
// Assert name-space path field label is visible
150144
cy.get(inputFieldLabelSelector(namespacePathInputFieldId)).should(
151145
'be.visible'
152146
);
147+
// Assert name-space path field is visible and disabled
153148
cy.get(inputFieldSelector(namespacePathInputFieldId))
154149
.should('be.visible')
155150
.and('be.disabled')
156-
.and(
157-
'have.value',
158-
isEditForm ? `/${domainName}/${namespaceName}` : `/${domainName}`
159-
);
160-
// Validate name field visibility
151+
.invoke('val')
152+
.should('include', domainName);
153+
// Assert name field label is visible
161154
cy.get(inputFieldLabelSelector(nameInputFieldId)).should('be.visible');
155+
// Assert name field is visible and enabled
162156
cy.get(inputFieldSelector(nameInputFieldId))
163157
.should('be.visible')
164158
.and('be.enabled');
165-
// Validate description field visibility
159+
// Assert description field label is visible
166160
cy.get(inputFieldLabelSelector(descriptionInputFieldId)).should('be.visible');
161+
// Assert description field is visible and enabled
167162
cy.get(inputFieldSelector(descriptionInputFieldId))
168163
.should('be.visible')
169164
.and('be.enabled');
170-
// Validate cancel button visibility
171-
cy.get(buttonSelector(normalButtonType))
172-
.contains(cancelButton)
173-
.should('be.visible');
174-
// Validate add/save button visibility
175-
cy.get(buttonSelector(submitButtonType))
176-
.contains(isEditForm ? saveButton : addButton)
177-
.should('be.visible');
165+
// Assert cancel button is visible and enabled
166+
cy.contains(buttonSelector(normalButtonType), cancelButton)
167+
.should('be.visible')
168+
.and('be.enabled');
169+
// Assert add/save button is visible and disabled
170+
cy.contains(
171+
buttonSelector(submitButtonType),
172+
isEditForm ? saveButton : addButton
173+
)
174+
.should('be.visible')
175+
.and('be.disabled');
178176
if (isEditForm) {
179-
// Validate reset button visibility
180-
cy.get(buttonSelector(normalButtonType))
181-
.contains(resetButton)
182-
.should('be.visible');
177+
// Assert reset button is visible and disabled
178+
cy.contains(buttonSelector(normalButtonType), resetButton)
179+
.should('be.visible')
180+
.and('be.disabled');
183181
}
184182
}
185183

0 commit comments

Comments
 (0)