1313use Ibexa \AdminUi \Behat \Component \ContentActionsMenu ;
1414use Ibexa \AdminUi \Behat \Component \ContentItemAdminPreview ;
1515use Ibexa \AdminUi \Behat \Component \ContentTypePicker ;
16+ use Ibexa \AdminUi \Behat \Component \CreateUrlAliasForm ;
1617use Ibexa \AdminUi \Behat \Component \DeleteContentDialog ;
1718use Ibexa \AdminUi \Behat \Component \Dialog ;
1819use Ibexa \AdminUi \Behat \Component \IbexaDropdown ;
1920use Ibexa \AdminUi \Behat \Component \LanguagePicker ;
2021use Ibexa \AdminUi \Behat \Component \SubItemsList ;
22+ use Ibexa \AdminUi \Behat \Component \Table \TableBuilder ;
2123use Ibexa \AdminUi \Behat \Component \TranslationDialog ;
2224use Ibexa \AdminUi \Behat \Component \UniversalDiscoveryWidget ;
2325use Ibexa \AdminUi \Behat \Component \UpperMenu ;
@@ -85,6 +87,10 @@ class ContentViewPage extends Page
8587
8688 private DeleteContentDialog $ deleteContentDialog ;
8789
90+ private CreateUrlAliasForm $ createUrlAliasForm ;
91+
92+ private TableBuilder $ tableBuilder ;
93+
8894 public function __construct (
8995 Session $ session ,
9096 Router $ router ,
@@ -101,7 +107,9 @@ public function __construct(
101107 UniversalDiscoveryWidget $ universalDiscoveryWidget ,
102108 IbexaDropdown $ ibexaDropdown ,
103109 UpperMenu $ upperMenu ,
104- DeleteContentDialog $ deleteContentDialog
110+ DeleteContentDialog $ deleteContentDialog ,
111+ CreateUrlAliasForm $ createUrlAliasForm ,
112+ TableBuilder $ tableBuilder
105113 ) {
106114 parent ::__construct ($ session , $ router );
107115 $ this ->contentActionsMenu = $ contentActionsMenu ;
@@ -118,6 +126,8 @@ public function __construct(
118126 $ this ->ibexaDropdown = $ ibexaDropdown ;
119127 $ this ->upperMenu = $ upperMenu ;
120128 $ this ->deleteContentDialog = $ deleteContentDialog ;
129+ $ this ->createUrlAliasForm = $ createUrlAliasForm ;
130+ $ this ->tableBuilder = $ tableBuilder ;
121131 }
122132
123133 public function startCreatingContent (string $ contentTypeName , string $ language = null )
@@ -294,6 +304,19 @@ public function isBookmarked(): bool
294304 return $ this ->getHTMLPage ()->find ($ this ->getLocator ('isBookmarked ' ))->isVisible ();
295305 }
296306
307+ public function createNewDirectUrlAlias (string $ path , string $ languageName , bool $ isRedirecting ): void
308+ {
309+ $ this ->getHTMLPage ()->find ($ this ->getLocator ('addUrlAliasButton ' ))->click ();
310+ $ this ->createUrlAliasForm ->createNewUrlAlias ($ path , $ languageName , $ isRedirecting );
311+ }
312+
313+ public function isUrlAliasOnTheList (string $ path , string $ type ): bool
314+ {
315+ $ customUrlAliasesTable = $ this ->tableBuilder ->newTable ()->withParentLocator ($ this ->getLocator ('customUrlAliasesTable ' ))->build ();
316+
317+ return $ customUrlAliasesTable ->hasElement (['URL ' => $ path , 'Type ' => $ type ]);
318+ }
319+
297320 protected function specifyLocators (): array
298321 {
299322 return [
@@ -308,6 +331,8 @@ protected function specifyLocators(): array
308331 new VisibleCSSLocator ('ibexaDropdownPreview ' , '.ibexa-raw-content-title__language-form .ibexa-dropdown__selection-info ' ),
309332 new VisibleCSSLocator ('moreTab ' , '.ibexa-tabs__tab--more ' ),
310333 new VisibleCSSLocator ('popupMenuItem ' , '.ibexa-popup-menu__item .ibexa-popup-menu__item-content ' ),
334+ new VisibleCSSLocator ('addUrlAliasButton ' , '#ibexa-tab-location-view-urls [data-bs-target="#ibexa-modal--custom-url-alias"] ' ),
335+ new VisibleCSSLocator ('customUrlAliasesTable ' , '#ibexa-tab-location-view-urls .ibexa-table ' ),
311336 ];
312337 }
313338
0 commit comments