@@ -27,17 +27,35 @@ class WxTTest extends BrowserTestBase {
2727 */
2828 protected $ strictConfigSchema = FALSE ;
2929
30+ /**
31+ * Disable one-time login links for functional tests.
32+ *
33+ * @var bool
34+ */
35+ protected bool $ useOneTimeLoginLinks = FALSE ;
36+
3037 /**
3138 * Test for the login.
3239 */
3340 public function testWxtLogin () {
34- // Create a user to check the login.
35- $ user = $ this ->createUser (['access toolbar ' ]);
41+ $ user = $ this ->createUser ();
3642
37- // Log in our user.
38- $ this ->drupalLogin ($ user );
43+ // Always hit the actual login form route.
44+ $ this ->drupalGet ('user/login ' );
45+ fwrite (STDOUT , "\nDEBUG URL: " . $ this ->getSession ()->getCurrentUrl () . "\n" );
46+ $ page = $ this ->getSession ()->getPage ();
47+ fwrite (STDOUT , "\nDEBUG HTML (first 500 chars): \n" . substr ($ page ->getContent (), 0 , 500 ) . "\n" );
48+
49+ $ page = $ this ->getSession ()->getPage ();
50+ $ page ->fillField ('name ' , $ user ->getAccountName ());
51+ $ page ->fillField ('pass ' , $ user ->passRaw );
52+
53+ // Click submit by id.
54+ $ page ->pressButton ('edit-submit ' );
55+
56+ $ this ->assertSession ()->statusCodeEquals (200 );
57+ $ this ->assertAuthenticated ();
3958
40- // If we were anonymous we'd be sent to /user/login.
4159 $ this ->drupalGet ('en/user ' );
4260 $ this ->assertSession ()->statusCodeEquals (200 );
4361 $ this ->assertSession ()->addressNotMatches ('#/user/login# ' );
0 commit comments