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
While converting testWizardForm tests by adding the assertions to the existing tests in \Drupal\Tests\views_ui\FunctionalJavascript\ViewsWizardTest::testCreateViewWizard
a problem with the Block rowStyleOptions was raised.
Currently the rowStyleOptions for Block do not get checked for valid options, so when changing wizard type the Block rowStyleOptions can contain an invalid option which results in a 500 error on the Ajax call trying to update the wizard form.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#6 | 2809549-6.patch | 5.33 KB | Lendude |
#6 | interdiff-2809549-3-6.txt | 3.41 KB | Lendude |
#3 | 2809549-3.patch | 3.31 KB | Lendude |
Comments
Comment #2
LendudeThe assertions this test does can probably be added to
\Drupal\Tests\views_ui\FunctionalJavascript\ViewsWizardTest::testCreateViewWizard
Comment #3
LendudeSo something like this.
Comment #4
LendudeThis is needed the second time to avoid getting:
Something goes wrong in
\Drupal\views\Plugin\views\wizard\WizardPluginBase::buildFormStyle
I guess? But don't know if that is a testing artefact or something real. A little clicking around the wizard outside the test didn't show anything, but didn't really dig too deep.Comment #5
LendudeOh I lie, some more clicking and I killed it. Changing the entity type doesn't change the block display format, it does update the page display format.
Comment #6
LendudeThe power of proper javascript tests vs faking them!
Hijack this issue and turn it into a bug or open a new issue?
Anyway, here is the conversion with the bug fix to make it work and some additional tests for the row style change that happens when changing the wizard type.
Comment #7
LendudeDiscussed with @dawehner on IRC. Since making a separate issue with tests for this bug would completely overlap with the conversion, we will just upgrade this to a bug
Updated IS to reflect the change.
Comment #8
dawehnernice bugfix!
Comment #11
catchLooks great. Since it's a bug fix now rather than just a conversion issue, putting it in 8.2.x as well.
Committed/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!