You are here

public function ParagraphsStableEditPerspectivesUiTest::testTabsVisibility in Paragraphs 8

Test if tabs are visible with no behavior elements.

File

tests/src/FunctionalJavascript/ParagraphsStableEditPerspectivesUiTest.php, line 174

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');
  $page
    ->pressButton('Save and continue');
  $edit = [
    'settings[target_type]' => 'paragraph',
  ];
  $this
    ->submitForm($edit, 'Save field settings');
  $this
    ->submitForm([], 'Save settings');
  $this
    ->drupalGet('admin/structure/types/manage/testcontent/form-display');
  $page
    ->selectFieldOption('fields[field_testparagraphfield][type]', 'paragraphs');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->submitForm([], 'Save');
  $this
    ->drupalGet('node/add/testcontent');
  $style_selector = $page
    ->find('css', '.paragraphs-tabs');
  $this
    ->assertFalse($style_selector
    ->isVisible());
}