Issue #3281439 by nod_, Spokje, deviantintegral, _shY, andregp, lauriii: Update Help Topics tests to not use Bartik and Seven

(cherry picked from commit 0ec67661c0)
merge-requests/2359/merge
catch 2022-07-25 12:11:07 +09:00
parent 4c29de46d4
commit b039939b24
5 changed files with 44 additions and 12 deletions

View File

@ -0,0 +1,29 @@
langcode: en
status: true
dependencies:
module:
- search
- system
theme:
- claro
enforced:
config:
- search.page.help_search
id: claro_help_search
theme: claro
region: help
weight: -4
provider: null
plugin: search_form_block
settings:
id: search_form_block
label: 'Search help'
label_display: visible
provider: search
page_id: help_search
visibility:
request_path:
id: request_path
negate: false
context_mapping: { }
pages: /admin/help

View File

@ -57,14 +57,13 @@ class HelpTopicTest extends BrowserTestBase {
protected function setUp(): void {
parent::setUp();
// These tests rely on some markup from the 'Seven' theme and we test theme
// These tests rely on some markup from the 'stark' theme and we test theme
// provided help topics.
\Drupal::service('theme_installer')->install(['seven', 'help_topics_test_theme']);
\Drupal::service('config.factory')->getEditable('system.theme')->set('admin', 'seven')->save();
\Drupal::service('theme_installer')->install(['help_topics_test_theme']);
// Place various blocks.
$settings = [
'theme' => 'seven',
'theme' => 'stark',
'region' => 'help',
];
$this->placeBlock('help_block', $settings);
@ -173,7 +172,7 @@ class HelpTopicTest extends BrowserTestBase {
// Verify page information.
$name = $info['name'];
$session->titleEquals($name . ' | Drupal');
$session->responseContains('<h1 class="page-title">' . $name . '</h1>');
$session->responseContains('<h1>' . $name . '</h1>');
foreach ($info['tags'] as $tag) {
$session->responseHeaderContains('X-Drupal-Cache-Tags', $tag);
}

View File

@ -30,15 +30,16 @@ abstract class HelpTopicTranslatedTestBase extends BrowserTestBase {
protected function setUp(): void {
parent::setUp();
// These tests rely on some markup from the 'Seven' theme.
\Drupal::service('theme_installer')->install(['seven']);
// These tests rely on some markup from the 'Claro' theme, as well as an
// optional block added when Claro is enabled.
\Drupal::service('theme_installer')->install(['claro']);
\Drupal::configFactory()->getEditable('system.theme')
->set('admin', 'seven')
->set('admin', 'claro')
->save(TRUE);
// Place various blocks.
$settings = [
'theme' => 'seven',
'theme' => 'claro',
'region' => 'help',
];
$this->placeBlock('help_block', $settings);

View File

@ -71,7 +71,7 @@ class HelpTopicsSyntaxTest extends BrowserTestBase {
// test can continue.
$this->assertArrayHasKey('system', $directories, 'System module is being scanned');
$this->assertArrayHasKey('help', $directories, 'Help module is being scanned');
$this->assertArrayHasKey('seven', $directories, 'Seven theme is being scanned');
$this->assertArrayHasKey('claro', $directories, 'Claro theme is being scanned');
$this->assertArrayHasKey('standard', $directories, 'Standard profile is being scanned');
$definitions = (new HelpTopicDiscovery($directories))->getDefinitions();

View File

@ -1133,9 +1133,12 @@ class WebAssert extends MinkWebAssert {
$aria_label = 'Warning message';
}
if ($message && $aria_label) {
$selector = $this->buildXPathQuery($selector . '//div[contains(@aria-label, :aria_label) and contains(., :message)]', [
if ($message && $aria_label && $type) {
$selector = $this->buildXPathQuery($selector . '//div[(contains(@aria-label, :aria_label) or contains(@aria-labelledby, :type)) and contains(., :message)]', [
// Value of the 'aria-label' attribute, used in Seven and Bartik
':aria_label' => $aria_label,
// Value of the 'aria-labelledby' attribute, used in Claro and Olivero.
':type' => $type,
':message' => $message,
]);
}