Skip to content

Commit

Permalink
PL-32: Add functional tests for filters.
Browse files Browse the repository at this point in the history
The before step is needed so that the filters are visible and can be selected.
  • Loading branch information
damontgomery committed Jan 11, 2019
1 parent 8e11c85 commit 7e84bd8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
27 changes: 27 additions & 0 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,31 @@ public function iWaitForSecond($arg1)
sleep($arg1);
}

/**
* @Given I click the :arg1 element
*
* See https://stackoverflow.com/questions/33649518/how-can-i-click-a-span-in-behat.
*/
public function iClickTheElement($selector)
{
$page = $this->getSession()->getPage();
$element = $page->find('css', $selector);

if (empty($element)) {
throw new Exception("No html element found for the selector ('$selector')");
}

$element->click();
}

/**
* @BeforeStep
*
* Size the window so that all the elements are visible.
*/
public function beforeStep()
{
$this->getSession()->resizeWindow(1920, 1080, 'current');
}

}
2 changes: 1 addition & 1 deletion features/drupal-7-search.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@javascript
Feature: Drupal 7 search
As a site visitor
I want to see search the Drupal 7 sites
I want to search the Drupal 7 sites
So that I can content from other sites

Scenario: Search for "ex"
Expand Down
36 changes: 36 additions & 0 deletions features/drupal-8-search-filters.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@javascript
Feature: Drupal 8 search
As a site visitor
I want to search the Drupal 8 sites
And I want to filter my results
So that I can find relevant information more quickly

Scenario: Filter by type
Given I visit "/search-app?search=pasta"
And I wait for "1" second
# When I expand the "Type" filter
When I click the "#solr-list-facet-ss_federated_type" element
# When I select the "Article" filter
And I check "Article"
Then I should see the text "The umami guide to our favorite mushrooms"
And I should not see the text "Super easy vegetarian pasta bake"

Scenario: Filter by site - D8 single
Given I visit "/search-app?search=pasta"
And I wait for "1" second
# When I expand the "Site Name" filter
When I click the "#solr-list-facet-sm_site_name" element
# When I select the "Federated Search Demo (D8, single)" filter
And I check "Federated Search Demo (D8, single)"
Then I should see the text "Federated Search Demo (D8, single)"
And I should not see the text "Federated Search Demo (D8, domain one)"

Scenario: Filter by site - D8 domain
Given I visit "/search-app?search=pasta"
And I wait for "1" second
# When I expand the "Site Name" filter
When I click the "#solr-list-facet-sm_site_name" element
# When I select the "Federated Search Demo (D8, domain one)" filter
And I check "Federated Search Demo (D8, domain one)"
Then I should see the text "Federated Search Demo (D8, domain one)"
And I should not see the text "Federated Search Demo (D8, single)"
2 changes: 1 addition & 1 deletion features/drupal-8-search.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@javascript
Feature: Drupal 8 search
As a site visitor
I want to see search the Drupal 8 sites
I want to search the Drupal 8 sites
So that I can read recipes

Scenario: Search for "pasta"
Expand Down

0 comments on commit 7e84bd8

Please sign in to comment.