Problem/Motivation
The output of the nightwatch job on GitLab CI is not easily readable.
After the first test, the output seems to lack newlines:
┌ ────────────────── ✔ default: Tests/toolbarApiTest.js ─────────────────────┐│ ││ ││ [Tests/Toolbar Api Test] Test Suite ││ ────────────────────────────────────────────────────────────────────── ││ Using: chrome (106.0.5249.103) on LINUX. ││ - Loading url: http://localhost/subdirectory ││ ℹ Loaded url http://localhost/subdirectory in 3603ms ││ - Loading url: http://localhost/subdirectory/user/reset/1/1699769393/rAx ││ XXMRqoilkKkm9F1ftirF9ByGekM_5ilpoeJ7cOds/login ││ ℹ Loaded url http://localhost/subdirectory/user/reset/1/1699769393/rAxXX ││ MRqoilkKkm9F1ftirF9ByGekM_5ilpoeJ7cOds/login ││ in 1284ms ││ - Loading url: http://localhost/subdirectory/admin/modules ││ ℹ Loaded url http://localhost/subdirectory/admin/modules in 1468ms ││ ✔ Element <form.system-modules [name="modules[toolbar][enable]"]> was ││ visible after 25 milliseconds. ││ ✔ Element <#system-modules-confirm-form> was present after 1542 ││ milliseconds. ││ ✔ Element <form.system-modules ││ [name="modules[toolbar][enable]"]:disabled> was present after 45 ││ milliseconds. ││ - Loading url: http://localhost/subdirectory/user/logout ││ ℹ Loaded url http://localhost/subdirectory/user/logout in 245ms ││ - Loading url: http://localhost/subdirectory/user/reset/1/1699769407/C9F ││ cHTHML3hD-dyWjgTiXgMSfGlriQJUzj-FSH0GTeE/login ││ ℹ Loaded url http://localhost/subdirectory/user/reset/1/1699769407/C9FcH ││ THML3hD-dyWjgTiXgMSfGlriQJUzj-FSH0GTeE/login ││ in 356ms ││ - Loading url: http://localhost/subdirectory/admin/people/roles/add ││ ℹ Loaded url http://localhost/subdirectory/admin/people/roles/add in ││ 421ms ││ ✔ Expected element <.user-role-form .machine-name-value> to be visible ││ in 2000ms (67ms) ││ - Loading url: http://localhost/subdirectory/admin/people/permissions ││ ℹ Loaded url http://localhost/subdirectory/admin/people/permissions in ││ 1883ms ││ - Loading url: http://localhost/subdirectory/admin/people/permissions ││ ℹ Loaded url http://localhost/subdirectory/admin/people/permissions in ││ 731ms ││ - Loading url: http://localhost/subdirectory/user/logout ││ ℹ Loaded url http://localhost/subdirectory/user/logout in 164ms ││ - Loading url: http://localhost/subdirectory/user/reset/1/1699769414/I2A ││ V9n1kyOJ9KG70PnB6GJG7qr9sFcw9Ei6gT-6rqNI/login ││ ℹ Loaded url http://localhost/subdirectory/user/reset/1/1699769414/I2AV9 ││ n1kyOJ9KG70PnB6GJG7qr9sFcw9Ei6gT-6rqNI/login ││ in 269ms ││ - Loading url: http://localhost/subdirectory/admin/people/create ││ ℹ Loaded url http://localhost/subdirectory/admin/people/create in 389ms ││ ✔ User "user" was created successfully (723ms) ││ (node:117) MaxListenersExceededWarning: Possible EventEmitter memory ││ leak detected. 11 error listeners added to [CommandLoader]. Use ││ emitter.setMaxListeners() to increase limit ││ (Use `node --trace-warnings ...` to show where the warning was created) ││ - Loading url: http://localhost/subdirectory/user/logout ││ ℹ Loaded url http://localhost/subdirectory/user/logout in 145ms ││ - Loading url: http://localhost/subdirectory/user/login ││ ℹ Loaded url http://localhost/subdirectory/user/login in 102ms ││ (node:117) MaxListenersExceededWarning: Possible EventEmitter memory ││ leak detected. 11 error listeners added to [CommandLoader]. Use ││ emitter.setMaxListeners() to increase limit ││ ✔ Passed [equal]: The user "user" was logged in. ││ ││ – Drupal.Toolbar.models ││ - Loading url: http://localhost/subdirectory/ ││ ℹ Loaded url http://localhost/subdirectory/ in 267ms ││ ✔ Element <#toolbar-administration> was present after 18 milliseconds. ││ ✔ Passed [deepEqual]: Keys to check match ││ ✔ Passed [equal]: has menu model ││ ✔ Passed [equal]: menu model is an object ││ ✔ Passed [equal]: has toolbar model ││ ✔ Passed [equal]: toolbar model is an object ││ ✔ Passed [equal]: get("activeTab") has expected result ││ ✔ Passed [equal]: get("activeTray") has expected result ││ ✔ Passed [equal]: get("isOriented") has expected result ││ ✔ Passed [equal]: get("isFixed") has expected result ││ ✔ Passed [equal]: get("areSubtreesLoaded") has expected result ││ ✔ Passed [equal]: get("isViewportOverflowConstrained") has expected ││ result ││ ✔ Passed [equal]: get("orientation") has expected result ││ ✔ Passed [equal]: get("locked") has expected result ││ ✔ Passed [equal]: get("isTrayToggleVisible") has expected result ││ ✔ Passed [equal]: get("height") has expected result ││ ✔ Passed [equal]: get("offsets") bottom has expected result ││ ✔ Passed [equal]: get("offsets") left has expected result ││ ✔ Passed [equal]: get("offsets") right has expected result ││ ✔ Passed [equal]: get("offsets") top has expected result ││ ✔ Passed [equal]: get("subtrees") has expected result ││ ✔ default: Tests/toolbarApiTest.js [Tests/Toolbar Api Test] ││ Drupal.Toolbar.models (471ms) ││ ││ – Change tab ││ - Loading url: http://localhost/subdirectory/ ││ ℹ Loaded url http://localhost/subdirectory/ in 185ms ││ ✔ Element <#toolbar-administration> was present after 14 milliseconds. ││ ✔ Passed [deepEqual]: Keys to check match ││ ✔ Passed [equal]: has menu model ││ ✔ Passed [equal]: menu model is an object ││ ✔ Passed [equal]: has toolbar model ││ ✔ Passed [equal]: toolbar model is an object ││ ✔ Passed [equal]: get("activeTab") has expected result ││ ✔ Passed [equal]: get("activeTray") has expected result ││ ✔ default: Tests/toolbarApiTest.js [Tests/Toolbar Api Test] Change tab ││ (577ms) ││ ││ – Change orientation ││ - Loading url: http://localhost/subdirectory/ ││ ℹ Loaded url http://localhost/subdirectory/ in 227ms ││ ✔ Element <#toolbar-administration> was present after 42 milliseconds. ││ ✔ Passed [deepEqual]: Keys to check match ││ ✔ Passed [equal]: get("orientation") has expected result ││ ✔ Passed [equal]: changing orientation has expected result ││ ✔ default: Tests/toolbarApiTest.js [Tests/Toolbar Api Test] Change ││ orientation (587ms) ││ ││ – Open submenu ││ - Loading url: http://localhost/subdirectory/ ││ ℹ Loaded url http://localhost/subdirectory/ in 243ms ││ ✔ Element <#toolbar-administration> was present after 21 milliseconds. ││ ✔ Passed [deepEqual]: Keys to check match ││ ✔ Passed [equal]: get("orientation") has expected result ││ ✔ Passed [equal]: opening submenu has expected result ││ ✔ default: Tests/toolbarApiTest.js [Tests/Toolbar Api Test] Open submenu ││ (695ms) ││ │└──────────────────────────────────────────────────────────────────────────────┘
https://git.drupalcode.org/project/drupal/-/jobs/316331#L149 (Yes, this is all just one output line...)
Screenshot here: https://www.drupal.org/files/issues/2023-11-12/before.jpg
Problem comes out of a dependency of nightwatch
called boxen
(https://www.npmjs.com/package/boxen).
This was fixed in version 7.0.1, however nightwatch
is (and also will be in 3.x) using 5.1.2.
Fix PR is here: https://github.com/sindresorhus/boxen/pull/81
Steps to reproduce
Proposed resolution
- Create patch for boxen
5.1.2 based on the mentioned PR
- Apply patch with patch-package (https://www.npmjs.com/package/patch-package)
- Output of the nightwatch job on GitLab should now be multi-lined an easy readable. See https://git.drupalcode.org/issue/drupal-3401047/-/jobs/317062#L140
Remaining tasks
Since this MR is adding two new (development-only) JavaScript packages, which seem to be the standard for patching with yarn
1.x, these might need an evaluation?
Note that yarn
2.x+ has onboard patch support, so these packages will be obsolete after upgrading yarn
.