commit 9d34d0c9f4bf945fcadced38953cc98c7e91c645
Author: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date:   Fri Mar 14 06:47:56 2014 +1000

    Patch 1

diff --git a/composer.json b/composer.json
index 4526a90..2de0a35 100644
--- a/composer.json
+++ b/composer.json
@@ -7,6 +7,7 @@
     "php": ">=5.4.2",
     "sdboyer/gliph": "0.1.*",
     "symfony/class-loader": "2.4.*",
+    "symfony/css-selector": "2.4.*",
     "symfony/dependency-injection": "2.4.*",
     "symfony/event-dispatcher": "2.4.*",
     "symfony/http-foundation": "2.4.*",
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 30a6280..93164ab 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -20,6 +20,7 @@
 use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\block\Entity\Block;
 use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\CssSelector\CssSelector;
 
 /**
  * Test case for typical Drupal tests.
@@ -2234,6 +2235,22 @@ protected function xpath($xpath, array $arguments = array()) {
   }
 
   /**
+   * Performs a CSS selection based search on the contents of the internal
+   * browser. The search is relative to the root element (HTML tag normally) of
+   * the page.
+   *
+   * @param $selector string
+   *   CSS selector to use in the search.
+   *
+   * @return \SimpleXMLElement
+   *   The return value of the xpath search performed after converting the css
+   *   selector to an XPath selector.
+   */
+  protected function cssSelect($selector) {
+    return $this->xpath(CssSelector::toXPath($selector));
+  }
+
+  /**
    * Get all option elements, including nested options, in a select.
    *
    * @param $element
diff --git a/core/modules/tour/lib/Drupal/tour/Tests/TourTest.php b/core/modules/tour/lib/Drupal/tour/Tests/TourTest.php
index 00e049c..3035f31 100644
--- a/core/modules/tour/lib/Drupal/tour/Tests/TourTest.php
+++ b/core/modules/tour/lib/Drupal/tour/Tests/TourTest.php
@@ -53,12 +53,6 @@ public static function getInfo() {
   public function testTourFunctionality() {
     // Navigate to tour-test-1 and verify the tour_test_1 tip is found with appropriate classes.
     $this->drupalGet('tour-test-1');
-    $elements = $this->xpath('//li[@data-id=:data_id and @class=:classes and ./h2[contains(., :text)]]', array(
-      ':classes' => 'tip-module-tour-test tip-type-text tip-tour-test-1',
-      ':data_id' => 'tour-test-1',
-      ':text' => 'The first tip',
-    ));
-    $this->assertEqual(count($elements), 1, 'Found English variant of tip 1.');
 
     // Test the TourTestBase class assertTourTips() method.
     $tips = array();
@@ -75,16 +69,13 @@ public function testTourFunctionality() {
     ));
     $this->assertEqual(count($elements), 1, 'Found Token replacement.');
 
-    $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
-      ':data_id' => 'tour-test-2',
-      ':text' => 'The quick brown fox',
-    ));
+    $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('The first tip')");
+    $this->assertEqual(count($elements), 1, 'Found English variant of tip 1.');
+
+    $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')");
     $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 2.');
 
-    $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
-      ':data_id' => 'tour-test-1',
-      ':text' => 'La pioggia cade in spagna',
-    ));
+    $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('La pioggia cade in spagna')");
     $this->assertNotEqual(count($elements), 1, 'Did not find Italian variant of tip 1.');
 
     // Ensure that plugin's work.
@@ -92,16 +83,10 @@ public function testTourFunctionality() {
 
     // Navigate to tour-test-2/subpath and verify the tour_test_2 tip is found.
     $this->drupalGet('tour-test-2/subpath');
-    $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
-      ':data_id' => 'tour-test-2',
-      ':text' => 'The quick brown fox',
-    ));
+    $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')");
     $this->assertEqual(count($elements), 1, 'Found English variant of tip 2.');
 
-    $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
-      ':data_id' => 'tour-test-1',
-      ':text' => 'The first tip',
-    ));
+    $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('The first tip')");
     $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 1.');
 
     // Enable Italian language and navigate to it/tour-test1 and verify italian
@@ -109,16 +94,10 @@ public function testTourFunctionality() {
     language_save(new Language(array('id' => 'it')));
     $this->drupalGet('it/tour-test-1');
 
-    $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
-      ':data_id' => 'tour-test-1',
-      ':text' => 'La pioggia cade in spagna',
-    ));
+    $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('La pioggia cade in spagna')");
     $this->assertEqual(count($elements), 1, 'Found Italian variant of tip 1.');
 
-    $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
-      ':data_id' => 'tour-test-1',
-      ':text' => 'The first tip',
-    ));
+    $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')");
     $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 1.');
 
     language_save(new Language(array('id' => 'en')));
@@ -156,18 +135,12 @@ public function testTourFunctionality() {
 
     // Navigate to tour-test-1 and verify the new tip is found.
     $this->drupalGet('tour-test-1');
-    $elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
-      ':data_id' => 'tour-code-test-1',
-      ':text' => 'The rain in spain',
-    ));
+    $elements = $this->cssSelect("li[data-id=tour-code-test-1] h2:contains('The rain in spain')");
     $this->assertEqual(count($elements), 1, 'Found the required tip markup for tip 4');
 
     // Verify that the weight sorting works by ensuring the lower weight item
     // (tip 4) has the 'End tour' button.
-    $elements = $this->xpath('//li[@data-id=:data_id and @data-text=:text]', array(
-      ':data_id' => 'tour-code-test-1',
-      ':text' => 'End tour',
-    ));
+    $elements = $this->cssSelect("li[data-id=tour-code-test-1][data-text='End tour']");
     $this->assertEqual(count($elements), 1, 'Found code tip was weighted last and had "End tour".');
 
     // Test hook_tour_alter().
