3 namespace Drupal\Tests\config\Functional;
5 use Drupal\Tests\BrowserTestBase;
6 use Drupal\user\Entity\Role;
9 * Tests draggable list builder.
13 class ConfigDraggableListBuilderTest extends BrowserTestBase {
18 public static $modules = ['config_test'];
21 * Test draggable lists.
23 public function testDraggableList() {
24 $this->drupalLogin($this->drupalCreateUser(['administer permissions']));
26 // Create more than 50 roles.
27 for ($i = 0; $i < 51; $i++) {
28 $role = Role::create([
35 // Navigate to Roles page
36 $this->drupalGet('admin/people/roles');
38 // Test for the page title.
39 $this->assertSession()->titleEquals(t('Roles') . ' | Drupal');
41 // Count the number of rows in table.
42 $rows = $this->xpath('//form[@class="user-admin-roles-form"]/table/tbody/tr');
43 $this->assertGreaterThan(50, count($rows));
44 for ($i = 0; $i < 51; $i++) {
45 $this->assertSession()->pageTextContains("Role $i");