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

Add support for testing languages #184

Merged
merged 10 commits into from
Jul 9, 2015
Merged

Conversation

pfrenssen
Copy link
Collaborator

It would be nice if we could add support for testing languages. I'm using Behat for an internal Drupal platform that is used in the European Commission, and we are currently supporting 24 languages :)

This pull requests adds a step definition for enabling additional languages in tests:

Given the following languages are available:
  | languages |
  | en        |
  | fr        |
  | de        |

This is currently depending on my fork of Drupal Driver that adds the respective functionality for creating and deleting languages. The sister pull request for Drupal Driver is here: jhedstrom/DrupalDriver#45

In case this is accepted we would need to revert commit 55f03a4 before merging this in. That commit points the Drupal Driver dependency to my own fork.

@ademarco
Copy link
Contributor

Big 👍 for this one!

@pfrenssen
Copy link
Collaborator Author

One of the Travis test bots stalled, but it doesn't seem to be possible to trigger a retest. I'll have to make a new commit.

@jhedstrom
Copy link
Owner

I restarted the test.

@@ -17,7 +17,7 @@
"behat/mink-selenium2-driver": "~1.1",
"behat/behat": "~3.0,>=3.0.5",
"behat/mink-extension": "~2.0",
"drupal/drupal-driver": "~1.0@dev"
"drupal/drupal-driver": "dev-language"
Copy link
Owner

Choose a reason for hiding this comment

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

This can be switched back now as I've merged jhedstrom/DrupalDriver#45

@jhedstrom
Copy link
Owner

This looks great. Small change mentioned above, and then it should be good to go!

@jhedstrom jhedstrom added this to the 3.1.0 release milestone Jul 9, 2015
jhedstrom added a commit that referenced this pull request Jul 9, 2015
Add support for testing languages
@jhedstrom jhedstrom merged commit f26a57a into jhedstrom:master Jul 9, 2015
@jhedstrom
Copy link
Owner

Awesome, thanks!

@MPParsley
Copy link
Contributor

MPParsley commented Mar 29, 2018

Sorry to comment on an old thread but it was not clear how to test for translations when in fact the DrupalExtension itself has hardcoded English strings:

          addDefaultsIfNotSet()->
          children()->
            scalarNode('log_in')->
              defaultValue('Log in')->
            end()->
            scalarNode('log_out')->
              defaultValue('Log out')->
            end()->
            scalarNode('password_field')->
              defaultValue('Password')->
            end()->
            scalarNode('username_field')->
              defaultValue('Username')->
            end()->
          end()->
  Scenario: Administrator role exists
    Given I am logged in as an "administrator"

This scenario may result in an error if you have another default language as it tries to login using the English strings:
Form field with id|name|label|value|placeholder "Username" not found. (Behat\Mink\Exception\ElementNotFoundException)

You can override the strings in your behat.yml configuration.

    Drupal\DrupalExtension:
        text:
            username_field: "Gebruikersnaam"
            password_field: "Wachtwoord"
            log_in: "Inloggen"
            log_out: "Uitloggen"

See https://www.drupal.org/project/drupalextension/issues/2145691#comment-9946699

xurizaemon pushed a commit to xurizaemon/drupalextension that referenced this pull request Nov 30, 2022
Extract and store uid in DrushDriver::userCreate()
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.

4 participants