Skip to content

Comments

UHF-11523: Test for emergency site static version generation#15

Merged
wktohesi merged 2 commits intomainfrom
UHF-11523
Jan 20, 2026
Merged

UHF-11523: Test for emergency site static version generation#15
wktohesi merged 2 commits intomainfrom
UHF-11523

Conversation

@wktohesi
Copy link
Contributor

@wktohesi wktohesi commented Jan 19, 2026

UHF-11523

What was done

  • Adds a Playwright test for emergency site static version generation.
    • The logic is to make sure a new news item appears on the static version.

How to install

Set up emergency site instance

  • Make sure your emergency site instance is up and running latest version of dev-branch
    • git checkout dev && git pull origin dev
    • make fresh
  • Switch to feature branch
    • git fetch && git checkout UHF-11523
  • Update the Helfi Platform config
    • composer require drupal/helfi_platform_config:dev-UHF-11523
  • Run code updates
    • composer install
    • make drush-deploy drush-locale-update drush-cr
  • Simulate changes in drupal-helfi-platform
    • Add the following to your local.settings.php:
$test_account = [
  "username" => "drupal_e2e_user",
  "password" => "drupal_e2e_password",
  "roles" => [
    "admin",
  ],
];
$config['helfi_api_base.api_accounts']['accounts'][] = $test_account;
$config['helfi_platform_config.e2e_test_users']['users'][] = array_intersect_key($test_account, [
  "username" => TRUE,
]);
  • Then run drush helfi:post-deploy

Set up e2e testing local environment

  • Get the feature branch
    • git fetch && git checkout UHF-11523
  • Install the testing tools
    • nvm use && npm i
  • Update .env (see .env.example) and make sure you have these new variables (also make sure username and password for DRUPAL_E2E_USER match the ones in local.settings.php in your emergency site instance):
EMERGENCY_SITE_BASE_URL="https://emergency-site.docker.so"
EMERGENCY_SITE_STATIC_URL="https://poikkeustilanne.stage.hel.ninja"
APP_DEBUG=TRUE
DRUPAL_E2E_USER='{"username": "drupal_e2e_user", "password": "drupal_e2e_password"}'

How to test

  • Run the test npx playwright test --project=emergency-site
    • Test should run successfully until it starts waiting for the static version update. There's no static site generation available for local environment, so the test keeps polling for the static site staging, and will never pass unless we add an item there manually (there's an optional step for this below)
    • You should see debug output like
      Drupal news item URL: https://emergency-site.docker.so/en/news/test-news-062bopbm7xwu1768831869236
      Static news item URL: https://poikkeustilanne.stage.hel.ninja/en/news/test-news-062bopbm7xwu1768831869236.html
    • Go to https://emergency-site.docker.so/en; you should see a test news item with a title that matches the url alias of the above debug output
  • OPTIONAL: Add a similar news item to emergency site staging to allow the test to pass
  • Check that the code follows our standards

Links to related PRs

Copy link
Contributor

@khalima khalima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! 🚀

@wktohesi wktohesi merged commit b619556 into main Jan 20, 2026
1 check passed
@wktohesi wktohesi deleted the UHF-11523 branch January 20, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants