@@ -17,7 +17,6 @@ const UNASSIGNED_ACCORDION_ITEM = 'Unassigned';
1717
1818// Config options
1919const CONFIG_TOOLBAR_BUTTON = 'Configuration' ;
20- const ADD_CATALOG_ITEM_CONFIG_OPTION = 'Add a New Catalog Item' ;
2120const COPY_CONFIG_OPTION = 'Copy Selected Item' ;
2221
2322// Field labels
@@ -31,7 +30,6 @@ const COPIED_CATALOG_ITEM_NAME = `Copy of ${CATALOG_ITEM_NAME}`;
3130
3231// Flash message text snippets
3332const FLASH_MESSAGE_INFO_TEXT = 'will not be displayed' ;
34- const FLASH_MESSAGE_ADDED = 'added' ;
3533const FLASH_MESSAGE_CANCELLED = 'cancelled' ;
3634const FLASH_MESSAGE_SAVED = 'saved' ;
3735
@@ -41,22 +39,23 @@ const CANCEL_BUTTON_TEXT = 'Cancel';
4139
4240describe ( 'Automate Catalog form operations: Services > Catalogs > Catalogs > Configuration > Add a New Catalog' , ( ) => {
4341 beforeEach ( ( ) => {
42+ cy . appFactories ( [
43+ [ 'create' , 'service_template' , { name : CATALOG_ITEM_NAME , generic_subtype : 'custom' , prov_type : 'generic' , display : true } ] ,
44+ ] ) . then ( ( results ) => {
45+ cy . appFactories ( [
46+ [ 'create' , 'resource_action' , { action : 'Provision' , resource_id : results [ 0 ] . id , resource_type : 'ServiceTemplate' } ] ,
47+ [ 'create' , 'resource_action' , { action : 'Retirement' , resource_id : results [ 0 ] . id , resource_type : 'ServiceTemplate' } ]
48+ ] )
49+ } ) ;
50+
4451 cy . login ( ) ;
4552 cy . menu ( SERVICES_MENU_OPTION , CATALOGS_MENU_OPTION ) ;
4653
47- // TODO: replace with better data setup approach
48- // Adding a catalog item
4954 cy . accordion ( CATALOG_ITEMS_ACCORDION_ITEM ) ;
5055 cy . selectAccordionItem ( [
5156 ALL_CATALOG_ITEMS_ACCORDION_ITEM ,
5257 UNASSIGNED_ACCORDION_ITEM ,
5358 ] ) ;
54- cy . toolbar ( CONFIG_TOOLBAR_BUTTON , ADD_CATALOG_ITEM_CONFIG_OPTION ) ;
55- cy . contains ( 'button[data-id="st_prov_type"]' , 'Choose' ) . click ( ) ;
56- cy . contains ( '.form-group ul.dropdown-menu li a' , 'Generic' ) . click ( ) ;
57- cy . get ( 'input#name' ) . type ( CATALOG_ITEM_NAME ) ;
58- cy . contains ( '#form_buttons_div button' , ADD_BUTTON_TEXT ) . click ( ) ;
59- cy . expect_flash ( flashClassMap . success , FLASH_MESSAGE_ADDED ) ;
6059
6160 cy . selectAccordionItem ( [
6261 ALL_CATALOG_ITEMS_ACCORDION_ITEM ,
0 commit comments