1

I am running:

  • Drupal 7
  • Behat 3.5.0
  • Selenium 3.5.0
  • Chrome Driver 73.x

Using this test:

Feature: User Profile

Background:
  Given users:
    | name | status | roles |
    | incomplete | 1 | authenticated user |
    | complete | 1   | authenticated user |

  Given profiles:
    | drupal_username | field_profile_completed:value | field_first_name | field_last_name | field_birth_month | field_birth_day | field_degree | field_profession | field_specialty | field_organization | field_department |
    | incomplete | 0                                  | |  |  |  |  |  |  |  |  |
    | complete   | 1                                  | John | Doe | 08 | 03 | APRN | 15 | Anesthesiology | MyOrganization | MyDepartment |

@api
@noEncrypt
@defaultRegistration
@javascript
Scenario: As a user with an incomplete profile I should NOT see an icon indicating my profile is not complete.
  Given I am logged in as complete
  Then I should not see an ".js--user-profile-incomplete" element

@api
@noEncrypt
@defaultRegistration
@javascript
Scenario: As a user with an incomplete profile I should see an icon indicating my profile is not complete.
  Given I am on "/user/login"
  And I fill in the following:
    | name | incomplete|
    | pass | password |
  And press "edit-submit"
  Then I should be on "/"
  Then I should see an ".js--user-profile-incomplete" element
  When I wait for ".profile-notify__incomplete"
  Then I should see an ".profile-notify__exclamation" element

As you can see, I've tried logging in using Given I am logged in as and tried logging in via a meta-step. I can watch it in the browser and I'm getting an "Unrecognized username or password" error.

Login works fine without @javascript but I can't test the "When I wait" functionality. If I use a break I can see that the users are created in the database.

Why are my @javascript tests not able to login?

1
  • 1
    I would appreciate it if those voting to close would leave a comment. There is a very specific question and I believe all relevant information is included in the question. Is this not Drupal specific enough? Or is there something else that is missing Mar 21, 2019 at 0:23

1 Answer 1

0

It was a pain to track down but I traced it to the Security module. It encrypts the password field on form submit - disabling the module allows Behat @javascript tests to run fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.