Skip to content

Commit

Permalink
11.0.2
Browse files Browse the repository at this point in the history
- Adjusted acceptance tests
  • Loading branch information
pookmish authored Oct 20, 2023
1 parent 5dd6d10 commit 6be3b1d
Show file tree
Hide file tree
Showing 37 changed files with 207 additions and 83 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Stanford Profile

11.0.2
-------------------------------------------------------------------------------
- Fix acceptance tests.

11.0.1
-------------------------------------------------------------------------------
- Fix site setting redirect logic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ third_party_settings:
show_empty_fields: false
id: ''
formatter: closed
description: ''
description: "<p>Site owners are required to provide the email addresses for important site contacts on an annual basis in order to renew the site. Please provide an email address for the business owner, technical owner, and the accessibility contact for the site, as well as an indication of the organizational affiliation of the site. </p>\r\n\r\n<p>If you have questions about this information or policies around site renewal, please visit our <a href=\"https://sitesuserguide.stanford.edu/get-started/enter-site-ownership-information\">User Guide page on site ownership</a>.</p>"
required_fields: true
id: config_pages.stanford_basic_site_settings.default
targetEntityType: config_pages
Expand Down
2 changes: 1 addition & 1 deletion stanford_profile.info.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Stanford Profile'
description: 'Jumpstart Website Profile'
version: 11.0.1
version: 11.0.2
type: profile
project: Stanford
core_version_requirement: ^9 || ^10
Expand Down
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
13 changes: 10 additions & 3 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,13 +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', '.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
Loading

0 comments on commit 6be3b1d

Please sign in to comment.