Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[D10.3 Update] Replace cgov_site kernel tests with cypress equivalent tests #4514

Open
bryanpizzillo opened this issue Dec 5, 2024 · 0 comments
Assignees

Comments

@bryanpizzillo
Copy link
Member

bryanpizzillo commented Dec 5, 2024

Issue description

ESTIMATE TBD

Drupal 10.3 changed how Kernel tests need to be setup. All required modules must be included in the static $modules declaration of the test class. So where we might have just added system and user and then used \Drupal::service('module_installer')->install(['cgov_core']); in the setUp method to load all other dependencies, you must now list all those dependencies. Otherwise you get errors that modules cannot be found. (Yes, installing cgov_core in cgov_core tests give module cannot be found)

I tried with some of the tests to set a list, but even after listing a good chunk of items, I still was getting random non-module errors. At the end of the day, the Kernel tests are not meant to load a whole bunch of modules. The Kernel tests in docroot/modules/custom are ok, because they do not require any dependencies that are not easily enabled. Whereas cgov_core basically has a lot of drupal core modules as its dependencies.

Additionally, most of our Kernel tests are just to make sure roles, common fields and workflows work. These can (and probably are) be tested with Cypress. In fact, these Kernel tests pre-date any cypress testing.

Breaking tests and current coverage

Current Test What does it test? Cypress Equiv
cgov_core\Kernel\FieldStorage\CGovFieldStorageTest::testFields
cgov_core\Kernel\TestKernelTest::testFieldOverrides This does nothing it just makes sure Kernel tests work N/A
cgov_core\Kernel\FieldStorage\CgovMediaFieldStorageTest::testFields
cgov_core\Kernel\RolesTest::testRoles
cgov_core\Kernel\WorkflowTest::testNewTranslationModerationState
cgov_core\Kernel\WorkflowTest::testDeletion
cgov_core\Kernel\WorkflowTest::testTransitions
cgov_image\Kernel\CgovImageFieldStorageTest::testFields
pdq_core\Kernel\CleanupTest::testPruneOldRevisions
pdq_core\Kernel\WorkflowTest::testPdqWorkflowTransitions
pdq_core\Kernel\FieldStorage\PDQFieldStorageTest::testFields

Test Details

cgov_core\Kernel\WorkflowTest::testTransitions

This tests the workflow states and transitions for various users.

cgov_core\Kernel\WorkflowTest::testNewTranslationModerationState

Drupal has issues with translating content that does not use the basic Drupal workflow. This test makes sure the workflow works for our translated content. This was tied to issue #371.
Basically it:

  1. creates an English node in a published state. (This would be the equiv of creating as node, saving the name, then publishing the node through the UI)
  2. create a spanish translation of the node in step 1. Make sure it gets created in draft and that it can be saved
  3. Then it sets different moderation states on the translation, calling validate() to make sure that some transitions cannot happen.
    • Through the UI, this would basically mean working the translated page through the workflow ensuring that the correct stages are available.
bryanpizzillo added a commit that referenced this issue Jan 3, 2025
- Features Update: cgov_application_page
- Features Update: cgov_article
- Features Update: cgov_biography
- Features Update: cgov_blog
- Features Update: cgov_cancer_center
- Features Updates: cgov_cancer_research
- Features Update: cgov_content_block
- Features Updates: cgov_core
- Features Update: cgov_cthp
- Features Update: cgov_embedded_block
- Features Update: cgov_event
- Features Update: cgov_external_link_block
- Features Update: cgov_home_landing
- Features Update: cgov_image
- Features Update: cgov_infographic
- Features Update: cgov_press_release
- Features Update: cgov_saml_auth_config
- Features Update: cgov_site_section
- Features Update: cgov_video
- Features Update: pdq_cancer_information_summary
- Features Update: pdq_drug_information_summary
- PHPCS and PHPStan fixes
- Updated login link display logic for changes in samlauth 3.10.
- Remove Kernel tests in favor of Cypress tests. (#4514)
- Update tests to reflect new field creation UX
- Updated CgovNavTreeController to change getNavData to require
  taxonomy_term instead of having a default parameter before
  required parameters. As it was PHPCBF wanted to mark it as
  nullable, and by doing that PHP started throwing deprecation
  issues because there is an optional param before required. At
  the end of the day, the code does not guard against
  $taxonomy_term being null, so we should not default to null.
- Updated translation packages
- D10.3 introduces revision history and revisioning to taxonomy_terms.
  This needs to be disabled until we can better test it and identify any
  unexpected side effects. (Especially cgov_site_section and the
  computed_path field).

Closes #4506
bryanpizzillo added a commit that referenced this issue Jan 9, 2025
- Features Update: cgov_application_page
- Features Update: cgov_article
- Features Update: cgov_biography
- Features Update: cgov_blog
- Features Update: cgov_cancer_center
- Features Updates: cgov_cancer_research
- Features Update: cgov_content_block
- Features Updates: cgov_core
- Features Update: cgov_cthp
- Features Update: cgov_embedded_block
- Features Update: cgov_event
- Features Update: cgov_external_link_block
- Features Update: cgov_home_landing
- Features Update: cgov_image
- Features Update: cgov_infographic
- Features Update: cgov_press_release
- Features Update: cgov_saml_auth_config
- Features Update: cgov_site_section
- Features Update: cgov_video
- Features Update: pdq_cancer_information_summary
- Features Update: pdq_drug_information_summary
- PHPCS and PHPStan fixes
- Updated login link display logic for changes in samlauth 3.10.
- Remove Kernel tests in favor of Cypress tests. (#4514)
- Update tests to reflect new field creation UX
- Updated CgovNavTreeController to change getNavData to require
  taxonomy_term instead of having a default parameter before
  required parameters. As it was PHPCBF wanted to mark it as
  nullable, and by doing that PHP started throwing deprecation
  issues because there is an optional param before required. At
  the end of the day, the code does not guard against
  $taxonomy_term being null, so we should not default to null.
- Updated translation packages
- D10.3 introduces revision history and revisioning to taxonomy_terms.
  This needs to be disabled until we can better test it and identify any
  unexpected side effects. (Especially cgov_site_section and the
  computed_path field).

Closes #4506
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants