Needs work
Project:
Drupal core
Version:
main
Component:
javascript
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Jan 2024 at 06:24 UTC
Updated:
28 Mar 2025 at 12:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
spokjeComment #4
spokjeComment #5
smustgrave commentedChange seems good.
Searched for .drupalRelativeURL('/admin/modules') and saw the 2 instances were updated.
Hopefully this helps move nightwatch tests to be more useable.
Comment #6
longwaveGood idea, we have the API so let's use it! Backported to 10.2.x to keep tests in sync.
Committed and pushed a2f51b88d5 to 11.x and 977e680afb to 10.2.x. Thanks!
Comment #13
andypostreverted
Comment #14
alexpottUnfortunately this resulted in a flood of Nightwatch errors in modules/ckeditor5/tests/src/Nightwatch/Tests/ckEditor5CodeSyntaxTest.js - I could not get this to pass locally without reverting this.
I suspect this is due to async and perform doing a retry and things getting very broken.
Comment #17
longwaveModified
drupalInstallModule()so it can install more than one module at a time.Comment #18
longwaveI don't even think the test needs Field UI, we could just remove that, but we should probably fix the multiple-install issue while we are here?
Comment #19
alexpottYeah swapping the order of the modules being installed in
before(browser) {completely breaks the modules/ckeditor5/tests/src/Nightwatch/Tests/ckEditor5CodeSyntaxTest.js locally.Also what is super fun is that core/modules/ckeditor5/tests/src/Nightwatch/Tests/ckEditor5EditorHeightTest.js does not fail :) It tries to enable 2 modules… and again because the test does not actually need field ui it is fine. But
somehow makes it pass.
We need to do here is add a test for enabling multiple modules via something like
in the before section and then go to the module screen and see if they are installed. Because drupalInstallModule should be chainable.
Comment #20
longwaveSeems to be because drupalInstallModule() does not wait for anything. If you remove this:
then field_ui is installed *after* the test runs!
If I add
.waitForElementPresent('body')before or after.perform()then it seems to pass consistently.Comment #21
spokjeFun stuff, I've been working with Nightwatch a bit lately, and honestly I don't see an added value for it in the Drupal sphere.
It's great when you don't have
FunctionalJavascriptTest, but we _do_ have that.For me it's buggy, and not well documented nor maintained.
The only plus sides of it I can think of is that it works in JavaScript and we have the a11y tests in there.
Downsides of those are that we don't have a vast user/contributor base of JavaScript savy people and most of the a11y tests in Nightwatch are commented out, waiting for someone to fix them. Not much traction on that, or I am looking in the wrong issues.
I seriously think we might want to consider if we want to put any more effort into it, any version higher then we're using now locks up when using multiple workers. Not something I look forward to solve...
It might be time to consider if we want to convert every Nightwatch test to a FunctionalJavascriptTest and move away from it.
Disclaimer: n=1, I am not a JavaScript developer, etc. etc.
Comment #22
smustgrave commentedTo add to that, think why a lot of people probably don't contribute it's very difficult to get running locally.
Comment #23
spokjeBack to the MR:
I think we're missing converting
core/modules/ckeditor5/tests/src/Nightwatch/Tests/ckEditor5EditorHeightTest.jsto the new installing-multiple-modules-in-one-go?Comment #24
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #25
catchI am wondering when the last time was we added any test coverage vs. dealing with nightwatch failures. Should probably open a new issue to discuss whether we want to think about removing it.
Comment #26
spokjeI know @WimLeers uses Nightwatch frequently both in core ckeditor5 and some of "his" contrib modules.
Besides that: Not much traction I can see.
Even when the outcome is "We need it, don't remove it!", we at the very least have an indication that it's used (and loved) and maybe even the amount of users/lovers.
I really believe Nightwatch is great if you don't have any FE-testing in place, but IMHO it's on all fronts outclassed by our FunctionalJavascript test suite.
TLDR; O yes, please open such an issue.
Comment #27
alexpottRe removing Nightwatch - it is doing somethings our PHP based JS testing framework cannot do.
Comment #28
spokjeThanks @alexpott.
I'll happily work around it :)
Comment #30
murzIn the scope of the Test Helpers module, I implemented a Nightwatch command
thInstallModules()that installs one or even several modules at once on the Drupal side without any click in the browser - it works 1000 times quicker than clicking in the browser (log in as admin, go to modules, etc.), cus does just one GET request in the background and that's it. Here it is: https://git.drupalcode.org/project/test_helpers/-/blob/1.5.x/tests/modul...Via the same way, we can optimize any other popular actions for tests, so I already implemented more Nightwatch commands too:
thDrupalFetchURL(),thInstallModules(array)thSetConfig(),thLogout(), etc.You can look at the usage examples in the Commercetools module's Nightwatch tests.
So, maybe let's implement the same functions, but in Drupal Core?
Comment #31
murzAnother way to speed up installing and enabling modules is creating test profiles, where just list all required modules. Also, we can deploy the required configuration from this test profile. And even more, using the install hook, we can add more backend PHP magic there, that is needed for tests.
See https://git.drupalcode.org/project/commercetools/-/blob/2.0.x/modules/co...
and https://git.drupalcode.org/project/commercetools/-/blob/2.0.x/tests/prof... as examples.
Comment #32
murzBy the way, here #3464642: [PP-1] Provide PHP helpers for Nightwatch tests to speed up routine operations is a more general issue about such Nightwatch helpers.
Comment #33
catch