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 4390c60
Show file tree
Hide file tree
Showing 34 changed files with 154 additions and 86 deletions.
12 changes: 9 additions & 3 deletions tests/codeception/acceptance/Content/BasicPageCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public function __construct() {
*/
public function testCreatingPage(AcceptanceTester $I) {
$node_title = $this->faker->text(20);
$node = $I->createEntity(['type' => 'stanford_page', 'title' => $node_title]);
$node = $I->createEntity([
'type' => 'stanford_page',
'title' => $node_title,
]);

$I->logInWithRole('site_manager');
$I->amOnPage($node->toUrl('edit-form')->toString());
Expand Down Expand Up @@ -69,9 +72,12 @@ public function testCreatingPage(AcceptanceTester $I) {
/**
* Test deleting menu items clears them from the main menu.
*/
public function testDeletedMenuItems(AcceptanceTester $I){
public function testDeletedMenuItems(AcceptanceTester $I) {
$node_title = $this->faker->text(20);
$node = $I->createEntity(['type' => 'stanford_page', 'title' => $node_title]);
$node = $I->createEntity([
'type' => 'stanford_page',
'title' => $node_title,
]);

$I->logInWithRole('site_manager');
$I->amOnPage($node->toUrl('edit-form')->toString());
Expand Down
1 change: 0 additions & 1 deletion tests/codeception/acceptance/Content/CoursesCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public function testRabbitHoleRedirects(AcceptanceTester $I) {
$I->canSee('This page will redirect');
}


/**
* Create a Course Node.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/codeception/acceptance/Content/CustomBlockCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct() {
public function testCustomBlockAccess(AcceptanceTester $I) {
$block = $I->createEntity([
'type' => 'stanford_component_block',
'info' => $this->faker->word(3, true),
'info' => $this->faker->word(3, TRUE),
], 'block_content');
$I->logInWithRole('site_manager');
$I->amOnPage($block->toUrl()->toString());
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
2 changes: 0 additions & 2 deletions tests/codeception/acceptance/Content/NewsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public function testViewPagesExist(AcceptanceTester $I) {
* Validate external content redirect.
*/
public function testExternalSourceArticle(AcceptanceTester $I) {

$node = $I->createEntity([
'type' => 'stanford_news',
'title' => $this->faker->words(3, TRUE),
Expand Down Expand Up @@ -251,5 +250,4 @@ public function testMetaData(AcceptanceTester $I) {
$I->assertEquals($values['featured_image_alt'], $I->grabAttributeFrom('meta[name="twitter:image:alt"]', 'content'), 'Metadata "twitter:image:alt" should match.');
}


}
2 changes: 1 addition & 1 deletion tests/codeception/acceptance/Content/PersonCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public function testMetaData(AcceptanceTester $I) {
/**
* Deleting the taxonomy term doesn't break the form.
*/
public function testDeletedTerm(AcceptanceTester $I){
public function testDeletedTerm(AcceptanceTester $I) {
$term = $I->createEntity([
'name' => $this->faker->words(2, TRUE),
'vid' => 'stanford_person_types',
Expand Down
8 changes: 5 additions & 3 deletions tests/codeception/acceptance/Content/PolicyCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function testPolicyPathAuto(AcceptanceTester $I) {

$node = $I->createEntity([
'type' => 'stanford_policy',
'title' => $this->faker->words(3, true),
'title' => $this->faker->words(3, TRUE),
'su_policy_title' => $this->faker->words(4, TRUE) . '-foo-bar',
'su_policy_auto_prefix' => 1,
]);
Expand Down Expand Up @@ -261,10 +261,12 @@ public function testPolicyHeirarcy(AcceptanceTester $I) {
$I->uncheckOption('Automatic Prefix');
$I->fillField('Chapter Number', $new_prefix);
$I->click('Save');
$I->canSee($new_prefix . '. ' . $chapter_two->get('su_policy_title')->getString(), 'h1');
$I->canSee($new_prefix . '. ' . $chapter_two->get('su_policy_title')
->getString(), 'h1');

$I->amOnPage($article_one->toUrl()->toString());
$I->canSee($new_prefix . '.A ' . $article_one->get('su_policy_title')->getString());
$I->canSee($new_prefix . '.A ' . $article_one->get('su_policy_title')
->getString());

$new_title = $this->faker->words(4, TRUE);
$I->amOnPage($article_one->toUrl('edit-form')->toString());
Expand Down
1 change: 0 additions & 1 deletion tests/codeception/acceptance/Content/PublicationsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ public function testListSort(AcceptanceTester $I) {
$I->click('Save');
$I->canSee($this->values['a_node_title'], 'h1');


$I->amOnPage('/node/add/stanford_publication');
$I->fillField('Title', $this->values['b_node_title']);
$I->selectOption('su_publication_citation[actions][bundle]', 'Other');
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
8 changes: 4 additions & 4 deletions tests/codeception/acceptance/Contrib/ViewsBulkEditCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public function testBulkEdits(AcceptanceTester $I) {
$this->createEvents($I);

$event_foo_bar_baz = $I->createEntity([
'name' => $this->faker->words(3, true),
'name' => $this->faker->words(3, TRUE),
'vid' => 'stanford_event_types',
], 'taxonomy_term');
$news_foo_bar_baz= $I->createEntity([
'name' => $this->faker->words(3, true),
$news_foo_bar_baz = $I->createEntity([
'name' => $this->faker->words(3, TRUE),
'vid' => 'stanford_news_topics',
], 'taxonomy_term');
$pubs_foo_bar_baz = $I->createEntity([
'name' => $this->faker->words(3, true),
'name' => $this->faker->words(3, TRUE),
'vid' => 'stanford_publication_topics',
], 'taxonomy_term');

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
2 changes: 1 addition & 1 deletion tests/codeception/acceptance/HomePageCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testHomepage(AcceptanceTester $I) {
/**
* Users can't unpublish the homepage.
*/
public function testUnpublishingHomepage(AcceptanceTester $I){
public function testUnpublishingHomepage(AcceptanceTester $I) {
$I->logInWithRole('site_manager');
$I->amOnPage('/');
$I->click('Edit', '.tabs');
Expand Down
13 changes: 10 additions & 3 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,17 +125,18 @@ 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());


$I->amOnPage('/admin/config/system/local-footer');
$I->checkOption('Enabled');
$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
Loading

0 comments on commit 4390c60

Please sign in to comment.