From 557f18f3bf5ec2e42ae8cf24c64a7635dac8c037 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 11 Aug 2026 11:25:07 +1000 Subject: [PATCH 1/3] Removed editorial copy and project count assertions from 'our_work_page.feature'. --- tests/behat/features/our_work_page.feature | 45 +++++----------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/tests/behat/features/our_work_page.feature b/tests/behat/features/our_work_page.feature index 22d89626..ef27c8d4 100644 --- a/tests/behat/features/our_work_page.feature +++ b/tests/behat/features/our_work_page.feature @@ -2,45 +2,20 @@ Feature: Our work page As a site visitor - I want to browse the projects that have been delivered - So that I can judge the depth of the work before making contact + I want to reach the work section from anywhere on the site + So that I can find the projects that have been delivered + + # CI provisions from the production database, so editorial copy and the + # number of published projects change without a code change. Assertions + # here stay on the route and the navigation structure; project rendering, + # listing and pagination are covered against fixtures in + # project_content_type.feature and + # paragraph_civictheme_automated_list_pager.feature. @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 - 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 | - 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" From 8911f4c514097c4325ad650ab00e877be475ad9e Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 11 Aug 2026 11:55:08 +1000 Subject: [PATCH 2/3] Asserted six promo cards in each tagged list on the work page under test mode. --- tests/behat/features/our_work_page.feature | 37 ++++++++++++++----- .../Drupal/EnvironmentSettingsTest.php | 9 +++++ .../includes/modules/settings.testmode.php | 6 +++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/tests/behat/features/our_work_page.feature b/tests/behat/features/our_work_page.feature index ef27c8d4..6c2361ed 100644 --- a/tests/behat/features/our_work_page.feature +++ b/tests/behat/features/our_work_page.feature @@ -2,15 +2,8 @@ Feature: Our work page As a site visitor - I want to reach the work section from anywhere on the site - So that I can find the projects that have been delivered - - # CI provisions from the production database, so editorial copy and the - # number of published projects change without a code change. Assertions - # here stay on the route and the navigation structure; project rendering, - # listing and pagination are covered against fixtures in - # project_content_type.feature and - # paragraph_civictheme_automated_list_pager.feature. + I want to browse the projects that have been delivered + So that I can judge the depth of the work before making contact @api Scenario: The work section is reachable and leads the primary navigation @@ -19,3 +12,29 @@ Feature: Our work page Then the response status code should be 200 # 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 @testmode + Scenario: Each list shows only the published projects tagged for it + Given the following "project" content: + | 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 + 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" diff --git a/tests/phpunit/Drupal/EnvironmentSettingsTest.php b/tests/phpunit/Drupal/EnvironmentSettingsTest.php index 7b7b26c8..070b4303 100644 --- a/tests/phpunit/Drupal/EnvironmentSettingsTest.php +++ b/tests/phpunit/Drupal/EnvironmentSettingsTest.php @@ -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; @@ -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. @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/web/sites/default/includes/modules/settings.testmode.php b/web/sites/default/includes/modules/settings.testmode.php index 7b2e0ff8..d63fab43 100644 --- a/web/sites/default/includes/modules/settings.testmode.php +++ b/web/sites/default/includes/modules/settings.testmode.php @@ -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']; From 600b010a605e7a65eb8c421ed2883320b181969f Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 11 Aug 2026 12:09:54 +1000 Subject: [PATCH 3/3] Enabled 'testmode' on local and CI environments. --- scripts/provision-10-enable-dev-modules.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/provision-10-enable-dev-modules.sh b/scripts/provision-10-enable-dev-modules.sh index 93dbb62e..101477b3 100755 --- a/scripts/provision-10-enable-dev-modules.sh +++ b/scripts/provision-10-enable-dev-modules.sh @@ -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."