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

Internal: Backport AvoidCleanupTrait to 11.9.x #3469

Merged
merged 6 commits into from Jul 24, 2023

Commits on Jul 22, 2023

  1. Disable clean-up in Behat tests

    We previously utilised a lot of clean-up steps to make sure our tests
    didn't affect eachother. However we've since moved to a scenario where
    both in the CI and locally a new database is loaded between scenarios,
    this makes the clean-up no longer needed.
    
    Additionally if the clean-up does run then this makes debugging a failed
    test a lot more difficult because you can't inspect the state of the
    platform at the time the test failed.
    
    This commit ensures that all the clean-up that is provided by the
    DrupalExtension by default is disabled. For this we have to disable
    autoloading of sub-contexts (which we weren't using anyway) because the
    search_api contained a `behat.inc` file that would load the
    `RawDrupalContext` class which contained more cleaning.
    
    There are DrupalExtension stories open to remove the cleaning from
    `RawDrupalContext`, but we don't have time to wait for that.
    
    We also add a step in our CI to dump the failed database to disk along
    with the installation.sql file. This allows a developer to load the
    failed database locally and see what was going wrong without having to
    rerun the test.
    Kingdutch authored and Robert Ragas committed Jul 22, 2023
    Configuration menu
    Copy the full SHA
    8cbf0c6 View commit details
    Browse the repository at this point in the history
  2. Logout after each Behat scenario

    In newly written tests we were already doin this manually in each
    scenario. Between scenario's the user manager in the DrupalExtension was
    not correctly keeping track of the logged in user status which could
    prevent a new scenario from logging a user in.
    
    With the removal of clean-up in scenario's we now need that logout step
    literally everywhere, so it's easier to add it as an `@afterScenario`
    and run it every time than to require developers to decide about 100s of
    places whether it's needed.
    
    See jhedstrom/drupalextension#641
    Kingdutch authored and Robert Ragas committed Jul 22, 2023
    Configuration menu
    Copy the full SHA
    0082d46 View commit details
    Browse the repository at this point in the history
  3. Remove dev-helpers tests

    These were used in the past to help set-up test automation on Travis but
    they don't actually test Open Social. In any scenario that these tests
    might fail other tests would fail too.
    
    The tests are removed to reduce the number of parallel tests being
    executed.
    Kingdutch authored and Robert Ragas committed Jul 22, 2023
    Configuration menu
    Copy the full SHA
    941f797 View commit details
    Browse the repository at this point in the history
  4. Improve test fixture creation for taxonomy references

    This commit allows taxonomy reference data to be provided as a comma
    separated list of IDs or term names (mixing is allowed). This can now be
    used in tables for e.g. groups, topics and events. By putting this in
    the validate method we can use this everywhere.
    
    This ensures we deduplicate the taxonomy title lookup so that we don't
    break on a pre-fetched value. Since we now do it by field type we no
    longer need to do it by field name.
    
    We can also remove the topic clean-up since we load a new database
    before every test. This allows us to remove the helper that looks-up a
    topic type by name.
    Kingdutch authored and Robert Ragas committed Jul 22, 2023
    Configuration menu
    Copy the full SHA
    ec8e8d4 View commit details
    Browse the repository at this point in the history
  5. Allow relative dates in any date field in tests

    We can use our EntityTrait to allow any relative date for datetime
    fields that we create using any of our newer content scaffolding test
    steps.
    Kingdutch authored and Robert Ragas committed Jul 22, 2023
    Configuration menu
    Copy the full SHA
    2bbdfb3 View commit details
    Browse the repository at this point in the history
  6. Allow relative dates in tests for created/changed fields

    These fields have a different field type and value structure than the
    `datetime` fields that we already tackled in a previous commit, so we
    need to add them separately.
    Kingdutch authored and Robert Ragas committed Jul 22, 2023
    Configuration menu
    Copy the full SHA
    55c87e8 View commit details
    Browse the repository at this point in the history