Skip to content

Commit f59a514

Browse files
Added detailed component testing on tenant forms
1 parent 1cb6d19 commit f59a514

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

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

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

1717
// Field values
18+
formHeaderFragment: 'Tenant',
1819
initialParentTenantName: 'My Company',
1920
initialParentTenantDescription: 'Tenant for My Company',
2021
editedTenantNameValue: 'Test-Name',
@@ -79,6 +80,7 @@ const {
7980
tenantsAccordionItem,
8081

8182
// Field values
83+
formHeaderFragment,
8284
initialParentTenantName,
8385
initialParentTenantDescription,
8486
editedTenantNameValue,
@@ -181,6 +183,37 @@ function verifyNameAndDescriptionValues(nameValue, descriptionValue) {
181183
);
182184
}
183185

186+
function validateFormElements(isEditForm = true) {
187+
// Assert form header is visible
188+
cy.expect_explorer_title(formHeaderFragment);
189+
// Assert name field label is visible
190+
cy.getFormLabelByInputId(nameInputFieldId).should('be.visible');
191+
// Assert name field is visible and enabled
192+
cy.getFormInputFieldById(nameInputFieldId)
193+
.should('be.visible')
194+
.and('be.enabled');
195+
// Assert description field label is visible
196+
cy.getFormLabelByInputId(descriptionInputFieldId).should('be.visible');
197+
// Assert description field is visible and enabled
198+
cy.getFormInputFieldById(descriptionInputFieldId)
199+
.should('be.visible')
200+
.and('be.enabled');
201+
// Assert cancel button is visible and enabled
202+
cy.getFormFooterButtonByType(cancelButton)
203+
.should('be.visible')
204+
.and('be.enabled');
205+
if (isEditForm) {
206+
// Assert reset button is visible and disabled
207+
cy.getFormFooterButtonByType(resetButton)
208+
.should('be.visible')
209+
.and('be.disabled');
210+
}
211+
// Assert add/save button is visible and disabled
212+
cy.getFormFooterButtonByType(isEditForm ? saveButton : addButton, 'submit')
213+
.should('be.visible')
214+
.and('be.disabled');
215+
}
216+
184217
function createAndSelectChildTenant() {
185218
// Open child tenant create form
186219
cy.toolbar(configToolbarButton, addChildTenantConfigOption);
@@ -313,6 +346,7 @@ function rollbackQuotas() {
313346
describe('Automate Tenant form operations: Settings > Application Settings > Access Control > Tenants', () => {
314347
beforeEach(() => {
315348
cy.login();
349+
cy.wait(500);
316350
// Navigate to Settings -> Application-Settings in the UI
317351
cy.menu(settingsMenuOption, appSettingsMenuOption);
318352
// Expand Access-Control accordion
@@ -349,6 +383,10 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
349383
cy.toolbar(configToolbarButton, editTenantConfigOption);
350384
});
351385

386+
it('Validate Edit tenant form elements', () => {
387+
validateFormElements();
388+
});
389+
352390
it('Validate Reset & Cancel buttons on Edit tenant form', () => {
353391
// Update name & description fields
354392
updateNameAndDescription(editedTenantNameValue, editedDescriptionValue);
@@ -427,6 +465,10 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
427465
cy.toolbar(configToolbarButton, addChildTenantConfigOption);
428466
});
429467

468+
it('Validate Add child tenant form elements', () => {
469+
validateFormElements(false);
470+
});
471+
430472
it('Validate cancel button on Add child tenant form', () => {
431473
// Cancel the add operation
432474
cancelForm();
@@ -481,6 +523,14 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
481523
cy.toolbar(configToolbarButton, editTenantConfigOption);
482524
});
483525

526+
it('Validate Edit child tenant form elements', () => {
527+
validateFormElements();
528+
// Cancel the edit form
529+
cancelForm();
530+
// Removing the child tenant
531+
deleteAccordionItem(initialChildTenantName);
532+
});
533+
484534
it('Validate Reset & Cancel buttons on the Edit child tenent form', () => {
485535
// Update name & description fields
486536
updateNameAndDescription(editedTenantNameValue, editedDescriptionValue);

0 commit comments

Comments
 (0)