Skip to content

Commit

Permalink
OEL-450: Add test SiteBrandingBlockTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
abel-santos-corral committed Sep 7, 2021
1 parent 35eb6d8 commit 6e0a3d8
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/schema/oe_whitelabel.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
oe_whitelabel.settings:
type: theme_settings
label: 'OpenEuropa Whitelabel settings'
mapping:
schemas:
type: sequence
label: 'Schemas contained in the OE Whitelabel theme'
70 changes: 70 additions & 0 deletions tests/Functional/SiteBrandingBlockTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

declare(strict_types = 1);

namespace Drupal\Tests\oe_whitelabel\Functional;

use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\WebAssert;

/**
* Tests of Site Branding Block.
*/
class SiteBrandingBlockTest extends BrowserTestBase {

/**
* {@inheritdoc}
*/
public static $modules = [
'config',
'system',
'ui_patterns',
'ui_patterns_library',
'ui_patterns_settings',
'components',
'field_ui',
'toolbar',
'block',
];

/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';

/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();

// Enable and set OpenEuropa Whitelabel Theme as default.
\Drupal::service('theme_installer')->install(['oe_whitelabel']);
\Drupal::configFactory()
->getEditable('system.theme')
->set('default', 'oe_whitelabel')
->save();

// Rebuild the ui_pattern definitions to collect the ones provided by
// oe_whitelabel itself.
\Drupal::service('plugin.manager.ui_patterns')->clearCachedDefinitions();

}

/**
* Asserts classes contained at site branding block.
*/
public function testClassesSiteName(): void {
$this->drupalGet('<front>');
$assert_session = $this->assertSession();

$webAssert = new WebAssert($this->getSession());
$element = $webAssert->elementExists('css', 'html');
$actual = $element->getHtml();
var_dump($actual);

$assert_session->elementExists('css', 'div.site-name.h1.text-white.text-decoration-none.align-bottom');

}

}

0 comments on commit 6e0a3d8

Please sign in to comment.