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
The rest of the test has to be converted to a BrowserTestBase test.
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
- Move the rest of the test to a BrowserTestBase test
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#15 | 2809513-15.patch | 11.24 KB | Lendude |
#15 | interdiff-2809513-14-15.txt | 5.2 KB | Lendude |
#14 | 2809513-convert-responsiveimagefielduitest-14.patch | 11.58 KB | brentg |
Comments
Comment #3
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedUpdated the title and IS to reflect the increased scope for the issue, the BrowserTestBase conversion is now part of this issue.
Comment #4
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedComment #6
ApacheEx CreditAttribution: ApacheEx commentedComment #8
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedI will try to prepare patch today on Drupal Global CodeSprint Jan 2018
Comment #9
ApacheEx CreditAttribution: ApacheEx as a volunteer and at Drupal Ukraine Community commentedseems form has hidden fields (e.g refresh_rows), that's why we need to wait when #2917885: Add drupalPostFormWithInvalidOptions() to BrowserTestBase lands.
Comment #10
volegerSet proper status.
Postponed on #2917885: Add drupalPostFormWithInvalidOptions() to BrowserTestBase
Comment #12
LendudeCan we find a way to work around the hidden fields?
Comment #13
brentgComment #14
brentgStill working on this issue, converted a first part of the old test, still have to convert the last part, but uploading my current progress already.
Comment #15
Lendude@brentgees really nice work on this! Since this is one of the last remaining conversions, I'm giving this a little push.
Comment #16
brentgThanks for the push, glad to see most of my code was already decent.
In my opinion your test looks good, but I would prefer someone else having a look as well before putting this to reviewed since my knowledge is a bit limited on WebDriverTestBase.
Comment #17
jibranThanks, patch looks great RTBC.
Comment #18
alexpottCommitted and pushed 56658f00e7 to 8.7.x and 6531ee4b1c to 8.6.x. Thanks!
I tested locally on 8.6.x and everything passed.
I don't think we need this trait at all.
I ran the tests locally without it and everything was fine.
Did this on commit.