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.

Comments

slashrsm’s picture

Issue tags: +Media Initiative, +sprint
slashrsm’s picture

Issue tags: -sprint +D8Media
devlada’s picture

Assigned: Unassigned » devlada

working on this...

devlada’s picture

StatusFileSize
new6.57 KB

work in progress...

marcoscano’s picture

Assigned: devlada » Unassigned
Status: Active » Needs review
StatusFileSize
new5.98 KB
new8.95 KB

@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.

slashrsm’s picture

Status: Needs review » Needs work

I 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.

marcoscano’s picture

Status: Needs work » Needs review
StatusFileSize
new3.88 KB
new5.91 KB

Right! Attached is a simplified version, testing only the standalone upload widget.

slashrsm’s picture

Issue tags: +RC blocker
samuel.mortenson’s picture

This 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?

Status: Needs review » Needs work

The last submitted patch, 7: create-upload-test-2376643-7.patch, failed testing.

slashrsm’s picture

I 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.

The last submitted patch, 7: create-upload-test-2376643-7.patch, failed testing.

marcoscano’s picture

StatusFileSize
new2.87 KB

Much 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)

marcoscano’s picture

Status: Needs work » Needs review

The last submitted patch, 4: 2376643-4.patch, failed testing.

The last submitted patch, 4: 2376643-4.patch, failed testing.

slashrsm’s picture

StatusFileSize
new3.72 KB
new1.33 KB

Great. Added few more asserts.

slashrsm’s picture

Status: Needs review » Fixed

Committed. Thanks!

  • slashrsm committed 10ba0d9 on 8.x-1.x authored by marcoscano
    Issue #2376643 by marcoscano, slashrsm, devlada, samuel.mortenson:...
marcoscano’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.