/**
* Tests the content block listing page with different permissions.
*/
public function testListing() { // Test with the admin user.
$this->
drupalLogin($this->
drupalCreateUser(['access block library', 'administer block content'
]));
$this->
drupalGet('admin/content/block'
);
// Test for the page title.
$this->
assertSession()->
titleEquals('Content blocks | Drupal'
);
// Test for the table.
$this->
assertSession()->
elementExists('xpath', '//div[@class="layout-content"]//table'
);
// Test the table header, two cells should be present.
$this->
assertSession()->
elementsCount('xpath', '//div[@class="layout-content"]//table/thead/tr/th', 2
);
// Test the contents of each th cell.
$this->
assertSession()->
elementTextEquals('xpath', '//div[@class="layout-content"]//table/thead/tr/th[1]', 'Block description'
);
$this->
assertSession()->
elementTextEquals('xpath', '//div[@class="layout-content"]//table/thead/tr/th[2]', 'Operations'
);