示例#1
0
 /**
  * @param NodeElement $comment
  * @param string      $message
  *
  * @throws \LogicException
  */
 public function replyComment(NodeElement $comment, $message)
 {
     $comment->click();
     $replyBox = $this->getElement('Comment threads')->find('css', 'li.reply-to-comment');
     if (!$replyBox) {
         throw new \LogicException('Comment reply box not found !');
     }
     $textarea = $replyBox->find('css', 'textarea');
     if (!$textarea) {
         throw new \LogicException('Comment reply textarea not found !');
     }
     $textarea->setValue($message);
     $this->spin(function () use($replyBox) {
         $replyBox->find('css', '.send-comment')->click();
         return true;
     });
 }
示例#2
0
 /**
  * @param NodeElement $comment
  * @param string      $message
  *
  * @throws \LogicException
  */
 public function replyComment(NodeElement $comment, $message)
 {
     $comment->click();
     $replyBox = $this->getElement('Comment threads')->find('css', 'li.comment-reply-action.toggle-active');
     if (!$replyBox) {
         throw new \LogicException('Comment reply box not found !');
     }
     $textarea = $replyBox->find('css', 'textarea');
     if (!$textarea) {
         throw new \LogicException('Comment reply textarea not found !');
     }
     $textarea->setValue($message);
     $replyBox->pressButton('Reply');
 }
示例#3
0
 public function testClick()
 {
     $node = new NodeElement('link_or_button', $this->session);
     $this->driver->expects($this->once())->method('click')->with('link_or_button');
     $node->click();
 }
示例#4
0
 /**
  * Applies a specific action to an element
  *
  * @param NodeElement $element Element to act on
  * @param string $action Action, which may be one of 'hover', 'double click', 'right click', or 'left click'
  * The default 'click' behaves the same as left click
  */
 protected function interactWithElement($element, $action = 'click')
 {
     switch ($action) {
         case 'hover':
             $element->mouseOver();
             break;
         case 'double click':
             $element->doubleClick();
             break;
         case 'right click':
             $element->rightClick();
             break;
         case 'left click':
         case 'click':
         default:
             $element->click();
             break;
     }
 }
 /**
  * @param NodeElement $resource
  */
 public function toggleResource(NodeElement $resource)
 {
     $groupTitleElement = $this->spin(function () use($resource) {
         return $resource->getParent()->getParent()->getParent()->find('css', 'h3');
     }, 'Group title not found for resource.');
     $groupTitle = $groupTitleElement->getHtml();
     $this->navigateToGroup($groupTitle);
     $this->spin(function () use($resource) {
         return $resource->isVisible();
     }, sprintf('Resource is not visible on the group %s.', $groupTitle));
     $resource->click();
 }