You are here

public function MenuLinkWeightNodeJavascriptTest::testMenuFunctionality in Menu Link Weight 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/MenuLinkWeightNodeJavascriptTest.php \Drupal\Tests\menu_link_weight\FunctionalJavascript\MenuLinkWeightNodeJavascriptTest::testMenuFunctionality()

Tests menu functionality.

File

tests/src/FunctionalJavascript/MenuLinkWeightNodeJavascriptTest.php, line 15

Class

MenuLinkWeightNodeJavascriptTest
Tests the functionality of the Menu Link Weight module.

Namespace

Drupal\Tests\menu_link_weight\FunctionalJavascript

Code

public function testMenuFunctionality() {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalGet("/node/add/{$this->nodeType}");
  $page
    ->checkField('Provide a menu link');
  $assert_session
    ->pageTextContains('Change the weight of the links within the Tools menu');
  $select_xpath = $this
    ->cssSelectToXpath('[data-drupal-selector="edit-menu-menu-parent"]');
  $this
    ->getSession()
    ->getDriver()
    ->selectOption($select_xpath, 'tools:node.add_page');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $assert_session
    ->pageTextContains('Change the weight of the links within the Add content menu');
}