You are here

function DraggableviewsTestCase::verifyDraganddropView in DraggableViews 7

Verify that view works properly.

Parameters

string $url: URL of the view page.

string $message: Message describing the view.

1 call to DraggableviewsTestCase::verifyDraganddropView()
DraggableviewsTestCase::testNativeUnlimitedPager in draggableviews_tests/draggableviews_tests.test

File

draggableviews_tests/draggableviews_tests.test, line 38

Class

DraggableviewsTestCase

Code

function verifyDraganddropView($url, $message) {

  // Open view for testing.
  $this
    ->drupalOpenUrl($url);
  $tr_elements = $this->driver
    ->getAllElements('css=div.content tr.draggable');
  $first_element_title = $tr_elements[0]
    ->getText();
  $second_element_title = $tr_elements[1]
    ->getText();

  // Get first element draggable link.
  $first_element_drag = $this->driver
    ->getElement('css=tr.views-row-first a.tabledrag-handle');
  $size = $first_element_drag
    ->getSize();

  // Move element down on its size + 5 pixels.
  $first_element_drag
    ->dragAndDrop(0, $size['height'] + 5);

  // Wait till drag and drop warning message appear.
  $this->driver
    ->waitForElements('css=div.tabledrag-changed-warning');

  // Screenshot before we submit the form.
  $this
    ->verboseScreenshot();

  // Submit.
  $this->driver
    ->getElement('css=#edit-submit')
    ->submit();

  // Screenshot after we submitted the form.
  $this
    ->verboseScreenshot();
  $tr_elements = $this->driver
    ->getAllElements('css=div.content tr.draggable');
  $new_first_element_title = $tr_elements[0]
    ->getText();
  $new_second_element_title = $tr_elements[1]
    ->getText();
  $this
    ->assertTrue($new_first_element_title == $second_element_title && $new_second_element_title == $first_element_title, t('Rows sorted for view: !message.', array(
    '!message' => $message,
  )), 'Draggableviews');
}