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

  1. Figure out which part of the test is testing PHP code and which part ajax behaviour
  2. Extract the ajax behaviour into a test that extends JavascriptTestBase

Remaining tasks

  1. Fix all the TODO tags in the test.

User interface changes

API changes

Data model changes

=

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

dawehner created an issue. See original summary.

michielnugter’s picture

Assigned: Unassigned » michielnugter
michielnugter’s picture

Work in progress patch. I converted 1 of the 2 tests and can't get it to work yet. I have a lot of @TODO's for behavior I don't understand (yet) in there but wanted to share the progress.

Would love some early feedback on it as to why my first test fails.

michielnugter’s picture

Status: Active » Needs work
Lendude’s picture

Adding a drupalGet before the loading makes it pass. Makes little sense to me at the moment why that is.

The rest is just a little cleanup to make the method calls easier to trace.

michielnugter’s picture

Thanks for looking into it. It's very weird. I expect it to work even without the form submit but somehow it doesn't. The UI actually displays everything correctly. I don't really know at the moment how to fix it. For now I'll just accept the drupalGet and make the test work and convert the other test.

Nice code cleanup btw.

michielnugter’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
18.74 KB
40.67 KB

I updated the test and implemented the second test. This test has the same problems though.. The tests to pass right now so it's a start. Still some weird requirements that I can't explain with my limited knowledge of fields in D8.

For now this is all I can do and I'll continue working on other tests. I've already spend several hours trying to figure this out, maybe someone with more fields knowledge has some more insights?

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

michielnugter’s picture

Component: phpunit » field_ui.module
Issue tags: +phpunit initiative
michielnugter’s picture

Status: Needs review » Needs work

Setting to proper status.

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
40.54 KB

Rerolled #7, there was a conflict on core/modules/field_ui/src/Tests/ManageDisplayTest.php.

Mile23’s picture

Status: Needs review » Needs work

Testbot shows 25 coding standards errors: https://www.drupal.org/pift-ci-job/695080

Most are old-style array() declarations, which is unusual since we already fixed all those. That suggests the patch in #7 is out of date enough that the code being moved around doesn't reflect those array syntax fixes.

So one wonders what other changes aren't carried forward. Git log for ManageDisplayTest tells us that it's at least #2878369: Tests for local tasks in Manage Display are not correct which might be enough to fail a test or two. And maybe other changes since Nov. 2016.

That means that the code being moved into the trait here should be re-done so that we're sure we got all the changes.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.