We had some warnings in #2659806: Warnings when adding an action which I assume should be thrown during the ConfigureAndExecuteTest as well. If so, we need to fix our tests to check for such warnings.
If the warnings aren't thrown in our tests, we should instead improve our test coverage.

Comments

fago created an issue. See original summary.

vasi1186’s picture

Assigned: Unassigned » vasi1186
vasi1186’s picture

Assigned: vasi1186 » Unassigned
Cogax’s picture

Assigned: Unassigned » Cogax

I think the error is caused by AddExpressionForm::validateForm which calls ::submitForm of the expression form handler. But the first step of the form has it's own submission handler, which is ignored. I'll try to fix that. It's the same for ConditionForm as well as ActionForm.

https://github.com/fago/rules/pull/380

klausi’s picture

The PR belongs into #2659806: Warnings when adding an action, this issue is about improving our browser test base class.

klausi’s picture

Assigned: Cogax » Unassigned
Status: Active » Needs review

My idea for this: https://github.com/fago/rules/pull/382

I know, this should all be in core BrowserTestBase, but let's add it in Rules for faster testing and iteration.

klausi’s picture

Yay, tests failing on the PHP warnings as expected!

Another idea would be to modify the Guzzle client if the mink GoutteDriver is used with http://docs.guzzlephp.org/en/latest/handlers-and-middleware.html

That way we could really cover all responses received and would not need to add the processHeaderErrors() method everywhere. The disadvantage is that it then only works for the GoutteDriver, but maybe that is ok?

fago’s picture

I'd dislike doing it in a certain driver only, as we loose the flexibility to run our tests with another driver what might be really important in future to cover JS stuff.

Thus, reading up on how to do it best with Mink generically brought me to:
https://github.com/jhedstrom/drupalextension/issues/143
and the conclusion: It cannot work as there might be ajax requests etc. which are not controlled by mink at all.

As a consequence, I'd suggest doing it different by running a manual check at the end of each test which checks the Drupal watchdog table for new entries. I know this is not easy as we do not have a Drupal booted up and we cannot rely on drush for that, so maybe we could just add in the drupal-driver project and use it's API driver to use regular Drupal APIs & ensure there are no watchdog entries?
https://github.com/jhedstrom/DrupalDriver

I guess that would imply a Drupal bootstrap also, quite unfortunate :(

Other idea:
- Let's add a small test helper module, which adds a separate route for verifying that there are no watchdog entries. Then, install the test helper module for all browser tests and call the route / http resource at the end of each test to verify watchdog all is fine?
- In the end this also a drupal bootstrap, just elsewhere ;-) One in the test context might be cheaper - behat / drupalextension does it as well and this seems to work fine & fest in general.

  • klausi committed cabc8f5 on
    Issue #2659808: Improved browser tests to check for PHP errors
    
klausi’s picture

Status: Needs review » Needs work

Hm, that sounds all way to complicated IMO.

Drupal core already sends us the PHP error assertions in the HTTP response headers, we just need to read them.

I committed my pull request as a stop gap for now so that we catch PHP errors with the current tests at least.

Setting to "needs work" for future ideas and improvements.

TR’s picture

Status: Needs work » Closed (won't fix)

I don't see anything here that still needs to be done.