class DialogPositionTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php \Drupal\FunctionalJavascriptTests\Dialog\DialogPositionTest
Tests the JavaScript functionality of the dialog position.
@group dialog
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase implements \Drupal\Tests\BrowserTestBase
- class \Drupal\FunctionalJavascriptTests\Dialog\DialogPositionTest implements \Drupal\FunctionalJavascriptTests\WebDriverTestBase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of DialogPositionTest
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ Dialog/ DialogPositionTest.php, line 12
Namespace
Drupal\FunctionalJavascriptTests\DialogView source
class DialogPositionTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'block',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests if the dialog UI works properly with block layout page.
*/
public function testDialogOpenAndClose() {
$admin_user = $this->drupalCreateUser([
'administer blocks',
]);
$this->drupalLogin($admin_user);
$this->drupalGet('admin/structure/block');
$session = $this->getSession();
$assert_session = $this->assertSession();
$page = $session->getPage();
// Open the dialog using the place block link.
$placeBlockLink = $page->findLink('Place block');
$this->assertTrue($placeBlockLink->isVisible(), 'Place block button exists.');
$placeBlockLink->click();
$assert_session->assertWaitOnAjaxRequest();
$dialog = $page->find('css', '.ui-dialog');
$this->assertTrue($dialog->isVisible(), 'Dialog is opened after clicking the Place block button.');
// Close the dialog again.
$closeButton = $page->find('css', '.ui-dialog-titlebar-close');
$closeButton->click();
$assert_session->assertWaitOnAjaxRequest();
$dialog = $page->find('css', '.ui-dialog');
$this->assertNull($dialog, 'Dialog is closed after clicking the close button.');
// Resize the window. The test should pass after waiting for JavaScript to
// finish as no Javascript errors should have been triggered. If there were
// javascript errors the test will fail on that.
$session->resizeWindow(625, 625);
$assert_session->assertWaitOnAjaxRequest();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.