[random test failure] Toolbar Test (toolbarTest.js)

Created on 29 April 2025, about 1 month ago

Problem/Motivation

Nightwatch test is flakey. For some reason nightwatch is not able to press the confirm button to install the toolbar module.

│   ✖ NightwatchAssertError                                                                                                                                                                                  │
│      Timed out while waiting for element <#system-modules-confirm-form, #system-modules-non-stable-confirm-form> to be present for 10000 milliseconds. - expected "found" but got: "not found" (10446ms)   │
│                                                                                                                                                                                                            │
│       Error location:                                                                                                                                                                                      │
│       /builds/project/drupal/core/tests/Drupal/Nightwatch/Commands/drupalInstallModule.js:30                                                                                                               │
│       –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––                                                                                                                │
│        28 |     if (force) {                                                                                                                                                                               │
│        29 |       // Click `Continue` if applicable.                                                                                                                                                       │
│        30 |       this.waitForElementPresent(                                                                                                                                                              │
│        31 |         '#system-modules-confirm-form, #system-modules-non-stable-confirm-form',                                                                                                               │
│        32 |         10000,                                                                                                                                                                                 │
│       –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––    

Steps to reproduce

https://git.drupalcode.org/project/drupal/-/jobs/5054046/viewer
https://git.drupalcode.org/project/drupal/-/jobs/5011069/viewer

Proposed resolution

Not sure, but ideally we can install modules in tests without clicking buttons in the UI

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

toolbar.module

Created by

🇦🇺Australia mstrelan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mstrelan
  • Merge request !11985Resolve #3521639 "Toolbar test" → (Closed) created by mstrelan
  • Pipeline finished with Failed
    about 1 month ago
    Total: 326s
    #485374
  • 🇦🇺Australia mstrelan

    Not sure how to reproduce this one, but if the failing part doesn't exist then it can't fail, right?

    I had a go at using the setupFile arg to provide the setup required for the test. Before doing this, the nightwatch test would complete in around 26 seconds, performing 11 HTTP requests before getting to the login step. Once I moved the module and permission setup to a setup file this was reduced to around 16 seconds, with 1 HTTP request before the login. But to use ::createUser I had to borrow a few assert methods from phpunit, and I figured we could just assign the perms to anonymous user. This eliminated all initial HTTP requests. I then noticed there were several permissions that were not required for the test to pass, so I removed those as well.

    I guess this should be postponed on Provide PHP helpers for Nightwatch tests to speed up routine operations Active , but if it helps with the current random fails maybe we can keep it as it is until we have some generic helpers.

  • Pipeline finished with Success
    about 1 month ago
    Total: 1468s
    #485378
  • 🇺🇸United States smustgrave

    Seems pretty straight forward, only part I second guess was changing from a random role to anonymous. But frankly nightwatch is more pain then value I believe so say why not.

  • 🇬🇧United Kingdom catch

    I had to think about using the anonymous user as well, but as long as they can see the right things it's fine I think, we're not testing access so the less setup the better.

    We could try to add more generic helpers for nightwatch tests but might want to do that as part of moving to functional js + axe and playwright as alternatives - e.g. when we refactor the tests more. If we get to the point where nightwatch tests actually pass, then it'll make it more confident about conversions of those tests, vs reproducing the same random failures.

    Committed/pushed to 11.x and cherry-picked to 11.2.x, thanks!

    • catch committed f001fdca on 11.2.x
      Issue #3521639 by mstrelan, smustgrave: [random test failure] Toolbar...
    • catch committed f4e4dd42 on 11.x
      Issue #3521639 by mstrelan, smustgrave: [random test failure] Toolbar...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024