Skip to content

Commit 6f9f4bb

Browse files
Added detailed component testing on tenant forms
1 parent a7228a5 commit 6f9f4bb

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

cypress/e2e/ui/Settings/Application-Settings/tenant.cy.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const textConstants = {
1616
tenantsAccordionItem: 'Tenants',
1717

1818
// Field values
19+
formHeaderFragment: 'Tenant',
1920
initialParentTenantName: 'My Company',
2021
initialParentTenantDescription: 'Tenant for My Company',
2122
editedTenantNameValue: 'Test-Name',
@@ -75,6 +76,7 @@ const {
7576
tenantsAccordionItem,
7677

7778
// Field values
79+
formHeaderFragment,
7880
initialParentTenantName,
7981
initialParentTenantDescription,
8082
editedTenantNameValue,
@@ -172,6 +174,37 @@ function verifyNameAndDescriptionValues(nameValue, descriptionValue) {
172174
);
173175
}
174176

177+
function validateFormElements(isEditForm = true) {
178+
// Assert form header is visible
179+
cy.expect_explorer_title(formHeaderFragment);
180+
// Assert name field label is visible
181+
cy.getFormLabelByInputId(nameInputFieldId).should('be.visible');
182+
// Assert name field is visible and enabled
183+
cy.getFormInputFieldById(nameInputFieldId)
184+
.should('be.visible')
185+
.and('be.enabled');
186+
// Assert description field label is visible
187+
cy.getFormLabelByInputId(descriptionInputFieldId).should('be.visible');
188+
// Assert description field is visible and enabled
189+
cy.getFormInputFieldById(descriptionInputFieldId)
190+
.should('be.visible')
191+
.and('be.enabled');
192+
// Assert cancel button is visible and enabled
193+
cy.getFormFooterButtonByType(cancelButton)
194+
.should('be.visible')
195+
.and('be.enabled');
196+
if (isEditForm) {
197+
// Assert reset button is visible and disabled
198+
cy.getFormFooterButtonByType(resetButton)
199+
.should('be.visible')
200+
.and('be.disabled');
201+
}
202+
// Assert add/save button is visible and disabled
203+
cy.getFormFooterButtonByType(isEditForm ? saveButton : addButton, 'submit')
204+
.should('be.visible')
205+
.and('be.disabled');
206+
}
207+
175208
function createAndSelectChildTenant() {
176209
// Open child tenant create form
177210
cy.toolbar(configToolbarButton, addChildTenantConfigOption);
@@ -342,6 +375,11 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
342375
cy.toolbar(configToolbarButton, editTenantConfigOption);
343376
});
344377

378+
it('Validate Edit tenant form elements', () => {
379+
// Validate form fields
380+
validateFormElements();
381+
});
382+
345383
it('Validate Reset & Cancel buttons on Edit tenant form', () => {
346384
// Update name & description fields
347385
updateNameAndDescription(editedTenantNameValue, editedDescriptionValue);
@@ -477,6 +515,15 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
477515
cy.toolbar(configToolbarButton, editTenantConfigOption);
478516
});
479517

518+
it('Validate Edit child tenant form elements', () => {
519+
// Validate form fields
520+
validateFormElements();
521+
// Cancel the edit form
522+
cancelForm();
523+
// Removing the child tenant
524+
deleteAccordionItem(initialChildTenantName);
525+
});
526+
480527
it('Validate Reset & Cancel buttons on the Edit child tenent form', () => {
481528
// Update name & description fields
482529
updateNameAndDescription(editedTenantNameValue, editedDescriptionValue);

0 commit comments

Comments
 (0)