drupalextension icon indicating copy to clipboard operation
drupalextension copied to clipboard

Approach for testing multi-lingual sites using the domain as the language selection method

Open nicrodgers opened this issue 9 years ago • 3 comments

Is anyone using the Behat Drupal Extension to test multi-lingual sites using the domain as the language selection method? How did you approach it?

Up until our, our multi-lingual site detected language based on path, but we now have to change to domain based detection. Our existing test suite works fine with path-based detection, but now we need to update it to work with domain-based.

I am wondering how best to approach it, specifically:

  • base_url in behat.yml - set this to the default language?
  • testing language toggles work - currently we follow the toggle link and use 'And I should be on "es/some-page"' but this will need to be updated to check the domain has changed. Should we just make the URLs absolute, or is there a nicer way? If we had to make them absolute then we'd need to use a variable, as the domains are different depending on whether we're running the tests locally, on dev, or on staging.
  • tests that log in, do something, then change to a different language. Currently these work fine as the user remains logged in after the language change, because they stay on the same domain and the cookie is still set. However with domain based language, going to another language will mean you are not logged in on that site, so how do we get Behat to log us in to the new domain?

Any thoughts appreciated.

nicrodgers avatar Feb 03 '16 10:02 nicrodgers

Also related #184 and #93.

jhedstrom avatar Dec 05 '17 18:12 jhedstrom

@nicrodgers ,

Not sure if still relevant, but I was looking into the same a while back and used this as a base to go from: https://stackoverflow.com/a/13342710

mathiasselleslach avatar Jan 22 '18 12:01 mathiasselleslach

I'd close this in favor of I'd close this in favor of https://github.com/jhedstrom/drupalextension/issues/93

normanlolx avatar Jan 23 '19 09:01 normanlolx