@@ -1103,4 +1103,46 @@ public function disableStatistics()
11031103 $ this ->waitForElement (['link ' => 'Never ' ], TIMEOUT );
11041104 $ this ->click (['link ' => 'Never ' ]);
11051105 }
1106+
1107+ /**
1108+ * Create a new category
1109+ *
1110+ * @param string $title Title of the new category
1111+ * @param string $extension Optional extension to use
1112+ *
1113+ * @return void
1114+ *
1115+ * @since 3.7.5
1116+ */
1117+ public function createCategory ($ title , $ extension = '' )
1118+ {
1119+ $ this ->debug ('Category creation in /administrator/ ' );
1120+ $ this ->doAdministratorLogin ();
1121+
1122+ if (!empty ($ extension ))
1123+ {
1124+ $ extension = '&extension= ' . $ extension ;
1125+ }
1126+
1127+ $ this ->amOnPage ('administrator/index.php?option=com_categories ' . $ extension );
1128+
1129+ $ this ->waitForElement (['class ' => 'page-title ' ]);
1130+ $ this ->checkForPhpNoticesOrWarnings ();
1131+
1132+ $ this ->debug ('Click new category button ' );
1133+ $ this ->click (['class ' => 'button-new ' ]);
1134+
1135+ $ this ->waitForElement (['class ' => 'page-title ' ]);
1136+
1137+ $ this ->checkForPhpNoticesOrWarnings ();
1138+ $ this ->fillField (['id ' => 'jform_title ' ], $ title );
1139+
1140+ $ this ->debug ('Click new category apply button ' );
1141+ $ this ->click (['class ' => 'button-apply ' ]);
1142+
1143+ $ this ->debug ('see a success message after saving the category ' );
1144+
1145+ $ this ->see ('Category saved ' , ['id ' => 'system-message-container ' ]);
1146+ $ this ->checkForPhpNoticesOrWarnings ();
1147+ }
11061148}
0 commit comments