You are here

public function VarbaseContext::iDragAndDropTo in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8

Same name and namespace in other branches
  1. 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iDragAndDropTo()
  2. 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iDragAndDropTo()
  3. 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iDragAndDropTo()
  4. 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iDragAndDropTo()
  5. 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iDragAndDropTo()

Fill a text in the alert message.

Varbase Context #varbase.

Example #1: Given I drag and drop ".element-item" to ".target" Example #2: When I drag and drop "#panels-ipe-regionid-left .panels-ipe-portlet-wrapper" to "#panels-ipe-regionid-center .panels-ipe-sort-container" Example #3: And I drag and drop ".item-1" to ".target-2"

@Given /^I drag and drop "([^"]*)" to "([^"]*)"$/

File

tests/features/bootstrap/VarbaseContext.php, line 1372

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iDragAndDropTo($draggedElement, $targetElement) {
  $dragged = $this
    ->getSession()
    ->getPage()
    ->find('css', $draggedElement);
  if (empty($dragged)) {
    throw new \Exception('The selected dragged element [ ' . $draggedElement . ' ] is not in the page.');
  }
  $target = $this
    ->getSession()
    ->getPage()
    ->find('css', $targetElement);
  if (empty($target)) {
    throw new \Exception('The selected target element [ ' . $targetElement . ' ] is not in the page.');
  }
  $this
    ->getSession()
    ->getDriver()
    ->evaluateScript("jQuery('{$draggedElement}').detach().prependTo('{$targetElement}');");
}