77namespace EzSystems \EzPlatformAdminUi \Behat \BusinessContext ;
88
99use Behat \Gherkin \Node \TableNode ;
10+ use EzSystems \Behat \Browser \Page \Page ;
11+ use EzSystems \Behat \Browser \Factory \ElementFactory ;
12+ use EzSystems \Behat \Browser \Factory \PageObjectFactory ;
1013use EzSystems \EzPlatformAdminUi \Behat \PageElement \Dialog ;
11- use EzSystems \EzPlatformAdminUi \Behat \PageElement \ElementFactory ;
1214use EzSystems \EzPlatformAdminUi \Behat \PageObject \ObjectStateGroupPage ;
1315use EzSystems \EzPlatformAdminUi \Behat \PageObject \ObjectStateGroupsPage ;
14- use EzSystems \EzPlatformAdminUi \Behat \PageObject \Page ;
1516use EzSystems \EzPlatformAdminUi \Behat \PageObject \RolePage ;
1617use EzSystems \EzPlatformAdminUi \Behat \PageObject \RolesPage ;
1718use EzSystems \EzPlatformAdminUi \Behat \PageObject \ContentTypeGroupPage ;
1819use EzSystems \EzPlatformAdminUi \Behat \PageObject \ContentTypeGroupsPage ;
1920use EzSystems \EzPlatformAdminUi \Behat \PageObject \LanguagesPage ;
20- use EzSystems \EzPlatformAdminUi \Behat \PageObject \PageObjectFactory ;
2121use EzSystems \EzPlatformAdminUi \Behat \PageObject \SectionPage ;
2222use EzSystems \EzPlatformAdminUi \Behat \PageObject \SectionsPage ;
2323use PHPUnit \Framework \Assert ;
@@ -50,7 +50,7 @@ class AdministrationContext extends BusinessContext
5050 */
5151 public function iSeeList (string $ pageName , string $ parameter = null ): void
5252 {
53- $ contentTypeGroupsPage = PageObjectFactory::createPage ($ this ->utilityContext , $ pageName , $ parameter );
53+ $ contentTypeGroupsPage = PageObjectFactory::createPage ($ this ->browserContext , $ pageName , $ parameter );
5454 $ contentTypeGroupsPage ->verifyElements ();
5555 }
5656
@@ -65,7 +65,7 @@ public function iStartCreatingNew(string $newItemType, ?string $containerItem =
6565 if (!array_key_exists ($ newItemType , $ this ->itemCreateMapping )) {
6666 throw new \InvalidArgumentException (sprintf ('Unrecognized item type name: %s ' , $ newItemType ));
6767 }
68- PageObjectFactory::createPage ($ this ->utilityContext , $ this ->itemCreateMapping [$ newItemType ], $ containerItem )
68+ PageObjectFactory::createPage ($ this ->browserContext , $ this ->itemCreateMapping [$ newItemType ], $ containerItem )
6969 ->startCreatingItem ();
7070 }
7171
@@ -74,7 +74,7 @@ public function iStartCreatingNew(string $newItemType, ?string $containerItem =
7474 */
7575 public function iStartAssigningTo (string $ itemName , string $ pageType ): void
7676 {
77- $ pageObject = PageObjectFactory::createPage ($ this ->utilityContext , $ pageType , $ itemName );
77+ $ pageObject = PageObjectFactory::createPage ($ this ->browserContext , $ pageType , $ itemName );
7878 $ pageObject ->startAssigningToItem ($ itemName );
7979 }
8080
@@ -84,7 +84,7 @@ public function iStartAssigningTo(string $itemName, string $pageType): void
8484 */
8585 public function verifyElementOnTheList (string $ listElementName , string $ page , ?string $ parameter = null ): void
8686 {
87- $ pageElement = PageObjectFactory::createPage ($ this ->utilityContext , $ page , $ parameter );
87+ $ pageElement = PageObjectFactory::createPage ($ this ->browserContext , $ page , $ parameter );
8888 if (!$ pageElement ->adminList ->isElementOnTheList ($ listElementName )) {
8989 Assert::fail (sprintf ('Element "%s" is on the %s list. ' , $ listElementName , $ page ));
9090 }
@@ -96,7 +96,7 @@ public function verifyElementOnTheList(string $listElementName, string $page, ?s
9696 */
9797 public function verifyElementNotOnTheList (string $ listElementName , string $ page , string $ parameter = null ): void
9898 {
99- $ pageElement = PageObjectFactory::createPage ($ this ->utilityContext , $ page , $ parameter );
99+ $ pageElement = PageObjectFactory::createPage ($ this ->browserContext , $ page , $ parameter );
100100 if ($ pageElement ->adminList ->isElementOnTheList ($ listElementName )) {
101101 Assert::fail (sprintf ('Element "%s" is on the %s list. ' , $ listElementName , $ page ));
102102 }
@@ -113,7 +113,7 @@ private function verifyContentsStatus(string $itemName, string $page, bool $shou
113113 {
114114 $ emptyContainerCellValue = '0 ' ;
115115
116- $ contentsCount = PageObjectFactory::createPage ($ this ->utilityContext , $ page )
116+ $ contentsCount = PageObjectFactory::createPage ($ this ->browserContext , $ page )
117117 ->adminList ->table ->getTableCellValue ($ itemName , $ this ->emptyHeaderMapping [$ page ]);
118118
119119 $ msg = '' ;
@@ -147,7 +147,7 @@ public function isNonEmptyElementOnTheList(string $itemName, string $page): void
147147 */
148148 public function itemCannotBeSelected (string $ itemType , string $ itemName ): void
149149 {
150- $ isListElementSelectable = PageObjectFactory::createPage ($ this ->utilityContext , $ this ->itemCreateMapping [$ itemType ])
150+ $ isListElementSelectable = PageObjectFactory::createPage ($ this ->browserContext , $ this ->itemCreateMapping [$ itemType ])
151151 ->adminList ->table ->isElementSelectable ($ itemName );
152152
153153 if ($ isListElementSelectable ) {
@@ -161,7 +161,7 @@ public function itemCannotBeSelected(string $itemType, string $itemName): void
161161 */
162162 public function iGoToListItem (string $ itemName , string $ itemType , string $ itemContainer = null ): void
163163 {
164- $ pageElement = PageObjectFactory::createPage ($ this ->utilityContext , $ this ->itemCreateMapping [$ itemType ], $ itemContainer );
164+ $ pageElement = PageObjectFactory::createPage ($ this ->browserContext , $ this ->itemCreateMapping [$ itemType ], $ itemContainer );
165165 if ($ pageElement ->adminList ->isElementOnTheList ($ itemName )) {
166166 $ pageElement ->adminList ->table ->clickListElement ($ itemName );
167167 } else {
@@ -175,7 +175,7 @@ public function iGoToListItem(string $itemName, string $itemType, string $itemCo
175175 */
176176 public function iStartEditingItem (string $ itemType , string $ itemName , ?string $ containerName = null ): void
177177 {
178- PageObjectFactory::createPage ($ this ->utilityContext , $ this ->itemCreateMapping [$ itemType ], $ containerName )
178+ PageObjectFactory::createPage ($ this ->browserContext , $ this ->itemCreateMapping [$ itemType ], $ containerName )
179179 ->startEditingItem ($ itemName );
180180 }
181181
@@ -184,7 +184,7 @@ public function iStartEditingItem(string $itemType, string $itemName, ?string $c
184184 */
185185 public function iStartEditingItemFromDetails (string $ itemType , string $ itemName ): void
186186 {
187- PageObjectFactory::createPage ($ this ->utilityContext , $ itemType , $ itemName )
187+ PageObjectFactory::createPage ($ this ->browserContext , $ itemType , $ itemName )
188188 ->startEditingSelf ($ itemName );
189189 }
190190
@@ -195,7 +195,7 @@ public function iDeleteItems(string $itemType, TableNode $settings): void
195195 {
196196 $ hash = $ settings ->getHash ();
197197
198- $ page = PageObjectFactory::createPage ($ this ->utilityContext , $ this ->itemCreateMapping [$ itemType ]);
198+ $ page = PageObjectFactory::createPage ($ this ->browserContext , $ this ->itemCreateMapping [$ itemType ]);
199199 foreach ($ hash as $ setting ) {
200200 $ page ->adminList ->table ->selectListElement ($ setting ['item ' ]);
201201 }
@@ -210,7 +210,7 @@ public function iDeleteItemsFromContainer(string $itemType, ?string $containerNa
210210 {
211211 $ hash = $ settings ->getHash ();
212212
213- $ page = PageObjectFactory::createPage ($ this ->utilityContext , $ this ->itemCreateMapping [$ itemType ], $ containerName );
213+ $ page = PageObjectFactory::createPage ($ this ->browserContext , $ this ->itemCreateMapping [$ itemType ], $ containerName );
214214 foreach ($ hash as $ setting ) {
215215 $ page ->adminList ->table ->selectListElement ($ setting ['item ' ]);
216216 }
@@ -225,7 +225,7 @@ public function iDeleteItemsFromDetails(string $itemType, TableNode $settings):
225225 {
226226 $ hash = $ settings ->getHash ();
227227
228- $ page = PageObjectFactory::createPage ($ this ->utilityContext , $ itemType , $ hash [0 ]['item ' ]);
228+ $ page = PageObjectFactory::createPage ($ this ->browserContext , $ itemType , $ hash [0 ]['item ' ]);
229229 $ this ->performDeletion ($ page );
230230 }
231231
@@ -235,7 +235,7 @@ public function iDeleteItemsFromDetails(string $itemType, TableNode $settings):
235235 private function performDeletion (Page $ page )
236236 {
237237 $ page ->adminList ->clickTrashButton ();
238- $ dialog = ElementFactory::createElement ($ this ->utilityContext , Dialog::ELEMENT_NAME );
238+ $ dialog = ElementFactory::createElement ($ this ->browserContext , Dialog::ELEMENT_NAME );
239239 $ dialog ->verifyVisibility ();
240240 $ dialog ->confirm ();
241241 }
@@ -245,7 +245,7 @@ private function performDeletion(Page $page)
245245 */
246246 public function itemHasProperAttribute (string $ itemType , string $ itemName , string $ attributeName , string $ value )
247247 {
248- $ pageObject = PageObjectFactory::createPage ($ this ->utilityContext , $ itemType , $ itemName );
248+ $ pageObject = PageObjectFactory::createPage ($ this ->browserContext , $ itemType , $ itemName );
249249
250250 $ pageObject ->verifyItemAttribute ($ attributeName , $ value );
251251 }
@@ -255,7 +255,7 @@ public function itemHasProperAttribute(string $itemType, string $itemName, strin
255255 */
256256 public function linkItemHasProperAttribute (string $ itemName , string $ pageName , string $ attributeName , string $ value )
257257 {
258- $ pageObject = PageObjectFactory::createPage ($ this ->utilityContext , $ pageName );
258+ $ pageObject = PageObjectFactory::createPage ($ this ->browserContext , $ pageName );
259259 $ pageObject ->verifyItemAttribute ($ attributeName , $ value , $ itemName );
260260 }
261261
@@ -275,7 +275,7 @@ public function itemHasProperAttributes(string $itemType, string $itemName, Tabl
275275 */
276276 public function listIsEmpty (string $ listName , string $ itemType , string $ itemName ): void
277277 {
278- $ pageObject = PageObjectFactory::createPage ($ this ->utilityContext , $ itemType , $ itemName );
278+ $ pageObject = PageObjectFactory::createPage ($ this ->browserContext , $ itemType , $ itemName );
279279 $ pageObject ->verifyListIsEmpty ($ listName );
280280 }
281281}
0 commit comments