You are here

public function LingotekTargetActionsTest::testDropdownTargetStatuses in Lingotek Translation 4.0.x

Same name and namespace in other branches
  1. 3.6.x tests/src/FunctionalJavascript/LingotekTargetActionsTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekTargetActionsTest::testDropdownTargetStatuses()
  2. 3.7.x tests/src/FunctionalJavascript/LingotekTargetActionsTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekTargetActionsTest::testDropdownTargetStatuses()
  3. 3.8.x tests/src/FunctionalJavascript/LingotekTargetActionsTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekTargetActionsTest::testDropdownTargetStatuses()

Tests that the supported locales are rendered.

File

tests/src/FunctionalJavascript/LingotekTargetActionsTest.php, line 89

Class

LingotekTargetActionsTest
@group lingotek

Namespace

Drupal\Tests\lingotek\FunctionalJavascript

Code

public function testDropdownTargetStatuses() {
  $page = $this
    ->getSession()
    ->getPage();
  $assert_session = $this
    ->assertSession();

  // Add paragraphed content.
  $this
    ->drupalGet('node/add/article');
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['body[0][value]'] = 'Llamas are very cool';
  $this
    ->drupalPostForm(NULL, $edit, t('Save'));

  /** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
  $translationService = \Drupal::service('lingotek.content_translation');
  $this
    ->drupalGet('/lingotek_form_test/lingotek_translation_statuses/node/1');
  $buttonLocator = 'button.lingotek-target-dropdown-toggle';
  $listLocator = 'ul.lingotek-target-actions';

  // There are two dropdowns.
  $assert_session
    ->elementsCount('css', $buttonLocator, 2);
  $assert_session
    ->elementsCount('css', $listLocator, 2);
  $lists = $page
    ->findAll('css', $listLocator);
  $visibleLists = $this
    ->filterVisibleElements($lists);
  $this
    ->assertCount(0, $visibleLists);
  $button_field = $assert_session
    ->elementExists('css', $buttonLocator);
  $button_field
    ->click();
  $listShown = $this
    ->waitForVisibleElementCount(1, $listLocator);
  $this
    ->assertTrue($listShown);
  $visibleLists = $this
    ->filterVisibleElements($lists);
  $this
    ->assertCount(1, $visibleLists);
}