There are two checks in PasswordResetBehaviorsTest to assert the current URL, but they are not working correctly.

'User should be sent back to their account form instead of the node' and 'User should have access to the node now' aren't actually getting the current URL, they're simply comparing two strings that aren't related to the current URL.

So the test passes even though the underlying functionality is not working as expected.

Looks like this was introduced in https://www.drupal.org/commitlog/commit/2128/1cdb06e3974d0788d62c46b9beb...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nicrodgers created an issue. See original summary.

nicrodgers’s picture

Patch attached, now uses assertURL to make sure you're actually on that URL.

I expect the test to fail now, but that is correct, due to #2852312: Password expiration not set to false on update

Status: Needs review » Needs work

The last submitted patch, 2: password_policy-2854942-brokenTest-02.patch, failed testing.

nicrodgers’s picture

Re-rolled patch to include the updated test and the patch from #2852312: Password expiration not set to false on update so that this can now pass.

Status: Needs review » Needs work

The last submitted patch, 4: password_policy-2854942-brokenTest-04.patch, failed testing.

nicrodgers’s picture

Ok, now I get the comment... Expecting this to fail.

Status: Needs review » Needs work

The last submitted patch, 6: password_policy-2854942-brokenTest-06.patch, failed testing.

nicrodgers’s picture

This patch includes the fix to the test, and the patch from #2852312: Password expiration not set to false on update.. hopefully this will now pass.

nicrodgers’s picture

nerdstein’s picture

Code review of patch #6 looks good.

I am going to submit an updated patch based on my feedback of https://www.drupal.org/node/2852312

This should help get this moving.

nerdstein’s picture

Manual test of the patch in comment #6 with the new patch here https://www.drupal.org/node/2852312#comment-11958424

After adding the first patch, all tests run great.

Oddly, after adding the patch in #6, tests are repeatedly failing in PasswordPolicyInterfaceTest (which is really odd because the patch is for PasswordResetBehaviorsTest). I'm trying to make sure this is not an issue with my local (as the tests passed above). More to come soon....

nerdstein’s picture

I have upgraded everything up to 8.2.3 (including composer dependencies).

The error (which was the same of the interface test) is happening in the PasswordResetBehaviorsTest:

---- Drupal\password_policy\Tests\PasswordResetBehaviorsTest ----


Status    Group      Filename          Line Function                            
--------------------------------------------------------------------------------
Pass      Other      run-tests.sh       792 simpletest_script_run_one_test()   
    Enabled modules: system, user, node, dblog, ctools, config, field,
    datetime, file, image, options, entity_reference, text, field_ui,
    password_policy
Pass      Role       PasswordResetBeha   52 Drupal\password_policy\Tests\Passwo
    Created role ID 'c9re1zyj' with name
    '{J7(>&>I'.
Pass      Role       PasswordResetBeha   52 Drupal\password_policy\Tests\Passwo
    Created permissions: administer site configuration, administer users,
    administer permissions, manage password reset, administer account settings,
    administer user fields, administer user form display, access administration
    pages
Pass      User login PasswordResetBeha   52 Drupal\password_policy\Tests\Passwo
    User created with name bc23waky and pass nHSFmqPN9Y
Pass      Browser    PasswordResetBeha   54 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/login returned 200 (31.81 KB).
Pass      Browser    PasswordResetBeha   54 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/login"
Pass      Browser    PasswordResetBeha   54 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/2 returned 200 (28.41 KB).
Pass      Browser    PasswordResetBeha   54 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/2"
Pass      User login PasswordResetBeha   54 Drupal\password_policy\Tests\Passwo
    User bc23waky successfully logged in.
Pass      Other      PasswordResetBeha   58 Drupal\password_policy\Tests\Passwo
    Last password reset was not set on user add
Pass      Other      PasswordResetBeha   59 Drupal\password_policy\Tests\Passwo
    Password expiration field is not set to zero on user add
Pass      Role       PasswordResetBeha   62 Drupal\password_policy\Tests\Passwo
    Created role ID 'tegcjgrg' with name
    'Qz9T>&\\@'.
Pass      Browser    PasswordResetBeha   65 Drupal\password_policy\Tests\Passwo
    GET http://localhost/admin/people/create returned 200 (88.17 KB).
Pass      Browser    PasswordResetBeha   65 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/admin/people/create"
Pass      Browser    PasswordResetBeha   73 Drupal\password_policy\Tests\Passwo
    GET http://localhost/admin/people/create returned 200 (88.63 KB).
Pass      Browser    PasswordResetBeha   73 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/admin/people/create"
Pass      Browser    PasswordResetBeha   80 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/3/edit returned 200 (88.67 KB).
Pass      Browser    PasswordResetBeha   80 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/3/edit"
Pass      Browser    PasswordResetBeha   84 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/3/edit returned 200 (89.04 KB).
Pass      Browser    PasswordResetBeha   84 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/3/edit"
Pass      Browser    PasswordResetBeha   87 Drupal\password_policy\Tests\Passwo
    GET http://localhost/admin/config/security/password-policy/add returned 200
    (34.85 KB).
Pass      Browser    PasswordResetBeha   87 Drupal\password_policy\Tests\Passwo
    Valid HTML found on
    "http://localhost/admin/config/security/password-policy/add"
Pass      Browser    PasswordResetBeha   94 Drupal\password_policy\Tests\Passwo
    GET
    http://localhost/admin/config/security/password-policy/test/constraint?js=nojs
    returned 200 (34.79 KB).
