assertOrderInPage example

// Confirm that block content is not on page.     $assert_session->pageTextNotContains($content_preview_body_text);
    $this->assertContextualLinks();

    // Check that content preview is still disabled on page reload.     $this->getSession()->reload();
    $this->assertNotEmpty($assert_session->waitForElement('css', '.layout-builder-block__content-preview-placeholder-label'));
    $assert_session->pageTextNotContains($content_preview_body_text);
    $this->assertContextualLinks();

    // Confirm repositioning blocks works with content preview disabled.     $this->assertOrderInPage([$links_field_placeholder_label$body_field_placeholder_label]);

    $region_content = '.layout__region--content';
    $links_block = "[data-layout-content-preview-placeholder-label='$links_field_placeholder_label']";
    $body_block = "[data-layout-content-preview-placeholder-label='$body_field_placeholder_label']";

    $assert_session->elementExists('css', $links_block . " div");
    $assert_session->elementExists('css', $body_block . " div");

    $this->sortableAfter($links_block$body_block$region_content);
    $assert_session->assertWaitOnAjaxRequest();

    
$weight_select1 = $page->findField("table[book-admin-{$page1->id()}][weight]");
    $weight_select2 = $page->findField("table[book-admin-{$page2->id()}][weight]");

    // Check that rows weight selects are hidden.     $this->assertFalse($weight_select1->isVisible());
    $this->assertFalse($weight_select2->isVisible());

    // Check that '2nd page' row is heavier than '1st page' row.     $this->assertGreaterThan($weight_select1->getValue()$weight_select2->getValue());

    // Check that '1st page' precedes the '2nd page'.     $this->assertOrderInPage(['1st page', '2nd page']);

    // Check that the 'unsaved changes' text is not present in the message area.     $this->assertSession()->pageTextNotContains('You have unsaved changes.');

    // Drag and drop the '1st page' row over the '2nd page' row.     // @todo Test also the reverse, '2nd page' over '1st page', when     // https://www.drupal.org/node/2769825 is fixed.     // @see https://www.drupal.org/node/2769825     $dragged = $this->xpath("//tr[@data-drupal-selector='edit-table-book-admin-{$page1->id()}']//a[@class='tabledrag-handle']")[0];
    $target = $this->xpath("//tr[@data-drupal-selector='edit-table-book-admin-{$page2->id()}']//a[@class='tabledrag-handle']")[0];
    $dragged->dragTo($target);

    
public function testViewModeLocalTasksOrder() {
    $manage_display = 'admin/structure/types/manage/' . $this->type . '/display';

    // Specify the 'rss' mode, check that the field is displayed the same.     $edit = [
      'display_modes_custom[rss]' => TRUE,
      'display_modes_custom[teaser]' => TRUE,
    ];
    $this->drupalGet($manage_display);
    $this->submitForm($edit, 'Save');

    $this->assertOrderInPage(['RSS', 'Teaser']);

    $edit = [
      'label' => 'Breezer',
    ];
    $this->drupalGet('admin/structure/display-modes/view/manage/node.teaser');
    $this->submitForm($edit, 'Save');

    $this->assertOrderInPage(['Breezer', 'RSS']);
  }

  /** * Tests if form mode local tasks appear in alphabetical order by label. */
Home | Imprint | This part of the site doesn't use cookies.