77 DUAL_LIST_ACTION_TYPE ,
88} from '../../../../support/commands/constants/command_constants.js' ;
99
10- // Component route url
11- const COMPONENT_ROUTE_URL = '/catalog/explorer' ;
12-
1310// Menu options
1411const SERVICES_MENU_OPTION = 'Services' ;
1512const CATALOGS_MENU_OPTION = 'Catalogs' ;
@@ -21,7 +18,6 @@ const DESCRIPTION_FIELD_LABEL = 'Description';
2118const CATALOG_ITEMS_HEADER = 'Catalog Items' ;
2219const DUAL_LIST_AVAILABLE_ITEMS_HEADER = 'Unassigned' ;
2320const DUAL_LIST_SELECTED_ITEMS_HEADER = 'Selected' ;
24- const REMOVE_CATALOG_MODAL_HEADER_TEXT = 'Delete' ;
2521
2622// Field values
2723const CATALOG_ITEM_NAME_1 = 'Test-Catalog-Item-1' ;
@@ -35,14 +31,12 @@ const ADD_CATALOG_ITEM_CONFIG_OPTION = 'Add a New Catalog Item';
3531const ADD_CATALOG_CONFIG_OPTION = 'Add a New Catalog' ;
3632const EDIT_CATALOG_CONFIG_OPTION = 'Edit this Item' ;
3733const REMOVE_CATALOG_CONFIG_OPTION = 'Remove Catalog' ;
38- const DELETE_CATALOG_ITEMS_CONFIG_OPTION = 'Delete Catalog Items' ;
3934
4035// Buttons
4136const ADD_BUTTON_TEXT = 'Add' ;
4237const SAVE_BUTTON_TEXT = 'Save' ;
4338const CANCEL_BUTTON_TEXT = 'Cancel' ;
4439const RESET_BUTTON_TEXT = 'Reset' ;
45- const DELETE_BUTTON_TEXT = 'Delete' ;
4640
4741// Flash message text snippets
4842const FLASH_MESSAGE_ADDED = 'added' ;
@@ -149,6 +143,10 @@ describe('Automate Catalog form operations: Services > Catalogs > Catalogs > Con
149143 cy . selectAccordionItem ( [ ALL_CATALOGS_ACCORDION_ITEM ] ) ;
150144 } ) ;
151145
146+ afterEach ( ( ) => {
147+ cy . appDbState ( 'restore' ) ;
148+ } ) ;
149+
152150 describe ( 'Validate add form fields and verify add, edit, and delete operations' , ( ) => {
153151 beforeEach ( ( ) => {
154152 cy . toolbar ( CONFIG_TOOLBAR_BUTTON , ADD_CATALOG_CONFIG_OPTION ) ;
@@ -254,59 +252,5 @@ describe('Automate Catalog form operations: Services > Catalogs > Catalogs > Con
254252 ) ;
255253 cy . expect_inline_field_errors ( { containsText : 'taken' } ) ;
256254 } ) ;
257-
258- afterEach ( ( ) => {
259- // TODO: Replace with better cleanup approach
260- cy . url ( )
261- . then ( ( url ) => {
262- // Ensures navigation to Services -> Catalogs in the UI
263- if ( ! url . endsWith ( COMPONENT_ROUTE_URL ) ) {
264- cy . visit ( COMPONENT_ROUTE_URL ) ;
265- }
266- cy . accordion ( CATALOGS_ACCORDION_ITEM ) ;
267- } )
268- . then ( ( ) => {
269- cy . selectAccordionItem ( [
270- ALL_CATALOGS_ACCORDION_ITEM ,
271- TEST_CATALOG_NAME ,
272- ] ) ;
273- cy . expect_browser_confirm_with_text ( {
274- confirmTriggerFn : ( ) =>
275- cy . toolbar ( CONFIG_TOOLBAR_BUTTON , REMOVE_CATALOG_CONFIG_OPTION ) ,
276- containsText : BROWSER_ALERT_REMOVE_CONFIRM_TEXT ,
277- } ) ;
278- } ) ;
279- } ) ;
280- } ) ;
281-
282- afterEach ( ( ) => {
283- // TODO: Replace with better cleanup approach
284- cy . url ( )
285- . then ( ( url ) => {
286- // Ensures navigation to Services -> Catalogs in the UI
287- if ( ! url . endsWith ( COMPONENT_ROUTE_URL ) ) {
288- cy . visit ( COMPONENT_ROUTE_URL ) ;
289- }
290- cy . accordion ( CATALOG_ITEMS_ACCORDION_ITEM ) ;
291- } )
292- . then ( ( ) => {
293- cy . selectAccordionItem ( [
294- ALL_CATALOG_ITEMS_ACCORDION_ITEM ,
295- UNASSIGNED_ACCORDION_ITEM ,
296- ] ) ;
297- cy . selectTableRowsByText ( {
298- textArray : [ CATALOG_ITEM_NAME_1 , CATALOG_ITEM_NAME_2 ] ,
299- } ) ;
300- cy . toolbar ( CONFIG_TOOLBAR_BUTTON , DELETE_CATALOG_ITEMS_CONFIG_OPTION ) ;
301- cy . expect_modal ( {
302- modalHeaderText : REMOVE_CATALOG_MODAL_HEADER_TEXT ,
303- modalContentExpectedTexts : [
304- 'delete' ,
305- CATALOG_ITEM_NAME_1 ,
306- CATALOG_ITEM_NAME_2 ,
307- ] ,
308- targetFooterButtonText : DELETE_BUTTON_TEXT ,
309- } ) ;
310- } ) ;
311255 } ) ;
312256} ) ;
0 commit comments