Problem/Motivation
We created Upload widget plugin but we're missing tests.
Proposed resolution
Create new test class for functional tests and create test case that clicks through Upload widget and checks if everything works as expected and entities are selected (events are emitted).
Remaining tasks
- write patch
- review
User interface changes
N/A
API changes
New test class and tests are added.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | interdiff.txt | 1.33 KB | slashrsm |
| #17 | 2376643_17.patch | 3.72 KB | slashrsm |
| #13 | 2376643-13.patch | 2.87 KB | marcoscano |
| #7 | interdiff.txt | 5.91 KB | marcoscano |
| #7 | create-upload-test-2376643-7.patch | 3.88 KB | marcoscano |
Comments
Comment #1
slashrsm commentedComment #2
slashrsm commentedComment #3
devlada commentedworking on this...
Comment #4
devlada commentedwork in progress...
Comment #5
marcoscano@devlada, once it's been quite a while, I assume you are not yet working on this? If it's not the case please feel free to re-assign the issue
Attached a patch that moves forward the test started in #4. Not sure whether it will be enough though. I was having some trouble to interact properly with the iframe and mocking the file upload, not sure if these are tested elsewhere and just assuring the components are in place is ok for this test.
Also, I have removed from the patch the test class for the Views widget once this is going to be handled in #2376639: Write functional tests for Views widget.
Comment #6
slashrsm commentedI guess that the best way to test it is to visit the entity browser route directly and not through the iFrame (which is exactly what you did).
Would be nice to test the actual upload though.
Comment #7
marcoscanoRight! Attached is a simplified version, testing only the standalone upload widget.
Comment #8
slashrsm commentedComment #9
samuel.mortensonThis looks good, although the "createEntityBrowser" step seems like it's testing something outside the scope of the widget. Is there a way we can rely on another test class for this logic, or use config from a test module?
Comment #11
slashrsm commentedI agree. Let's create that entity browser in setUp() or even ship it using default config yaml in the test module (we have some that might be used).
Would also make sense to use JavascriptTestBase as we're slowly moving away from simpletest.
Comment #13
marcoscanoMuch better!
This leaves us with a quite minimalistic test.. :) Is this coverage enough for the purpose of this test?
I think at some point we might need to stop and plan for a given set of entity browsers defined in the yaml files for the test module... but I have no idea what combinations of widgets/displays/selections would make more sense and could potentially be reused throughout all the tests we want to implement.
(No interdiff because it's totally different from the previous one)
Comment #14
marcoscanoComment #17
slashrsm commentedGreat. Added few more asserts.
Comment #18
slashrsm commentedCommitted. Thanks!
Comment #20
marcoscano