Skip to content

Commit

Permalink
add selector
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Oct 20, 2023
1 parent c5ce118 commit 2b5c945
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/EventSubscriber/EventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public function onKernelRequest(RequestEvent $event) {
* Redirect the user.
*/
protected static function redirectUser() {
return false;
$current_user = \Drupal::currentUser();
$cache = \Drupal::cache();

Expand Down
2 changes: 1 addition & 1 deletion tests/codeception/acceptance/Content/EventsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function testListIntro(AcceptanceTester $I) {
$I->amOnPage('/admin/config/importers/events-importer');
$I->fillField('No Results Message', $message);
$I->click('Save');
$I->canSee('Events Importer has been');
$I->canSee('Events Importer has been', '.messages-list');

$I->amOnPage($event->toUrl('delete-form')->toString());
$I->click('Delete');
Expand Down
14 changes: 10 additions & 4 deletions tests/codeception/acceptance/Content/SearchBlockCest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Drupal\config_pages\Entity\ConfigPages;
use Faker\Factory;

/**
Expand All @@ -16,6 +17,12 @@ public function __construct() {
$this->faker = Factory::create();
}

public function __before(){
if($cp = ConfigPages::load('stanford_basic_site_settings')){
$cp->delete();
}
}

/**
* Site managers should be able to disable the search block.
*/
Expand All @@ -26,8 +33,7 @@ public function testHideSearchBlock(AcceptanceTester $I) {
], 'taxonomy_term');

$I->logInWithRole('site_manager');
$I->amOnPage('/');
$I->seeElement('.su-site-search__input');

$I->amOnPage('/admin/config/system/basic-site-settings');
$I->see('Hide Site Search');
$I->checkOption('Hide Site Search');
Expand All @@ -37,14 +43,14 @@ public function testHideSearchBlock(AcceptanceTester $I) {
$I->selectOption('Organization', $org_term->id());
$I->click('Save');
// The settings might have been created or updated.
$I->see('Site Settings has been');
$I->see('Site Settings has been', '.messages-list');
$I->amOnPage('/');
$I->dontSeeElement('.su-site-search__input');

$I->amOnPage('/admin/config/system/basic-site-settings');
$I->uncheckOption('Hide Site Search');
$I->click('Save');
$I->canSee('Site Settings has been');
$I->canSee('Site Settings has been', '.messages-list');
$I->amOnPage('/');
$I->seeElement('.su-site-search__input');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public function testFormSettings(AcceptanceTester $I) {
$I->fillField('URL', '<front>');
$I->fillField('Link text', 'Action link');
$I->click('Save');
$I->see('Global Message has been', '.messages-list');

$I->amOnPage("/");
$I->seeElement(".su-alert--success");
$I->canSee("MESSAGE LABEL");
Expand All @@ -58,6 +60,8 @@ public function testFormSettings(AcceptanceTester $I) {
$I->amOnPage('/admin/config/system/global-message');
$I->selectOption("#edit-su-global-msg-type", "error");
$I->click('Save');
$I->see('Global Message has been', '.messages-list');

$I->amOnPage("/");
$I->seeElement(".su-alert--error");
}
Expand Down
12 changes: 10 additions & 2 deletions tests/codeception/acceptance/LocalFooter/LocalFooterCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public function testCustomLocalFooter(AcceptanceTester $I) {
$I->checkOption('Enabled');
$I->selectOption('Country', 'United States');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->selectOption('State', 'New York');
$fields = [
'Company' => 'Drupal',
Expand All @@ -67,6 +69,7 @@ public function testCustomLocalFooter(AcceptanceTester $I) {
}

$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee('123 Drupal Dr');
Expand All @@ -83,6 +86,7 @@ public function testCustomLocalFooter(AcceptanceTester $I) {
$I->amOnPage('/admin/config/system/local-footer');
$I->uncheckOption('Enabled');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->cantSee('123 Drupal Dr');
Expand All @@ -99,6 +103,8 @@ public function testCustomContentLocalFooter(AcceptanceTester $I) {
$I->fillField("#edit-su-local-foot-se-co-0-value", "<p>Block two</p>");
$I->fillField("#edit-su-local-foot-tr-co-0-value", "<p>Block three</p>");
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee('Block one');
$I->canSee('Block two');
Expand All @@ -119,7 +125,8 @@ public function testNodeRoutesAndNoLink(AcceptanceTester $I) {
$I->fillField('su_local_foot_primary[0][uri]', $node->label() . " ({$node->id()})");
$I->fillField('su_local_foot_primary[0][title]', $node->label());
$I->click('Save');
$I->canSee('Local Footer has been');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSeeLink($node->label(), $node->toUrl()->toString());

Expand All @@ -129,7 +136,8 @@ public function testNodeRoutesAndNoLink(AcceptanceTester $I) {
$I->fillField('su_local_foot_primary[0][uri]', '<nolink>');
$I->fillField('su_local_foot_primary[0][title]', 'NO LINK');
$I->click('Save');
$I->canSee('Local Footer has been');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee('NO LINK', 'li span');
}
Expand Down
28 changes: 28 additions & 0 deletions tests/codeception/acceptance/LocalFooter/LocalFooterLockupCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public function testLockupSettingsA(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Last line full width option");
Expand All @@ -73,6 +75,8 @@ public function testLockupSettingsB(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand All @@ -94,6 +98,8 @@ public function testLockupSettingsD(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Tertiary title line");
Expand All @@ -115,6 +121,8 @@ public function testLockupSettingsE(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand All @@ -137,6 +145,8 @@ public function testLockupSettingsH(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Organization name");
Expand All @@ -159,6 +169,8 @@ public function testLockupSettingsI(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Organization name");
Expand All @@ -181,6 +193,8 @@ public function testLockupSettingsM(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand All @@ -202,6 +216,8 @@ public function testLockupSettingsO(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Organization name");
}
Expand All @@ -222,6 +238,8 @@ public function testLockupSettingsP(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Organization name");
Expand All @@ -243,6 +261,8 @@ public function testLockupSettingsR(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Last line full width option");
}
Expand All @@ -263,6 +283,8 @@ public function testLockupSettingsS(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand All @@ -285,6 +307,8 @@ public function testLockupSettingsT(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand Down Expand Up @@ -319,6 +343,8 @@ public function testLogoWithLockup(AcceptanceTester $I) {
$I->click('Upload');

$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->seeElement(".su-lockup__custom-logo");
$I->assertNotEmpty($I->grabAttributeFrom('.su-lockup__custom-logo', 'alt'));
Expand Down Expand Up @@ -353,6 +379,8 @@ public function testLogoWithOutLockup(AcceptanceTester $I) {
$I->click('Upload');

$I->click('Save');
$I->see('Local Footer has been', '.messages-list');

$I->amOnPage('/');
$I->seeElement(".su-lockup__custom-logo");
$I->cantSee("Site title line");
Expand Down
28 changes: 28 additions & 0 deletions tests/codeception/acceptance/LockupSettings/LockupSettingsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public function testLockupSettingsA(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Last line full width option");
Expand All @@ -82,6 +84,8 @@ public function testLockupSettingsB(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand All @@ -103,6 +107,8 @@ public function testLockupSettingsD(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Tertiary title line");
Expand All @@ -124,6 +130,8 @@ public function testLockupSettingsE(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand All @@ -146,6 +154,8 @@ public function testLockupSettingsH(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Organization name");
Expand All @@ -168,6 +178,8 @@ public function testLockupSettingsI(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Organization name");
Expand All @@ -190,6 +202,8 @@ public function testLockupSettingsM(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand All @@ -211,6 +225,8 @@ public function testLockupSettingsO(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Organization name");
}
Expand All @@ -231,6 +247,8 @@ public function testLockupSettingsP(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Organization name");
Expand All @@ -252,6 +270,8 @@ public function testLockupSettingsR(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Last line full width option");
}
Expand All @@ -272,6 +292,8 @@ public function testLockupSettingsS(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand All @@ -294,6 +316,8 @@ public function testLockupSettingsT(AcceptanceTester $I) {
$I->fillField('Line 4', 'Organization name');
$I->fillField('Line 5', 'Last line full width option');
$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->canSee("Site title line");
$I->canSee("Secondary title line");
Expand Down Expand Up @@ -328,6 +352,8 @@ public function testLogoWithLockup(AcceptanceTester $I) {
$I->click('Upload');

$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->seeElement(".su-lockup__custom-logo");
$I->assertNotEmpty($I->grabAttributeFrom('.su-lockup__custom-logo', 'alt'));
Expand Down Expand Up @@ -362,6 +388,8 @@ public function testLogoWithOutLockup(AcceptanceTester $I) {
$I->click('Upload');

$I->click('Save');
$I->see('Lockup Settings has been', '.messages-list');

$I->amOnPage('/');
$I->seeElement(".su-lockup__custom-logo");
$I->assertNotEmpty($I->grabAttributeFrom('.su-lockup__custom-logo', 'alt'));
Expand Down
2 changes: 2 additions & 0 deletions tests/codeception/acceptance/SuperFooter/SuperFooterCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function testFormSettings(AcceptanceTester $I) {
$I->fillField('#edit-su-super-foot-intranet-0-uri', 'https://stanford.edu/');
$I->fillField('#edit-su-super-foot-intranet-0-title', 'Intranet Link');
$I->click('Save');
$I->see('Super Footer has been', '.messages-list');

$I->amOnPage("/");
$I->seeElement(".block-config-pages-super-footer");
$I->canSee("Super Footer Title");
Expand Down
Loading

0 comments on commit 2b5c945

Please sign in to comment.