diff --git a/behat.yml b/behat.yml
index c6f3189..4310061 100644
--- a/behat.yml
+++ b/behat.yml
@@ -13,16 +13,17 @@ default:
cache: ~
extensions:
Behat\MinkExtension:
- goutte: ~
+ browser_name: 'chrome'
selenium2:
- wd_host: "http://127.0.0.1:8643/wd/hub"
+ wd_host: "http://127.0.0.1:4444/wd/hub"
+ capabilities: { "browserName": "chrome", "browser": "chrome", "version": "72", 'chrome': {'switches':['--no-sandbox', '--headless']}}
javascript_session: selenium2
- base_url: http://federated-search-demo.local
+ base_url: http://d8.fs-demo.local
Drupal\DrupalExtension:
blackbox: ~
api_driver: 'drupal'
drupal:
- drupal_root: 'web'
+ drupal_root: 'web/d8/docroot'
text:
username_field: 'name'
password_field: 'pass'
diff --git a/build.xml b/build.xml
index 69ef6b4..a9d80d5 100644
--- a/build.xml
+++ b/build.xml
@@ -338,6 +338,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 3c5f82a..04b5f96 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -20,4 +20,39 @@ public function __construct()
{
}
+ /**
+ * @When I wait for :arg1 second
+ */
+ 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');
+ }
+
}
diff --git a/features/drupal-7-search.feature b/features/drupal-7-search.feature
new file mode 100644
index 0000000..a0333d0
--- /dev/null
+++ b/features/drupal-7-search.feature
@@ -0,0 +1,12 @@
+@javascript
+Feature: Drupal 7 search
+ As a site visitor
+ I want to search the Drupal 7 sites
+ So that I can content from other sites
+
+ Scenario: Search for "terrier"
+ Given I visit "/search-app?search=terrier"
+ When I wait for "1" second
+ Then I should see the text "English Terrier"
+ And I should see the text "Drupal 7 - Federated Search"
+ And I should see the text "Federated Search Domain 3"
diff --git a/features/drupal-8-search-filters.feature b/features/drupal-8-search-filters.feature
new file mode 100644
index 0000000..d1a9fb0
--- /dev/null
+++ b/features/drupal-8-search-filters.feature
@@ -0,0 +1,42 @@
+@javascript
+Feature: Federated search filers
+ As a site visitor
+ I want to search the federated 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=terrier"
+ 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 "Jack Russell Terrier"
+ And I should see the text "English Terrier"
+ And I should see the text "Irish Terrier"
+
+ Scenario: Filter by site - D8 single
+ Given I visit "/search-app?search=terrier"
+ 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 Drupal 8" filter
+ And I check "Federated Search Drupal 8"
+ Then I should see the text "Federated Search Drupal 8"
+ And I should see the text "Jack Russell Terrier"
+ And I should see the text "Boston Terrier"
+ And I should not see the text "Drupal 7 - Federated Search"
+ And I should not see the text "Federated Search Domain 3"
+
+ Scenario: Filter by site - D8 domain
+ Given I visit "/search-app?search=terrier"
+ 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 Domain 3" filter
+ And I check "Federated Search Domain 3"
+ Then I should see the text "Federated Search Domain 3"
+ And I should see the text "Norfolk Terrier"
+ And I should see the text "Federated Search Drupal 8"
+ And I should not see the text "Drupal 7 - Federated Search"
diff --git a/features/drupal-8-search.feature b/features/drupal-8-search.feature
new file mode 100644
index 0000000..c6d4c27
--- /dev/null
+++ b/features/drupal-8-search.feature
@@ -0,0 +1,11 @@
+@javascript
+Feature: Drupal 8 search
+ As a site visitor
+ I want to search the Drupal 8 sites
+ So that I can read recipes
+
+ Scenario: Search for "terrier"
+ Given I visit "/search-app?search=terrier"
+ And I wait for "1" second
+ Then I should see the text "Jack Russell Terrier"
+ And I should see the text "Federated Search Drupal 8"
diff --git a/provisioning/federated-search-demo.yml b/provisioning/federated-search-demo.yml
index 2ff55d2..ce01d9e 100644
--- a/provisioning/federated-search-demo.yml
+++ b/provisioning/federated-search-demo.yml
@@ -67,4 +67,5 @@
- { role: mysql }
- { role: apache }
- { role: solr-cors }
+ - { role: selenium-webdriver }
- { role: drush }
diff --git a/provisioning/roles/selenium-webdriver/tasks/main.yml b/provisioning/roles/selenium-webdriver/tasks/main.yml
new file mode 100644
index 0000000..ea06c91
--- /dev/null
+++ b/provisioning/roles/selenium-webdriver/tasks/main.yml
@@ -0,0 +1,44 @@
+---
+- name: Create directory for Selenium
+ become: yes
+ file:
+ path: /usr/local/share/selenium
+ state: directory
+
+- name: Selenium
+ become: yes
+ get_url:
+ url: https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
+ dest: /usr/local/share/selenium/selenium-server-standalone.jar
+
+- name: Create directory for Chromedriver
+ become: yes
+ file:
+ path: /usr/local/share/chromedriver
+ state: directory
+
+- name: Download Chromedriver
+ become: yes
+ unarchive:
+ remote_src: yes
+ src: https://chromedriver.storage.googleapis.com/72.0.3626.7/chromedriver_linux64.zip
+ dest: /usr/local/share/chromedriver
+ mode: "+x"
+
+- name: "Install Chrome - Ensure Google linux signing key present"
+ become: yes
+ apt_key:
+ url: https://dl-ssl.google.com/linux/linux_signing_key.pub
+
+- name: "Install Chrome - Ensure Google Chrome repo present"
+ become: yes
+ apt_repository:
+ repo: "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
+ filename: "google-chrome"
+ state: present
+ update_cache: yes
+
+- name: Install Chrome
+ become: yes
+ apt:
+ name: google-chrome-stable