diff --git a/tests/features/bootstrap/VarbaseContext.php b/tests/features/bootstrap/VarbaseContext.php index b1e05e6cd516efaf52af0d9efa68f98f3d6f861d..d42b9374021bca33afd683116125fccdb49b9607 100644 --- a/tests/features/bootstrap/VarbaseContext.php +++ b/tests/features/bootstrap/VarbaseContext.php @@ -1406,6 +1406,25 @@ JS; } } + /** + * #varbase: To check if the media browser with the selected iframe id + * is open. + * + * Example : Then the "entity_browser_iframe_media_browser" media browser should be open + * + * @Then /^the "([^"]*)" media browser should be open$/ + */ + public function theMediaBrowserIsOpen($entity_browser_iframe_id) { + if (!$elem = $this->getSession()->getPage()->find('css', '.ui-dialog.ui-widget-content')) { + throw new Exception('The media browser failed to open.'); + } + + $radioButton = $this->getSession()->getPage()->find('css', "#$entity_browser_iframe_id"); + if (!$radioButton) { + throw new \Exception("$labelText is not found."); + } + } + /** * #varbase: To find an element with a selected index having the * first attribute, and check if it's have the second one. @@ -1421,6 +1440,17 @@ JS; throw new Exception("The image position is wrong"); } } + + /** + * #varbase: Resize the current window browser to a selected width and height. + * + * Example #1: And I resize the current window to width="1280" and height="600" + * + * @Given /^I resize the current window to width="([^"]*)" and height="([^"]*)"$/ + */ + public function resizeTheCurrentWindowToWidthAndHeight($width, $height) { + $this->getSession()->resizeWindow((int)$width, (int)$height, 'current'); + } public function cleanUsers() { @@ -1473,7 +1503,7 @@ JS; /** * Maximize the window before scenario. * - * @BeforeStep @javascript + * @BeforeStep */ public function beforeStepMaximizeWindow() { $this->getSession()->getDriver()->maximizeWindow(); diff --git a/tests/features/varbase/step2-apply-tests/05-content-management/05-03-add-hero-slider-to-entityqueue-using-entityqueue-form-widget.feature b/tests/features/varbase/step2-apply-tests/05-content-management/05-03-add-hero-slider-to-entityqueue-using-entityqueue-form-widget.feature index bd1fb6ce6a4270555b2d9867b26864764e70a8ea..be7cfd94a8f0f77b2eca01d02ee9f0aa1da6c60b 100644 --- a/tests/features/varbase/step2-apply-tests/05-content-management/05-03-add-hero-slider-to-entityqueue-using-entityqueue-form-widget.feature +++ b/tests/features/varbase/step2-apply-tests/05-content-management/05-03-add-hero-slider-to-entityqueue-using-entityqueue-form-widget.feature @@ -29,7 +29,7 @@ I want to be able to add and remove entities to any allowed entity queue. Then I should see "Create Hero slider" When I press "Select media" And I wait for AJAX to finish - Then the image media browser should be open + Then the "entity_browser_iframe_media_browser" media browser should be open @javascript @local @development @staging @production Scenario: Add a Test hero slider number 1 to the heroslider entity queue. @@ -41,8 +41,9 @@ I want to be able to add and remove entities to any allowed entity queue. And I fill in "Test hero slider slide text #1" for "Slide text" And I press "Select media" And I wait for AJAX to finish - Then the image media browser should be open + Then the "entity_browser_iframe_media_browser" media browser should be open When I switch to iframe "entity_browser_iframe_media_browser" + And I wait max of 5s And I fill in "Flag Earth" for "edit-name" And I press the "Search" button And wait max of 5s @@ -73,8 +74,9 @@ I want to be able to add and remove entities to any allowed entity queue. And I fill in "Test hero slider slide text #2" for "Slide text" And I press "Select media" And I wait for AJAX to finish - Then the image media browser should be open + Then the "entity_browser_iframe_media_browser" media browser should be open When I switch to iframe "entity_browser_iframe_media_browser" + And I wait max of 5s And I fill in "Flag Earth" for "edit-name" And I press the "Search" button And wait max of 5s