Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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 |
---|---|---|---|
#9 | 2809507-9.patch | 4.35 KB | ApacheEx |
#8 | interdiff-2809507-5-8.txt | 1.45 KB | ApacheEx |
#8 | 2809507-8.patch | 4.79 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. Only
testAjaxEnabledEffectForm
has ajax part.Comment #7
dawehnerThank you for starting this patch!
Note: We try to avoid
assertWaitOnAjaxRefresh
and rather use one of the other methods on\Drupal\FunctionalJavascriptTests\JSWebAssert
Comment #8
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedthanks for your feedback. Here is updated patch.
I've also found out why it randomly fails (even on my local).
A style label which generates like this:
can contain HTML special characters like
&, ", ', <, >
.For example,
"uMg>&pj
will be converted to"uMg>&pj
by Html::escape, but browser will convert this html to"uMg>&pj
.Markup::create(Xss::filter($style_label))
seems to fix it.Comment #9
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedhm, if this patch is passed then whole
ImageAdminStylesTest
can be converted toBrowserTestBase
.Let's wait for the result and decide next steps.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedAdded related issue with JTB version.
Comment #12
mondrakeThis was done in #2959466: Convert web tests to browser tests for image module (Part 2).