You are here

function WebformMatrixTestCase::testWebformOutputMatrixFields in Webform Matrix Component 7.4

Test output matrix fields.

File

tests/webform_matrix_component.test, line 111
Tests for the Weform Matrix Component module.

Class

WebformMatrixTestCase
Tests for webform matrix component.

Code

function testWebformOutputMatrixFields() {
  $node = $this
    ->drupalGetNodeByTitle('Matrix node');

  // Get the node page
  $this
    ->drupalGet('node/' . $node->nid);
  for ($row = 1; $row <= 3; $row++) {

    // Assert select field with default
    $this
      ->assertFieldById('edit-submitted-matrix-' . $row . '-1', 'key2');

    // Assert textfield
    $this
      ->assertFieldById('edit-submitted-matrix-' . $row . '-2');
  }

  // Add a row button
  $this
    ->assertFieldById('edit-submitted-matrix-add-row-matrix', 'Add a row');

  // Assert some texts are present
  $this
    ->assertText(t('Matrix'));
  $this
    ->assertText(t('Select title'));
  $this
    ->assertText(t('Textfield title'));
  $this
    ->assertText(t('Date title'));
}