We need to start covering existing javascript functionality within Views with test, see #2752931: [meta] Implement Javascript testing for Views and the Views UI.

This is about adding test coverage to the basic search functionality in the Views listing.

Search for some terms and see if the right Views are visible.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lendude created an issue. See original summary.

Lendude’s picture

Assigned: Lendude » Unassigned
FileSize
3.08 KB

First stab at it.

Lendude’s picture

Status: Active » Needs review
Lendude’s picture

Lendude’s picture

Issue summary: View changes
dawehner’s picture

  1. +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
    @@ -0,0 +1,87 @@
    +  /**
    +   * Tests the filtering on the Views listing page.
    +   */
    +  public function testFilterViewsListing() {
    

    Just as a suggestion: we could test the disable/enable functionality and the ajax behaviour on that.

  2. +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
    @@ -0,0 +1,87 @@
    +
    +    // Filter on the string 'people'. This should only show the people view.
    +    $search_input = $page->find('css', '.views-filter-text.form-search');
    +    $search_input->setValue('people');
    ...
    +
    +    // Filter on a string that also appears in the description.
    +    $search_input->setValue('content');
    

    Nice tests!

Lendude’s picture

Yeah testing the enabled/disabled functionality would be a great addition, so here we go!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Nice! One step forward in time!

DuaelFr’s picture

Status: Reviewed & tested by the community » Needs work

Hi, thanks for your amazing work on these issues and your valuable advices.
I found two little tidbits here. The test is passing because the button and link are currently designed to totally fill their container. If, someday, we chose to change the style of these elements, tests could fail strangely.
We have to be really careful about the things we click on ;)

  1. +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
    @@ -0,0 +1,123 @@
    +    $enabled_view->find('css', 'li.dropbutton-toggle')->click();
    

    We should target the <button> here.

  2. +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/ViewsListingTest.php
    @@ -0,0 +1,123 @@
    +    $disable_button = $enabled_view->find('css', 'li.disable.dropbutton-action');
    

    We should target the <a> here.

Lendude’s picture

@DuaelFR thanks for the feedback! Updated per #9

The last submitted patch, 10: interdiff-2753791-10.patch, failed testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

We should target the here.
We should target the here.

This is a really good point. We should keep that in mind when we review patches!

DuaelFr’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: views_listing_test-2753791-10.patch, failed testing.

Lendude’s picture

Status: Needs work » Reviewed & tested by the community

unrelated fails

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: views_listing_test-2753791-10.patch, failed testing.

Lendude’s picture

Status: Needs work » Reviewed & tested by the community

and more unrelated fails.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: views_listing_test-2753791-10.patch, failed testing.

Lendude’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated fails, back to RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: views_listing_test-2753791-10.patch, failed testing.

Lendude’s picture

Status: Needs work » Reviewed & tested by the community

unrelated fails

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 9cae523573991a87319abfa83f7ee6db9ee9f5c7 to 8.2.x and 69836b2 to 8.1.x. Thanks!

  • alexpott committed 9cae523 on 8.2.x
    Issue #2753791 by Lendude: Add javascript testing for the Views listing...

  • alexpott committed 69836b2 on 8.1.x
    Issue #2753791 by Lendude: Add javascript testing for the Views listing...
dawehner’s picture

Lendude++

  • alexpott committed 9cae523 on 8.3.x
    Issue #2753791 by Lendude: Add javascript testing for the Views listing...

  • alexpott committed 9cae523 on 8.3.x
    Issue #2753791 by Lendude: Add javascript testing for the Views listing...

Status: Fixed » Closed (fixed)

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