Pass      Browser    PasswordResetBeha   94 Drupal\password_policy\Tests\Passwo
    Valid HTML found on
    "http://localhost/admin/config/security/password-policy/test/constraint?js=nojs"
Pass      Browser    PasswordResetBeha   96 Drupal\password_policy\Tests\Passwo
    GET
    http://localhost/admin/config/security/password-policy/test/roles?js=nojs
    returned 200 (36.17 KB).
Pass      Browser    PasswordResetBeha   96 Drupal\password_policy\Tests\Passwo
    Valid HTML found on
    "http://localhost/admin/config/security/password-policy/test/roles?js=nojs"
Fail      Browser    PasswordResetBeha  101 Drupal\password_policy\Tests\Passwo
    POST
    http://localhost/admin/config/security/password-policy/test/roles?js=nojs
    returned 0 (0 bytes).
Pass      Browser    PasswordResetBeha  104 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/login returned 200 (31.81 KB).
Pass      Browser    PasswordResetBeha  104 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/login"
Pass      Browser    PasswordResetBeha  104 Drupal\password_policy\Tests\Passwo
    User was logged out.
Pass      Logout     PasswordResetBeha  104 Drupal\password_policy\Tests\Passwo
    Username field found.
Pass      Logout     PasswordResetBeha  104 Drupal\password_policy\Tests\Passwo
    Password field found.
Pass      Browser    PasswordResetBeha  107 Drupal\password_policy\Tests\Passwo
    GET
    http://localhost/cron/If6v78TbFx1Wbp4rNsU86AO1w9gRYe53PDFsRzHLIn7XKp_pAnqCDNQR42JBf7VkygIsjjT7JQ
    returned 204 (0 bytes).
Pass      Browser    PasswordResetBeha  110 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/login returned 200 (31.81 KB).
Pass      Browser    PasswordResetBeha  110 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/login"
Pass      Browser    PasswordResetBeha  110 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/3/edit returned 200 (72.15 KB).
Pass      Browser    PasswordResetBeha  110 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/3/edit"
Pass      Other      PasswordResetBeha  111 Drupal\password_policy\Tests\Passwo
    User should be sent to their account form after expiration
Pass      Browser    PasswordResetBeha  112 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/login returned 200 (31.81 KB).
Pass      Browser    PasswordResetBeha  112 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/login"
Pass      Browser    PasswordResetBeha  112 Drupal\password_policy\Tests\Passwo
    User was logged out.
Pass      Logout     PasswordResetBeha  112 Drupal\password_policy\Tests\Passwo
    Username field found.
Pass      Logout     PasswordResetBeha  112 Drupal\password_policy\Tests\Passwo
    Password field found.
Pass      Other      PasswordResetBeha  115 Drupal\password_policy\Tests\Passwo
    Created content type wid90q3o.
Pass      Browser    PasswordResetBeha  128 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/login returned 200 (31.81 KB).
Pass      Browser    PasswordResetBeha  128 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/login"
Pass      Browser    PasswordResetBeha  129 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/3/edit returned 200 (72.15 KB).
Pass      Browser    PasswordResetBeha  129 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/3/edit"
Pass      Browser    PasswordResetBeha  130 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/3/edit returned 200 (72.15 KB).
Pass      Browser    PasswordResetBeha  130 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/3/edit"
Pass      Other      PasswordResetBeha  139 Drupal\password_policy\Tests\Passwo
    User should be sent back to their account form instead of the node
Pass      Browser    PasswordResetBeha  142 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/3/edit returned 200 (71.72 KB).
Pass      Browser    PasswordResetBeha  142 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/3/edit"
Pass      Browser    PasswordResetBeha  147 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/3/edit returned 200 (72.09 KB).
Pass      Browser    PasswordResetBeha  147 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/3/edit"
Pass      Other      PasswordResetBeha  151 Drupal\password_policy\Tests\Passwo
    Password expiration field should be empty after changing password
Pass      Browser    PasswordResetBeha  154 Drupal\password_policy\Tests\Passwo
    GET http://localhost/node/1 returned 200 (31.08 KB).
Pass      Browser    PasswordResetBeha  154 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/node/1"
Pass      Other      PasswordResetBeha  163 Drupal\password_policy\Tests\Passwo
    User should have access to the node now
Pass      Browser    PasswordResetBeha  164 Drupal\password_policy\Tests\Passwo
    GET http://localhost/user/login returned 200 (31.81 KB).
Pass      Browser    PasswordResetBeha  164 Drupal\password_policy\Tests\Passwo
    Valid HTML found on "http://localhost/user/login"
Pass      Browser    PasswordResetBeha  164 Drupal\password_policy\Tests\Passwo
    User was logged out.
Pass      Logout     PasswordResetBeha  164 Drupal\password_policy\Tests\Passwo
    Username field found.
Pass      Logout     PasswordResetBeha  164 Drupal\password_policy\Tests\Passwo
    Password field found.

I am going to do some manual testing to see why this test is not passing.

nerdstein’s picture

Status: Needs review » Fixed

This is fine, I was dealing with performance issues locally that were resolved with a fresh site install.

I am merging in the patch from #6 and will await testing of the #9 patch from here: https://www.drupal.org/node/2852312#comment-11958424

  • nerdstein committed 8bccd4e on 8.x-3.x authored by nicrodgers
    Issue #2854942 by nicrodgers: PasswordResetBehaviorsTest isn't asserting...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.