You are here

public function FlagBookmarkUITest::testUi in Flag 8.4

Browser tests for bookmark link.

File

modules/flag_bookmark/tests/src/FunctionalJavascript/FlagBookmarkUITest.php, line 41

Class

FlagBookmarkUITest
Browser tests for flag_bookmark.

Namespace

Drupal\Tests\flag_bookmark\FunctionalJavascript

Code

public function testUi() {

  // Add a single article.
  $article = $this
    ->drupalCreateNode([
    'type' => 'article',
  ]);
  $auth_user = $this
    ->drupalCreateUser([
    'flag bookmark',
    'unflag bookmark',
  ]);
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalLogin($auth_user);

  // Check the link to bookmark exist.
  $this
    ->drupalGet('node/1');
  $this
    ->clickLink('Bookmark this');

  // Observe a change in the frontpage link title.
  $bookmark_link = $assert_session
    ->waitForLink('Remove bookmark');
  $this
    ->assertNotNull($bookmark_link, 'Remove bookmark is availble on the page.');

  // Check the view is shown correctly.
  $this
    ->drupalGet('bookmarks');
  $assert_session
    ->pageTextContains($article
    ->getTitle());
}