1
1
/* eslint-disable no-undef */
2
2
import { flashClassMap } from '../../../../support/assertions/assertion_constants' ;
3
3
4
- const textConstants = {
5
- // Menu options
6
- settingsMenuOption : 'Settings' ,
7
- appSettingsMenuOption : 'Application Settings' ,
8
- toolBarConfigMenu : 'Configuration' ,
9
-
10
- // added item information
11
- initialTenantName : 'Test-name' ,
12
- initialTenantDescription : 'test description' ,
13
-
14
- // List items
15
- accessControlAccordion : 'Access Control' ,
16
-
17
- // flash message assertions
18
- flashMessageOperationAdded : 'added' ,
19
- flashMessageOperationDeleted : 'delete' ,
4
+ describe ( 'Settings > Application Settings > Access Control' , ( ) => {
5
+ // Navigation
6
+ const PRIMARY_MENU_OPTION = 'Settings' ;
7
+ const SECONDARY_MENU_OPTION = 'Application Settings' ;
8
+ const ACCORDION = 'Access Control' ;
9
+ const TOOLBAR_MENU = 'Configuration' ;
20
10
21
- // Configuration menu options and browser alert text snippets
22
- deleteItem : 'Delete this item' ,
23
- }
11
+ // Created item information
12
+ const INITIAL_TENANT_NAME = 'Test-name' ;
13
+ const INITIAL_TENANT_DESCRIPTION = 'test description' ;
24
14
25
- const {
26
- accessControlAccordion,
27
- appSettingsMenuOption,
28
- deleteItem,
29
- flashMessageOperationAdded,
30
- flashMessageOperationDeleted,
31
- initialTenantDescription,
32
- initialTenantName,
33
- settingsMenuOption,
34
- toolBarConfigMenu,
35
- } = textConstants ;
15
+ // CRUD actions
16
+ const FLASH_MESSAGE_OPERATION_ADDED = 'added' ;
17
+ const FLASH_MESSAGE_OPERATION_DELETED = 'delete' ;
18
+ const DELETE_ITEM = 'Delete this item' ;
36
19
37
- describe ( 'Settings > Application Settings > Access Control' , ( ) => {
38
20
beforeEach ( ( ) => {
39
21
cy . login ( ) ;
40
- cy . menu ( settingsMenuOption , appSettingsMenuOption ) ;
41
- cy . accordion ( accessControlAccordion ) ;
22
+ cy . menu ( PRIMARY_MENU_OPTION , SECONDARY_MENU_OPTION ) ;
23
+ cy . accordion ( ACCORDION ) ;
42
24
} ) ;
43
25
44
26
it ( 'should be able to create and delete a tenant' , ( ) => {
@@ -48,22 +30,22 @@ describe('Settings > Application Settings > Access Control', () => {
48
30
'My Company' ,
49
31
] ) ;
50
32
51
- cy . toolbar ( toolBarConfigMenu , 'Add child Tenant to this Tenant' ) ;
52
- cy . getFormInputFieldById ( 'name' ) . type ( initialTenantName ) ;
53
- cy . getFormInputFieldById ( 'description' ) . type ( initialTenantDescription ) ;
33
+ cy . toolbar ( TOOLBAR_MENU , 'Add child Tenant to this Tenant' ) ;
34
+ cy . getFormInputFieldById ( 'name' ) . type ( INITIAL_TENANT_NAME ) ;
35
+ cy . getFormInputFieldById ( 'description' ) . type ( INITIAL_TENANT_DESCRIPTION ) ;
54
36
cy . getFormFooterButtonByType ( 'Add' , 'submit' ) . click ( ) ;
55
- cy . expect_flash ( flashClassMap . success , flashMessageOperationAdded ) ;
37
+ cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_OPERATION_ADDED ) ;
56
38
cy . selectAccordionItem ( [
57
39
/ ^ M a n a g e I Q R e g i o n / ,
58
40
'Tenants' ,
59
41
'My Company' ,
60
- initialTenantName
42
+ INITIAL_TENANT_NAME
61
43
] ) ;
62
44
63
45
cy . expect_browser_confirm_with_text ( {
64
- confirmTriggerFn : ( ) => cy . toolbar ( toolBarConfigMenu , deleteItem ) ,
65
- containsText : deleteItem ,
46
+ confirmTriggerFn : ( ) => cy . toolbar ( TOOLBAR_MENU , DELETE_ITEM ) ,
47
+ containsText : DELETE_ITEM ,
66
48
} ) ;
67
- cy . expect_flash ( flashClassMap . success , flashMessageOperationDeleted ) ;
49
+ cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_OPERATION_DELETED ) ;
68
50
} ) ;
69
51
} ) ;
0 commit comments