Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
drupalPostAjaxForm()
is simulating the behaviour of ajax.js
, so using it, doesn't really provide fundamental guarantees.
#2809161: Convert Javascript/AJAX testing to use JavascriptTestBase suggests to convert them to JavascriptTestBase
Proposed resolution
- Figure out which part of the test is testing PHP code and which part ajax behaviour
- Extract the ajax behaviour into a test that extends JavascriptTestBase
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#12 | 2809491-12.patch | 4.5 KB | ApacheEx |
Comments
Comment #3
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedComment #5
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedHere is a patch :)
Comment #6
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedBased on @dawehner review in previous issues here is updated patch.
Comment #7
LendudeAlready looking nice, but couple of things:
This is a replacement for setRawContent() which is something we only do in Kernel tests now. So, either that has to be taken out and moved to a kernel test, or we should try to find a way to do that render on a URL we can call. The latter would be better since then we have an actual functional test. Doesn't entity_test have a detail view we can render this field on?
All 'waitfor' methods should be followed by an assertion that the element is actually on the page, otherwise we might just be waiting 10 seconds for nothing.
I think all the other waits already have this, just missed this one :)
Comment #8
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedI'm surprized that whole
BooleanFieldTest
can be converted toBrowserTestBase
:) So, no Javascript dependency.Here is a patch.
p.s. Based on @vaplas comment here #2809493: Convert AJAX part of \Drupal\field\Tests\Boolean\BooleanFormatterSettingsTest::testBooleanFormatterSettings to JavascriptTestBase
Comment #10
dawehner@ApacheEx
I guess this really shows that our no JS fallback work, I think that's enough. Boolean fields don't actually add anything custom ajax wise to those forms.
Comment #12
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Internetdevels, Drupal Ukraine Community commentedAgree, thanks for review. Here is re-rolled patch with 8.6.x.
Comment #13
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedComment #15
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedRe-rolled patch was failed first time because of some another unrelated issue, now it's passed. Moved again to RTBC based on #10
Comment #18
catchCommitted/pushed to 8.6.x and cherry-picked to 8.5.x. Thanks!