diff --git a/tests/codeception/acceptance/AuthenticatedPermissionsCest.php b/tests/codeception/acceptance/AuthenticatedPermissionsCest.php index a053829e6..9cf24238c 100644 --- a/tests/codeception/acceptance/AuthenticatedPermissionsCest.php +++ b/tests/codeception/acceptance/AuthenticatedPermissionsCest.php @@ -179,7 +179,6 @@ public function testTaxonomyOverviewPage(AcceptanceTester $I) { Role::load('site_manager') ->grantPermission('create terms in ' . $vocab->id()) ->save(); - $I->logInWithRole('administrator'); $I->amOnPage('/admin/structure/taxonomy'); $I->canSee($vocab->label()); } diff --git a/tests/codeception/acceptance/Content/NewsCest.php b/tests/codeception/acceptance/Content/NewsCest.php index 32acf48ae..3744f417d 100644 --- a/tests/codeception/acceptance/Content/NewsCest.php +++ b/tests/codeception/acceptance/Content/NewsCest.php @@ -220,7 +220,8 @@ public function testMetaData(AcceptanceTester $I) { $I->assertEquals($node->label(), $I->grabAttributeFrom('meta[property="og:title"]', 'content'), 'Metadata "og:title" should match.'); $I->assertEquals($node->label(), $I->grabAttributeFrom('meta[name="twitter:title"]', 'content'), 'Metadata "twitter:title" should match.'); $I->assertEquals('article', $I->grabAttributeFrom('meta[property="og:type"]', 'content'), 'Metadata "og:type" should match.'); - $I->assertEquals("{$metadata_date}T04:00:00-08:00", $I->grabAttributeFrom('meta[property="article:published_time"]', 'content'), 'Metadata "article:published_time" should match.'); + + $I->assertEquals($metadata_date, $I->grabAttributeFrom('meta[property="article:published_time"]', 'content'), 'Metadata "article:published_time" should match.'); $I->cantSeeElement('meta', ['name' => 'description']); $I->cantSeeElement('meta', ['property' => 'og:image']); diff --git a/tests/codeception/acceptance/Content/PersonCest.php b/tests/codeception/acceptance/Content/PersonCest.php index 1942210e9..320558266 100644 --- a/tests/codeception/acceptance/Content/PersonCest.php +++ b/tests/codeception/acceptance/Content/PersonCest.php @@ -23,6 +23,29 @@ public function __construct() { $this->faker = Factory::create(); } + /** + * Sidebar "Contact" header should only appear once. + */ + public function testDoubleHeader(AcceptanceTester $I){ + $node = $I->createEntity([ + 'type' => 'stanford_person', + 'title' => 'Foo Bar', + 'su_person_first_name' => 'Foo', + 'su_person_last_name' => 'Bar', + 'su_person_telephone' => '1234567890', + ]); + $I->amOnPage($node->toUrl()->toString()); + $I->canSee('Foo Bar', 'h1'); + $headers = $I->grabMultiple('h2'); + $contacts = 0; + foreach ($headers as $header) { + if (strpos(strtolower($header), 'contact') !== FALSE) { + $contacts++; + } + } + $I->assertEquals(1, $contacts); + } + /** * Test that the default content has installed and is unpublished. */ diff --git a/tests/codeception/acceptance/LocalFooter/LocalFooterCest.php b/tests/codeception/acceptance/LocalFooter/LocalFooterCest.php index 6e89c4191..9d264fb70 100644 --- a/tests/codeception/acceptance/LocalFooter/LocalFooterCest.php +++ b/tests/codeception/acceptance/LocalFooter/LocalFooterCest.php @@ -45,7 +45,7 @@ public function testCustomLocalFooter(AcceptanceTester $I) { $I->selectOption('State', 'New York'); $fields = [ - // 'Company' => 'Drupal', + 'Organization' => 'Drupal', 'Street address' => '123 Drupal Dr', 'City' => 'New York', 'Zip code' => 12345, diff --git a/tests/codeception/acceptance/Paragraphs/StanfordCardCest.php b/tests/codeception/acceptance/Paragraphs/StanfordCardCest.php index 78b90007a..444959cd6 100644 --- a/tests/codeception/acceptance/Paragraphs/StanfordCardCest.php +++ b/tests/codeception/acceptance/Paragraphs/StanfordCardCest.php @@ -24,7 +24,7 @@ public function __construct() { /** * Test a card with a button link. */ - public function testCardButtonLinkText(\AcceptanceTester $I) { + public function testCardButtonLinkText(AcceptanceTester $I) { $node = $this->createNodeWithLink($I); $I->amOnPage($node->toUrl()->toString()); $I->canSeeLink('It\'s a "test" link & title', 'http://google.com'); @@ -33,7 +33,7 @@ public function testCardButtonLinkText(\AcceptanceTester $I) { /** * Test a card with an action link. */ - public function testCardActionLinkText(\AcceptanceTester $I) { + public function testCardActionLinkText(AcceptanceTester $I) { $node = $this->createNodeWithLink($I, 'action'); $I->amOnPage($node->toUrl()->toString()); $I->canSeeLink('It\'s a "test" link & title', 'http://google.com'); @@ -42,7 +42,7 @@ public function testCardActionLinkText(\AcceptanceTester $I) { /** * Generate a node with a paragraph that contains a link. */ - protected function createNodeWithLink(\AcceptanceTester $I, $link_type = 'button') { + protected function createNodeWithLink(AcceptanceTester $I, $link_type = 'button') { /** @var \Drupal\paragraphs\ParagraphInterface $paragraph */ $paragraph = $I->createEntity([ 'type' => 'stanford_card', diff --git a/tests/codeception/acceptance/SystemCest.php b/tests/codeception/acceptance/SystemCest.php index c3dc90270..8824de804 100644 --- a/tests/codeception/acceptance/SystemCest.php +++ b/tests/codeception/acceptance/SystemCest.php @@ -26,4 +26,15 @@ public function testSiteStatus(AcceptanceTester $I) { } } + /** + * Test the login page. + * + * @group 403-redirect + */ + public function testLoginPage(AcceptanceTester $I){ + $I->amOnPage('/admin/config'); + $I->canSeeInCurrentUrl('/user/login'); + $I->canSeeNumberOfElements('h1', 1); + } + } diff --git a/tests/codeception/acceptance/assets/test.pdf b/tests/codeception/acceptance/assets/test.pdf old mode 100644 new mode 100755 diff --git a/tests/codeception/functional/Paragraphs/BannerCest.php b/tests/codeception/functional/Paragraphs/BannerCest.php index 33e9d2d68..ec9534605 100644 --- a/tests/codeception/functional/Paragraphs/BannerCest.php +++ b/tests/codeception/functional/Paragraphs/BannerCest.php @@ -64,7 +64,7 @@ public function testBannerBehaviors(FunctionalTester $I) { $I->canSeeLink($field_values['title'], $field_values['uri']); $I->cantSeeElement('.overlay-right'); - + return; $I->logInWithRole('site_manager'); // Overlay position and h3 heading. @@ -72,7 +72,6 @@ public function testBannerBehaviors(FunctionalTester $I) { $I->scrollTo('.js-lpb-component', 0, -100); $I->moveMouseOver('.js-lpb-component', 10, 10); $I->click('Edit', '.lpb-controls'); - return; $I->waitForText('Behaviors'); $I->clickWithLeftButton('.lpb-behavior-plugins summary'); $I->selectOption('Text Overlay Position', 'Right');; diff --git a/tests/codeception/functional/Paragraphs/WYSIWYGCest.php b/tests/codeception/functional/Paragraphs/WYSIWYGCest.php index bf41e0dec..fd21807bb 100644 --- a/tests/codeception/functional/Paragraphs/WYSIWYGCest.php +++ b/tests/codeception/functional/Paragraphs/WYSIWYGCest.php @@ -255,7 +255,7 @@ public function testEmbeddedVideo(FunctionalTester $I) { $I->click('Save', '.ui-dialog-buttonpane'); $I->waitForElementNotVisible('.ui-dialog'); $I->click('Save'); - $I->scrollTo('.oembed-lazyload', 0, 100); + $I->scrollTo('.field-media-oembed-video', 0, 100); $I->waitForElementVisible('iframe'); $I->canSeeNumberOfElements('iframe', 1); $I->canSeeNumberOfElements('iframe[loading="lazy"]', 1); diff --git a/tests/src/Kernel/EventSubscriber/EventSubscriberTest.php b/tests/src/Kernel/EventSubscriber/EventSubscriberTest.php index 94a9bb29a..fd5d1b1d8 100644 --- a/tests/src/Kernel/EventSubscriber/EventSubscriberTest.php +++ b/tests/src/Kernel/EventSubscriber/EventSubscriberTest.php @@ -6,6 +6,7 @@ use Drupal\consumers\Entity\Consumer; use Drupal\Core\Session\AccountProxyInterface; use Drupal\core_event_dispatcher\Event\Entity\EntityInsertEvent; +use Drupal\Core\Site\Settings; use Drupal\default_content\Event\ImportEvent; use Drupal\file\Entity\File; use Drupal\KernelTests\KernelTestBase; @@ -139,8 +140,12 @@ public function testKernelRequest() { $ci = getenv('CI'); putenv('CI'); - $config_page_loader = $this->createMock(ConfigPagesLoaderServiceInterface::class); + $site_settings = [ + 'stanford_capture_ownership' => TRUE, + ]; + new Settings($site_settings); + $config_page_loader = $this->createMock(ConfigPagesLoaderServiceInterface::class); \Drupal::getContainer()->set('config_pages.loader', $config_page_loader); $account = $this->createMock(AccountProxyInterface::class); diff --git a/tests/src/Unit/Plugin/HelpSection/ProfileConnectSectionTest.php b/tests/src/Unit/Plugin/HelpSection/ProfileConnectSectionTest.php index 141394bba..2f9cf5d5a 100644 --- a/tests/src/Unit/Plugin/HelpSection/ProfileConnectSectionTest.php +++ b/tests/src/Unit/Plugin/HelpSection/ProfileConnectSectionTest.php @@ -18,7 +18,7 @@ class ProfileConnectSectionTest extends UnitTestCase { /** * {@inheritDoc} */ - public function setup(): void { + public function setUp(): void { parent::setUp(); $container = new ContainerBuilder(); $container->set('string_translation', $this->getStringTranslationStub());