Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
javascript
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Jul 2023 at 12:22 UTC
Updated:
18 Jun 2025 at 00:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
longwaveWe are having trouble upgrading Nightwatch past 2.4.2 already, see #3323988: Update Nightwatch from 2.4.2 to 2.6.19 - whatever is broken there needs fixing first.
Comment #3
longwaveThis change will only be committed to 11.x (10.2.x) and will not be backported to 10.1.x. 10.0.x or any version of 9.x.
Comment #7
swrdfish commentedI was able to get nightwatch 3.0.1 running and have submitted a merge PR. But several tests were failing. I am trying to setup a local environment to try and debug the tests, till now I have not been able to setup a test environment.
Comment #9
longwaveThe
domainsetting in cookies does not work the same way when w3c mode is enabled, removing it from the SIMPLETEST_USER_AGENT cookie works locally for me.Comment #12
longwaveCrediting contributors to #3323988: Update Nightwatch from 2.4.2 to 2.6.19
Comment #13
spokjeDrupalCI doesn't seem to pick up on the five
NightwatchAssertErrors I see in the full test log.Adding
Needs followupfor that.Even whilst the full focus is, rightfully so, on the GitLab move, having a green TestBot whilst there are errors is bad.
Comment #14
spokjeAlso, we can now drop our workaround with the
"resolutions"-section incore/package.json, since nightwatch 3.1.0 has a "safe" version of the semver-package.Comment #15
effulgentsia commentedI don't know if there are any differences between Chrome 106 and Chrome 115 that are relevant to this issue, but FYI that I just now opened #3377509: Update Chrome container to use newer version (115 or higher).
Comment #16
longwaveoliveroStickyHeaderToggleTestfails due togetLocationInView()not working now we are in w3c mode: https://github.com/nightwatchjs/nightwatch/issues/3091We will need to find a workaround for that.
Comment #17
longwaveThe other issues are due to sending special keys such as Tab or arrow-down - this also no longer seems to work, the driver responds with
Comment #18
spokjeComment #19
spokjeWhoops, got to a similar solution as @longwave, but was trying to post it in my [ignore]-patch issue.
EDIT: Well, the testrun over there was promising, let's put it into the MR.
Ideally we will be only left with the
getLocationInView-replacement.Comment #20
spokjeI think we have another candidate follow-up issue:
core/tests/Drupal/Nightwatch/Tests/claroAutocompleteTest.jspasses, but the autocomplete JavaScript used in the test seems to be 404?artifact
Comment #21
spokjeSo, per usual, @longwave found the correct way.
Also, per usual, I stumble over the weirdest stuff:
Commit 8ebeb952 has only one error showing in the full CI log, by now we know not to trust the green label).
Yet looking at the result artifacts created by nightwatch, we have 5 failures.
I strongly suspect any Nightwatch-test ending with a
in an
execute()will not show up in the log when it fails.It's seems we're _really_ want to make it hard to see a nightwatch failure :/
Yet Another Follow-Up, me thinks.
Comment #22
longwaveNot sure what's happening with the Nightwatch output, can't reproduce this locally - yarn exits with a non-zero return code which should indicate failure, but on DrupalCI it just seems to abort and truncate the log.
Comment #23
spokjeSo if we dig really deep (https://dispatcher.drupalci.org/job/drupal_patches/195437/artifact/jenki...), we see that there are 2 remaining failing tests.
The fact that we have to dig _really_ deep, since:
1) TestBot is green anyway
2) You have to look at the full log to see any reported fail in the log
3) Which then turns out to not even show all the fails
leaves me wondering if there's any use of a test subsystem that is giving a false sense of security and most probably have been doing so since it introduction without being noticed by anybody since it introduction in 2018.
Add to that the fact we didn't seem to mind too much, when it couldn't be updated when 9.5/10.0 came out, nor when 10.1 was released, is making me feel Nightwatch-testing isn't getting same amount of attention/love the rest of core is getting.
For me, it's a reason to spend my time elsewhere in the queue.
I think it's not worth putting time in upgrading a test system that's "green" anyway, unless you really, really spend time to find a failure that is big enough to show a glimpse of the fail showing up in the top reporting layer.
Comment #25
andypostit needs CR to point changes in tests
Comment #26
catchOpened #3387927: Failing Nightwatch jobs result in a passed pipeline job but agreed with #23 it's not clear how useful the nightwatch suite is if it's been giving us false negatives for years.
This is also blocking further progress on #3386474: [omnibus] Speed up gitlab ci runs now since after the changes on that issue, nightwatch becomes the joint-slowest test group.
Comment #27
mstrelan commentedCan we skip the failing tests and open a follow up issue for each (or all) of them?
https://nightwatchjs.org/guide/running-tests/skipping-disabling-tests.html
Comment #28
catch@mstrelan yeah I think that's reasonable, otherwise any new nightwatch tests we add could also end up blocking this issue too.
Comment #29
wim leersIt took me a very, very long time to get Nightwatch tests to pass on GitLab CI for a contrib module I maintain.
Turns out the root cause is that the d.o GitLab template uses the Nightwatch test runner in a very good way but sadly broken way: #3389763: Impossible to run only Nightwatch tests in a given directory (f.e. for contrib modules).
I've noticed this too in the past few years, occasionally, specifically while working on Nightwatch tests. I think the very low number of Nightwatch tests in Drupal core is an important factor in how this has slipped through the cracks. Another important factor seems to be the less-than-awesome mapping of DrupalCI "number of tests" (and failures) to actual reports. (Meaning: it's AFAICT not actually limited to Nightwatch tests.)
Hopefully the transition to GitLab CI will make things more precise, standardized and reliable!
Comment #30
spokjeComment #31
spokjeComment #33
quietone commentedI had a go at rebasing this. There were conflicts in the following files and I may have not done it correctly. Nightwatch tests do not complete. They hang at installProfileTest.js. See https://git.drupalcode.org/project/drupal/-/jobs/770136
Comment #34
longwave#3421202: Enable W3C-compliant webdriver testing landed which gives us a newer Selenium/Chrome to talk to and which may solve the issues we were seeing here.
Comment #35
longwaveLocally I bumped to Nightwatch 3.7.0 which works OK with the new Selenium setup and latest Chrome, but tests appear to crash and then the Selenium server no longer responds:
I was expecting further output here, if I run this on the older version of Nightwatch it ends as follows:
If I then run the test again it hangs:
Restarting the Selenium container fixes it.
Will push this branch up anyway but not sure what's happened here at all.
Comment #36
longwaveapi.execute()takes the callback as the third argument instead of the second now, it seems.Comment #37
longwaveLast run was looking promising until it appeared to hang after installProfileTest: https://git.drupalcode.org/project/drupal/-/jobs/2214554
Comment #38
longwaveI'm slightly amazed that it was only another call to
execute()that needed fixing, but the run is green.Comment #39
spokjeI think we can now also drop the
resloutionssection fromcore/package.json.These were only needed to keep the dependencies of the old version of
nightwatchclashing with our other JS-dependencies.Comment #40
spokjeTests are still green.
For the record, just removed the
resolutions-section and did a$ yarn install.Comment #41
xjmComment #42
xjmThis should have been an 11.0.0 beta blocker, but got missed. We might make an exception to policy and commit this to 11.0.x despite that branch being almost-stable, because as @longwave points out being on a very old version of Nightwatch means being stuck with old Chrome in our tests.
If we do commit it, it should go in the release notes. The CR and release notes should also mention any gotchas that have surfaced from the updates (and linking out to Nightwatch's own release notes for more details also a good strategy).
Comment #43
smustgrave commentedNot best to review this only moving to NW for the open tags and mainly because MR needs a rebase.
Comment #44
spokjeComment #45
spokjeRebased.
Although there are still release notes and CR needed, all tests are green and some manual poking would be more than welcome IMHO.
Comment #46
spokjeRemoved the "Needs follow-up"-tag since my woes in #13 seem to be resolved already.
Comment #47
spokjeComment #48
catchComment #49
catchI added a CR but it just points to Drupal's nightwatch docs and nightwatch's 3.x post, not sure what else there is to say tbh. https://www.drupal.org/node/3467273
The release note as it is looks OK except I updated the version from 2.0.0 to 3.0.0 which looked like a typo.
Comment #50
catchBumping this to critical, every other core test run fails on nightwatch random test failures, and even if this doesn't help, we need to rule it out.
Comment #51
smustgrave commentedLeaning on the tests passing that upgrading doesn't break anything.
Not sure a good to see what contrib modules are using nightwatch tests but if being honest knowing how difficult it is to get nightwatch running locally I would bet not many would be using it. So probably safe.
Comment #52
mstrelan commentedOpened follow up #3467492: [policy, no patch] Replace Nightwatch with Playwright. Feel free to tell me it's a straight-up won't fix.
Comment #54
catchLet's get this into 11.x so if it somehow makes stability issues worse (doesn't seem possible, but who knows) we'll be able to see them with plenty of notice before the 11.1.0 release.
Comment #56
quietone commentedComment #58
xjmAmending attribution.