Problem/Motivation
Soon, the Simpletest UI is going to be removed from core: #2750461: Remove Simpletest UI because we don't want to maintain a graphical test runner
Many of our tests are based on FlagTestBase, and thus, WebTestBase. While we should be able to still run those through the CLI, it's obvious that core is moving towards PHPUnit exclusively.
Proposed resolution
Port FlagTestBase and our remaining tests to PHPUnit classes, such as BrowserTestBase, UnitTestBase, or KernelTestBase.
Remaining tasks
Create patch.
User interface changes
None for users, but Flag tests will no longer be available under admin/development/testing
API changes
FlagTestBase would no longer rely on WebTestBase.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#7 | phpunit_2751053.7.patch | 8.13 KB | socketwench |
#4 | phpunit_2751053.4.patch | 7.12 KB | socketwench |
Comments
Comment #2
socketwench CreditAttribution: socketwench at FFW commentedThis will fail, but it's a start.
Comment #3
socketwench CreditAttribution: socketwench at FFW commentedRight now we're getting a lot of errors similar to this:
Comment #4
socketwench CreditAttribution: socketwench at FFW commentedReroll.
Comment #7
socketwench CreditAttribution: socketwench at FFW commentedComment #10
socketwench CreditAttribution: socketwench at FFW commentedNot quite sure how to replace drupalPostAJAXForm() in FlagTestbase...
Comment #11
martin107 CreditAttribution: martin107 commented@socketwench
Yep you have struck a known core wide problem
from https://www.drupal.org/node/2469723
I am posting the full paragraph below.
but it looks like we need to locate the link and "->click()"
.. as always I am posting early in an attempt to be helpful - I will try and find sometime over the weekend to actually do something about this :)
Comment #12
BerdirThe future is now, JavaScriptTestBase exists :)
So yes, any test that is doing (fake) ajax testing will need to be converted to a JS test. Which in turn will allow for way better tests.
See https://www.chapterthree.com/blog/javascript-testing-comes-to-drupal-8
Comment #13
socketwench CreditAttribution: socketwench at FFW commentedHm. The only place we use that is when we create the flag with a form instead of directly. If we inherit from JavaScriptTestBase for FlagTestBase, would it impact test performance?
Comment #14
BerdirYes, definitely. JS tests run in an actual browser (phantomjs, no UI but executes all JS and so on), which makes it considerable slower.
I'd recommend to have one dedicated test for the UI and otherwise use the API to create the flags.
Comment #15
socketwench CreditAttribution: socketwench at FFW commentedComment #16
martin107 CreditAttribution: martin107 commentedHere is a candidate for our first test that extends javascriptTestBase
Comment #17
martin107 CreditAttribution: martin107 commentedI want to break this up into manageable chunks .... here is an simple conversion.
Comment #18
martin107 CreditAttribution: martin107 commentedNext weeks target.
Comment #19
idebr CreditAttribution: idebr at iO commentedThis was fixed in #3042758: Drupal 9 Deprecated Code Report