Open finnlewis opened 2 weeks ago
@ekes or @stephen-cox can you help me work out why this test is failing?
When I test it manually, it behaves as expected.
Logging into the control site forwards the user to /admin
Logging into a microsite forwards the user to /group/1
So why would the test be behaving differently?
1) Drupal\Tests\localgov_microsites_group\Functional\LoginTest::testLoginRedirect
Behat\Mink\Exception\ExpectationException: Current page is "/user/2", but "/admin" expected.
/var/www/html/web/core/tests/Drupal/Tests/WebAssert.php:591
/var/www/html/web/core/tests/Drupal/Tests/WebAssert.php:779
/var/www/html/web/modules/contrib/localgov_microsites_group/tests/src/Functional/LoginTest.php:80
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
So why would the test be behaving differently?
If the same code passes locally, and fails here. I think something about the way the test is run meaning that the domain negotiator does not think there is an active domain:-
that's the reason it wouldn't redirect to either admin or the group page.
or it getting cached differently https://git.drupalcode.org/project/domain/-/blob/2.0.x/domain/src/DomainNegotiator.php?ref_type=heads#L146 but the negotiation is https://git.drupalcode.org/project/domain/-/blob/2.0.x/domain/src/DomainNegotiator.php?ref_type=heads#L164
I guess in group site tests we set the site, is it not defaulting to having the domain of the control site at other times? How is that set when running the test, environment variables?
Guess this is where it's setting the domain https://github.com/localgovdrupal/localgov_shared_workflows/blob/5db7a020b4e724a81ac9a4e2750342facba53ee7/.github/workflows/test-microsites.yml#L223
So locally it installs with
uuid: 6ddda674-911f-4efb-ad0c-2da28bca56c2
langcode: en
status: true
dependencies: { }
id: localgov_microsites_ddev_site
domain_id: 2467579
hostname: localgov-microsites.ddev.site
name: 'Drush Site-Install'
scheme: variable
weight: -1
is_default: true
And during a test the ID is: example_com
but the hostname: is updated to web or whatever I'm asking for; and it's the default.
What is it in the github test, and why isn't it returned if it's the default anyway. What's creating and updating this.
This an issue, again!
Just like mentioned here: https://www.drupal.org/project/responsive_preview/issues/3302861
Which takes us back to https://www.drupal.org/project/group/issues/2853001
The latest patch on there seems to suppress the problem.
Steps to reporoduce:
install localgov_microsites 4.0.0 :) create a microsite and assign an admin user to the microsite log into microsite as admin user create a newsroom See
Error message
Solution: apply this patch https://www.drupal.org/files/issues/2023-09-25/group2-2853001-26.patch