Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/provision-10-enable-dev-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ if echo "${environment}" | grep -q -e local -e ci; then
drush pm:enable sdc_devel
fi

# Scenarios tagged "@testmode" restrict lists to test content, so the module
# has to be enabled wherever the test suite runs. It is excluded from the
# exported configuration, which is why it is enabled here rather than shipped
# as installed.
if echo "${environment}" | grep -q -e local -e ci; then
drush pm:enable testmode
fi

info "Finished enabling development modules."
50 changes: 22 additions & 28 deletions tests/behat/features/our_work_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,35 @@ Feature: Our work page
So that I can judge the depth of the work before making contact

@api
Scenario: The page opens the primary navigation and introduces the work
Scenario: The work section is reachable and leads the primary navigation
Given I am an anonymous user
When I go to "/work"
Then the response status code should be 200
And I should see the text "Work you can go and look at."
And I should see the text "Client work"
And I should see the text "Open Source work"
# The link leads the menu, so the first item is the one that must point here.
And the element ".ct-navigation__menu .ct-menu__item--level-0:first-child .ct-menu__item__link" with the attribute "href" and the value "/work" should exist

@api
Scenario: Published projects are listed as promo cards, twelve to a page
@api @testmode
Scenario: Each list shows only the published projects tagged for it
Given the following "project" content:
| title | moderation_state | field_do_n_year | field_do_n_status | field_c_n_banner_type | field_c_n_banner_theme | field_c_n_banner_blend_mode | field_c_n_vertical_spacing |
| [TEST] Our work project 01 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 02 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 03 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 04 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 05 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 06 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 07 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 08 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 09 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 10 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 11 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 12 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work project 13 | published | 2025 | completed | large | inherit | normal | both |
| [TEST] Our work draft | draft | 2025 | ongoing | large | inherit | normal | both |
| title | moderation_state | field_c_n_topics | field_do_n_year | field_do_n_status | field_c_n_banner_type | field_c_n_banner_theme | field_c_n_banner_blend_mode | field_c_n_vertical_spacing |
| [TEST] Client project 01 | published | Custom development | 2025 | completed | large | inherit | normal | both |
| [TEST] Client project 02 | published | Custom development | 2025 | completed | large | inherit | normal | both |
| [TEST] Client project 03 | published | Custom development | 2025 | completed | large | inherit | normal | both |
| [TEST] Client project 04 | published | Custom development | 2025 | completed | large | inherit | normal | both |
| [TEST] Client project 05 | published | Custom development | 2025 | completed | large | inherit | normal | both |
| [TEST] Client project 06 | published | Custom development | 2025 | completed | large | inherit | normal | both |
| [TEST] Open source project 01 | published | Open source | 2025 | completed | large | inherit | normal | both |
| [TEST] Open source project 02 | published | Open source | 2025 | completed | large | inherit | normal | both |
| [TEST] Open source project 03 | published | Open source | 2025 | completed | large | inherit | normal | both |
| [TEST] Open source project 04 | published | Open source | 2025 | completed | large | inherit | normal | both |
| [TEST] Open source project 05 | published | Open source | 2025 | completed | large | inherit | normal | both |
| [TEST] Open source project 06 | published | Open source | 2025 | completed | large | inherit | normal | both |
| [TEST] Client draft | draft | Custom development | 2025 | ongoing | large | inherit | normal | both |
And I am an anonymous user
When I go to "/work"
Then the response status code should be 200
# The page carries more than one list, so the count is scoped to the first
# one - the paginated list of client projects - rather than to the whole
# main region. Asserting the page fills rather than the total keeps projects
# already on the site from changing the outcome.
And the element "[data-component-id='civictheme:list']" should contain 12 elements matching ".ct-promo-card"
And should see a ".ct-pagination__items" element
And I should not see the text "[TEST] Our work draft"
And the element ".block-field-blocknodecivictheme-pagefield-c-n-components > .ct-list:first-child" should contain 6 elements matching ".ct-promo-card"
And the element ".block-field-blocknodecivictheme-pagefield-c-n-components > .ct-list:last-child" should contain 6 elements matching ".ct-promo-card"
And I should see "[TEST] Client project 01" in the ".block-field-blocknodecivictheme-pagefield-c-n-components > .ct-list:first-child" element
And I should see "[TEST] Open source project 01" in the ".block-field-blocknodecivictheme-pagefield-c-n-components > .ct-list:last-child" element
And I should not see the text "[TEST] Client draft"
9 changes: 9 additions & 0 deletions tests/phpunit/Drupal/EnvironmentSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public function testEnvironmentNoOverrides(): void {
$config['robotstxt.settings']['content'] = "User-agent: *\nDisallow: /";
$config['shield.settings']['shield_enable'] = TRUE;
$config['system.performance']['cache']['page']['max_age'] = 900;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

$settings['auto_create_htaccess'] = FALSE;
Expand Down Expand Up @@ -333,6 +334,7 @@ public function testEnvironmentOverrides(): void {
$config['robotstxt.settings']['content'] = "User-agent: *\nDisallow: /";
$config['shield.settings']['shield_enable'] = TRUE;
$config['system.performance']['cache']['page']['max_age'] = 1800;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

// Verify settings overrides.
Expand Down Expand Up @@ -417,6 +419,7 @@ public function testEnvironmentLocal(): void {
$config['purge_control.settings']['purge_auto_control'] = FALSE;
$config['seckit.settings']['seckit_xss']['csp']['checkbox'] = FALSE;
$config['seckit.settings']['seckit_xss']['csp']['upgrade-req'] = FALSE;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

$settings['auto_create_htaccess'] = FALSE;
Expand Down Expand Up @@ -471,6 +474,7 @@ public function testEnvironmentLocalContainer(): void {
$config['purge_control.settings']['purge_auto_control'] = FALSE;
$config['seckit.settings']['seckit_xss']['csp']['checkbox'] = FALSE;
$config['seckit.settings']['seckit_xss']['csp']['upgrade-req'] = FALSE;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

$settings['auto_create_htaccess'] = FALSE;
Expand Down Expand Up @@ -527,6 +531,7 @@ public function testEnvironmentGha(): void {
$config['purge_control.settings']['purge_auto_control'] = FALSE;
$config['seckit.settings']['seckit_xss']['csp']['checkbox'] = FALSE;
$config['seckit.settings']['seckit_xss']['csp']['upgrade-req'] = FALSE;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

$settings['auto_create_htaccess'] = FALSE;
Expand Down Expand Up @@ -579,6 +584,7 @@ public function testEnvironmentLagoonPreview(): void {
$config['robotstxt.settings']['content'] = "User-agent: *\nDisallow: /";
$config['shield.settings']['shield_enable'] = TRUE;
$config['system.performance']['cache']['page']['max_age'] = 900;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

$settings['auto_create_htaccess'] = FALSE;
Expand Down Expand Up @@ -634,6 +640,7 @@ public function testEnvironmentLagoonDev(): void {
$config['robotstxt.settings']['content'] = "User-agent: *\nDisallow: /";
$config['shield.settings']['shield_enable'] = TRUE;
$config['system.performance']['cache']['page']['max_age'] = 900;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

$settings['auto_create_htaccess'] = FALSE;
Expand Down Expand Up @@ -689,6 +696,7 @@ public function testEnvironmentLagoonTest(): void {
$config['robotstxt.settings']['content'] = "User-agent: *\nDisallow: /";
$config['shield.settings']['shield_enable'] = TRUE;
$config['system.performance']['cache']['page']['max_age'] = 900;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

$settings['auto_create_htaccess'] = FALSE;
Expand Down Expand Up @@ -744,6 +752,7 @@ public function testEnvironmentLagoonProd(): void {
$config['system.performance']['cache']['page']['max_age'] = 900;
$config['system.performance']['css']['preprocess'] = TRUE;
$config['system.performance']['js']['preprocess'] = TRUE;
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
$this->assertConfig($config);

$settings['auto_create_htaccess'] = FALSE;
Expand Down
6 changes: 6 additions & 0 deletions web/sites/default/includes/modules/settings.testmode.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
declare(strict_types=1);

$settings['config_exclude_modules'][] = 'testmode';

// The automated list view backs every CivicTheme list component. Listing it
// here restricts those lists to test content while test mode is on, so a
// scenario counting list items is not affected by the content already in the
// database.
$config['testmode.settings']['views_node'] = ['content', 'civictheme_automated_list'];
Loading