public function ComponentAttributeTest::testManageComponentAttributesFormPermissions in Layout Builder Component Attributes 1.0.x
Same name and namespace in other branches
- 1.2.x tests/src/FunctionalJavascript/ComponentAttributeTest.php \Drupal\Tests\layout_builder_component_attributes\FunctionalJavascript\ComponentAttributeTest::testManageComponentAttributesFormPermissions()
- 1.1.x tests/src/FunctionalJavascript/ComponentAttributeTest.php \Drupal\Tests\layout_builder_component_attributes\FunctionalJavascript\ComponentAttributeTest::testManageComponentAttributesFormPermissions()
Tests permissions are enforced.
File
- tests/
src/ FunctionalJavascript/ ComponentAttributeTest.php, line 87
Class
- ComponentAttributeTest
- Class ComponentAttributeTest.
Namespace
Drupal\Tests\layout_builder_component_attributes\FunctionalJavascriptCode
public function testManageComponentAttributesFormPermissions() {
$this
->getSession()
->resizeWindow(1200, 2000);
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
$this
->drupalLogin($this->auth_user);
$this
->drupalGet(static::FIELD_UI_PREFIX . '/display/default/layout');
$this
->resetLayoutBuilderLayout();
$this
->assertEmpty($page
->findAll('xpath', '//*[contains(@class, "layout-builder-block")]//ul[contains(@class, "contextual-links")]//a[contains(text(), "Manage attributes")]', 'Manage attributes link is not rendered.'));
$this
->drupalLogin($this->admin_user);
$this
->drupalGet(static::FIELD_UI_PREFIX . '/display/default/layout');
// Wait for contextual links to load.
$assert_session
->assertWaitOnAjaxRequest();
$this
->assertNotEmpty($page
->findAll('xpath', '//*[contains(@class, "layout-builder-block")]//ul[contains(@class, "contextual-links")]//a[contains(text(), "Manage attributes")]', 'Manage attributes link is rendered'));
}