part of #2752931: [meta] Implement Javascript testing for Views and the Views UI

Add some basic test coverage for sorting AJAX enabled Views.

Click a header, see if it works.

Comments

Lendude created an issue. See original summary.

lendude’s picture

Status: Active » Needs review
StatusFileSize
new2.64 KB

Here we go.

dawehner’s picture

+++ b/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php
@@ -0,0 +1,77 @@
+    // Enable AJAX on the /admin/content View.
+    \Drupal::configFactory()->getEditable('views.view.content')
+      ->set('display.default.display_options.use_ajax', TRUE)
+      ->save();

Let's have a test view rather reusing an existing view.

This test is just super nice!

lendude’s picture

StatusFileSize
new18.02 KB
new19.39 KB

Let's have a test view rather reusing an existing view.

Yeah good idea. Just using a clone of the content view, same as @dawehner and @alexpott suggested for #2600804: AJAXified glossary view arguments fail when Language URL detection enabled. If this lands we should transfer the tests in \Drupal\Tests\views\FunctionalJavascript\ExposedFilterAJAXTest to that too.
Currently writing tests for pagination and will make use of the same clone there too.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Great, thank you!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: views_ajax_clicksort-2770817-4.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 425b58b to 8.3.x and f7bd389 to 8.2.x. Thanks!

Fixed unused use...

diff --git a/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php
index e7a5ed3..0e5095d 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\Tests\views\FunctionalJavascript;
 
-use Behat\Mink\Element\NodeElement;
 use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
 use Drupal\simpletest\ContentTypeCreationTrait;
 use Drupal\simpletest\NodeCreationTrait;
@@ -60,7 +59,7 @@ public function testClickSorting() {
 
     // Ensure that the Content we're testing for is in the right order, default
     // sorting is by changed timestamp so the last created node should be first.
-    /** @var NodeElement[] $rows */
+    /** @var \Behat\Mink\Element\NodeElement[] $rows */
     $rows = $page->findAll('css', 'tbody tr');
     $this->assertCount(2, $rows);
     $this->assertContains('Page B', $rows[0]->getHtml());

  • alexpott committed 425b58b on 8.3.x
    Issue #2770817 by Lendude: Add javascript testing for sorting AJAX...

  • alexpott committed f7bd389 on 8.2.x
    Issue #2770817 by Lendude: Add javascript testing for sorting AJAX...

Status: Fixed » Closed (fixed)

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