Commit 526b7ab7 authored by utkarsh_33's avatar utkarsh_33 Committed by Ben Mullins
Browse files

Issue #3310903 by Utkarsh_33, bnjmnm, narendraR, tim.plunkett,...

Issue #3310903 by Utkarsh_33, bnjmnm, narendraR, tim.plunkett, chrisfromredfin, fjgarlin: Consider removing "Best Match" sort option in the Mock API
parent 48ebdbc4
Loading
Loading
Loading
Loading
+7 −0
Changes for src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -172,6 +172,13 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact
    return $this->getStatuses(46);
  }

  /**
   * {@inheritdoc}
   */
  public function getSortOptions(): array {
    return array_diff_key(parent::getSortOptions(), ['best_match' => '']);
  }

  /**
   * {@inheritdoc}
   */
+9 −3
Changes for tests/src/FunctionalJavascript/ProjectBrowserUiTest.php: 9 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -446,10 +446,16 @@ class ProjectBrowserUiTest extends WebDriverTestBase {
   * Tests sorting criteria.
   */
  public function testSortingCriteria(): void {
    $assert_session = $this->assertSession();
    // Clear filters.
    $this->drupalGet('admin/modules/browse');
    $this->svelteInitHelper('text', 'Clear Filters');
    $this->pressWithWait('Clear filters');
    $assert_session->elementsCount('css', '#pb-sort option', 4);
    $this->assertEquals('Active installs', $this->getElementText('#pb-sort option:nth-child(1)'));
    $this->assertEquals('A-Z', $this->getElementText('#pb-sort option:nth-child(2)'));
    $this->assertEquals('Z-A', $this->getElementText('#pb-sort option:nth-child(3)'));
    $this->assertEquals('Recently created', $this->getElementText('#pb-sort option:nth-child(4)'));

    // Select 'A-Z' sorting order.
    $this->sortBy('a_z');
@@ -488,7 +494,7 @@ class ProjectBrowserUiTest extends WebDriverTestBase {
      'Kangaroo',
    ]);

    // Select 'Project Usage' option.
    // Select 'Active installs' option.
    $this->sortBy('usage_total');

    // Assert that the projects are listed in descending order of their usage.
@@ -749,10 +755,10 @@ class ProjectBrowserUiTest extends WebDriverTestBase {
    $this->svelteInitHelper('css', '.pb-categories input[type="checkbox"]');
    $assert_session->elementsCount('css', '.pb-categories input[type="checkbox"]', 20);
    $assert_session->waitForElementVisible('css', '#project-browser .project');
    $this->assertNotEquals('9 Results Sorted by Project Usage', $this->getElementText('.grid--1 output'));
    $this->assertNotEquals('9 Results Sorted by Active installs', $this->getElementText('.grid--1 output'));
    $assert_session->waitForElementVisible('css', '#project-browser .project');
    $result_count_text = $page->find('css', '.grid--1 output')->getText();
    $this->assertNotEquals('9 Results Sorted by Project Usage', $result_count_text);
    $this->assertNotEquals('9 Results Sorted by Active installs', $result_count_text);
    // Apply the second module category filter.
    $second_category_filter_selector = '#project-browser > div.container-1 > div.box-1 > div > form > details > fieldset > label:nth-child(3)';
    $this->clickWithWait("$second_category_filter_selector");