/**
  * Delete Widget Entity test.
  *
  * @param Widget $widget
  * @return void
  */
 public function test(Widget $widget)
 {
     // Precondition
     $widget->persist();
     // Steps
     $filter = ['title' => $widget->getTitle()];
     $this->widgetInstanceIndex->open();
     $this->widgetInstanceIndex->getWidgetGrid()->searchAndOpen($filter);
     $this->widgetInstanceEdit->getPageActionsBlock()->delete();
 }
 /**
  * Delete Widget on backend
  *
  * @return array
  */
 public function run()
 {
     $this->widgetInstanceIndex->open();
     $this->widgetInstanceIndex->getWidgetGrid()->resetFilter();
     while ($this->widgetInstanceIndex->getWidgetGrid()->isFirstRowVisible()) {
         $this->widgetInstanceIndex->getWidgetGrid()->openFirstRow();
         $this->widgetInstanceEdit->getTemplateBlock()->waitLoader();
         $this->widgetInstanceEdit->getPageActionsBlock()->delete();
         $this->widgetInstanceIndex->getSystemMessageDialog()->closePopup();
     }
 }
 /**
  * Assert that Widget success delete message is present
  *
  * @param WidgetInstanceIndex $widgetInstanceIndex
  * @return void
  */
 public function processAssert(WidgetInstanceIndex $widgetInstanceIndex)
 {
     $actualMessage = $widgetInstanceIndex->getMessagesBlock()->getSuccessMessage();
     \PHPUnit_Framework_Assert::assertEquals(self::DELETE_MESSAGE, $actualMessage, 'Wrong widget success delete message is displayed.');
 }
 /**
  * Assert widget availability in widget grid
  *
  * @param Widget $widget
  * @param WidgetInstanceIndex $widgetInstanceIndex
  * @return void
  */
 public function processAssert(Widget $widget, WidgetInstanceIndex $widgetInstanceIndex)
 {
     $filter = ['title' => $widget->getTitle()];
     $widgetInstanceIndex->open();
     \PHPUnit_Framework_Assert::assertTrue($widgetInstanceIndex->getWidgetGrid()->isRowVisible($filter), 'Widget with title \'' . $widget->getTitle() . '\' is absent in Widget grid.');
 }