public function ParagraphsStableEditPerspectivesUiTest::testTabsVisibility

Test if tabs are visible with no behavior elements.

File

paragraphs/tests/src/FunctionalJavascript/ParagraphsStableEditPerspectivesUiTest.php, line 177

Class

ParagraphsStableEditPerspectivesUiTest
Test paragraphs user interface.

Namespace

Drupal\Tests\paragraphs\FunctionalJavascript

Code

public function testTabsVisibility() {
  $this
    ->loginAsAdmin([
    'access content overview',
  ]);
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalGet('admin/structure/paragraphs_type/add');
  $page
    ->fillField('label', 'TestPlugin');
  $this
    ->assertSession()
    ->waitForElementVisible('css', '#edit-name-machine-name-suffix .link');
  $page
    ->pressButton('Edit');
  $page
    ->fillField('id', 'testplugin');
  $page
    ->pressButton('Save and manage fields');
  $this
    ->drupalGet('admin/structure/types/add');
  $page
    ->fillField('name', 'TestContent');
  $this
    ->assertSession()
    ->waitForElementVisible('css', '#edit-name-machine-name-suffix .link');
  $page
    ->pressButton('Edit');
  $page
    ->fillField('type', 'testcontent');
  $page
    ->pressButton('Save and manage fields');
  $this
    ->drupalGet('admin/structure/types/manage/testcontent/fields/add-field');
  $page
    ->selectFieldOption('new_storage_type', 'field_ui:entity_reference_revisions:paragraph');
  $page
    ->fillField('label', 'testparagraphfield');
  $this
    ->assertSession()
    ->waitForElementVisible('css', '#edit-name-machine-name-suffix .link');
  $page
    ->pressButton('Edit');
  $page
    ->fillField('field_name', 'testparagraphfield');
  if ($this
    ->coreVersion('10.2')) {
    $page
      ->pressButton('Continue');
    $edit = [
      'field_storage[subform][settings][target_type]' => 'paragraph',
    ];
    $this
      ->submitForm($edit, 'Save settings');
  }
  else {
    $page
      ->pressButton('Save and continue');
    $edit = [
      'settings[target_type]' => 'paragraph',
    ];
    $this
      ->submitForm($edit, 'Save field settings');
    $this
      ->submitForm([], 'Save settings');
  }
  $this
    ->drupalGet('node/add/testcontent');
  $style_selector = $page
    ->find('css', '.paragraphs-tabs');
  $this
    ->assertFalse($style_selector
    ->isVisible());
}