Closed (fixed)
Project:
Scheduler
Version:
2.x-dev
Component:
Testing
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
7 Oct 2022 at 16:13 UTC
Updated:
24 Oct 2022 at 14:09 UTC
Jump to comment: Most recent
The javascript tests fail when run on Drupal 10 with the following:
Drupal\Tests\scheduler\FunctionalJavascript\SchedulerJavascriptDefaultTimeTest::testTimeWhenSchedulingIsRequired with data set "#node-1" ('node', 'testpage', 'publish')
Behat\Mink\Exception\ResponseTextException: The pattern /Publish required, datepickerFormat \= m\/d\/Y has been (created|updated)/ was not found anywhere in the text of the current page.
/var/www/html/vendor/behat/mink/src/WebAssert.php:811
/var/www/html/vendor/behat/mink/src/WebAssert.php:294
/var/www/html/core/tests/Drupal/Tests/WebAssert.php:852
/var/www/html/modules/contrib/scheduler/tests/src/FunctionalJavascript/SchedulerJavascriptDefaultTimeTest.php:95
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
Could be related to PHPUnit version, or other testing dependencies that are different on D10 compared to D9.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
vishalkhode commentedComment #5
jonathan1055 commentedThanks for working on this, looks good that the tests pass. I did not know where to start, so just created the issue ready to start investigating. Can you briefly explain why the change to use
oncehas fixed the problem? Thanks.Comment #6
vishalkhode commentedHi jonathan1055
There was Javascript error in console i.e
TypeError: $(...).once is not a functionand it is caused due to .once function that is used here. In Drupal 10, jquery.once library has been removed (See here) and it has been replaced with core/once. In the libraries.yaml, I've included both i.e core/jquery.once & core/once, to make sure this works well with Drupal 8,9 & 10.Comment #7
jonathan1055 commentedThanks for the explanation. So this works in D10 now, and also D9, but it's not working for a Drupal 8 site. The whole
(function ($, drupalSettings, once)is not activated at all. However, if I remove the 3rd parameteroncethen the function is active but fails when getting$default_time = once('default-time-done', '#edit-scheduler-settings', context). It needs the original way of doing it.Is there a different way to use the 'once' processing so that it is compatible with D8 , D9 and D10? It feels like there should be a way to do this, given that the change record describes the BC layer.
Comment #9
jonathan1055 commentedThanks @Rajeshreeputra for the rebase.
I have some thoughts on how to fix this, just wanted to check that you and @vishalkhode are not in the middle of making chnages before I push an update?
Comment #10
vishalkhode commentedHi jonathan1055
No, I'm not looking this at the moment. Please go ahead and push the update and let's see how it goes.
Comment #11
jonathan1055 commentedSimple idea, to keep the old default-time library file for use with Core before 9.2. I have checked this locally and it works for D8.9.
Comment #12
vishalkhode commentedHi jonathan1055
I think there are two more places where this needs to be updated. i.e Line #267 and Line #272.
Comment #13
jonathan1055 commentedYes you are right, I'll do that. I don't have automated testing running on D8 locally and the Travis builds do not run the javascript tests. Otherwise that fault would have been found. I would like to get the Travis build to run javascript testing, now that we cannot test D8 on drupal.org.
Comment #14
vishalkhode commentedReviewed changes and looks good to me.
Comment #16
jonathan1055 commentedThanks @vishalkhode for your work on this.
Fixed.