Problem/Motivation

XPath is hard to write and is often a barrier to new contributors writing tests.
Most devs know CSS selectors.
Symfony has a component css-selector that parses CSS selectors into xpaths.

Proposed resolution

Add symfony/css-selector to core
Add a ::cssSelect() method to WebTestBase
Refactor a couple of xpath based tests for example purposes.
Profit.

Remaining tasks

Review the attached patch

User interface changes

None

API changes

New method ::cssSelect() on WebTestBase

Before

$elements = $this->xpath('//div[contains(concat(" ", normalize-space(@class), " "), :field_class)]/li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
  ':field_class' => 'tours',
  ':data_id' => 'tour-test-1',
   ':text' => 'The first tip',
));

After

$elements = $this->cssSelect("div.tours > li[data-id=tour-test-1] h2:contains('The first tip')");

Much easier.

Background on symfony/css-selector

symfony/css-selector is required by Mink. Mink is part of the Behat BDD QA family. Mink in conjunction with Goutte provides a headless-browser emulator in php and is fast becoming the defacto-standard for web-tests in the PHP community. Our goal for D9 is to replace SimpleTest with Goutte + Mink (see #1567500: [meta] Pave the way to replace the testing framework with PHPUnit and possibly rewrite Simpletest).
Behat in turn is part of the PHP QA Toolchain, along with PHPUnit (which we already use) and PHP_CS (Code sniffer - which we use too, particularly in contrib - but not to its full extent in core).
Our longer term goal is to move towards the standard php quality toolkit. Although much of this will have to wait until Drupal 9, this change eases the burden on coders creating new tests. Whilst much of the new test functionality required for Drupal 8 is written, contrib authors will be writing SimpleTest tests for Drupal 8 for at least the next three years, most likely more as Drupal 10 is a long way off. Adding this now lowers the barrier to writing test coverage for code and improves Drupal core and contrib's overall quality.

CommentFileSizeAuthor
#71 1959660-psr4-reroll.patch261.91 KBxjm
#70 css-selector-symfont-1959660.70.patch262.02 KBlarowlan
#60 css-selector-symfont-1959660.core-only.do-not-test.patch6.54 KBlarowlan
#60 css-selector-symfont-1959660.60.patch262.02 KBlarowlan
#59 css-selector-symfont-1959660.core-only.do-not-test.patch6.54 KBlarowlan
#59 css-selector-symfont-1959660.59.patch262.02 KBlarowlan
#57 css-selector-symfont-1959660.57.patch262.26 KBlarowlan
#54 css-selector-symfont-1959660.shebang.patch253.26 KBlarowlan
#54 css-selector-symfont-1959660.do-not-test.patch6.95 KBlarowlan
#51 css-selector-symfont-1959660.do-not-test.patch7.22 KBlarowlan
#50 css-selector-symfont-1959660.shebang.patch253.53 KBlarowlan
#50 css-selector-symfont-1959660.do-not-test.patch3.16 KBlarowlan
#48 css-selector-symfont-1959660.shebang.patch11.25 MBlarowlan
#48 css-selector-symfont-1959660.do-not-test.patch6.69 KBlarowlan
#42 drupal-1959660-42.patch13.44 KBpfrenssen
#42 interdiff.txt8.98 KBpfrenssen
#38 drupal-1959660-38.patch9.75 KBclemens.tolboom
#32 drupal-1959660-32.patch7.76 KBdawehner
#28 css-selector-1959660.28.patch6.54 KBlarowlan
#21 css-selector-without-composer-update.do-not-test.patch6.35 KBrobloach
#17 css-selector-1959660.17.interdiff.txt1000 byteslarowlan
#17 css-selector-1959660.17.patch242.26 KBlarowlan
#13 css-selector-1959660.13.patch242.16 KBlarowlan
#11 css-selector-1959660.11.patch183.35 KBlarowlan
#1 css-selector-1959660.changes-to-core-only.do-not-test.patch6.23 KBlarowlan
#1 css-selector-1959660.results-of-composer-update.do-not-test.patch177.28 KBlarowlan
#1 css-selector-1959660.1.patch183.15 KBlarowlan

Comments

larowlan’s picture

So three files

  • css-selector-1959660.changes-to-core-only.do-not-test.patch - Shows changes to composer.json, WebTestBase and TourTest
  • css-selector-1959660.results-of-composer-update.do-not-test.patch - Changes from running composer update symfony/css-selector
  • css-selector-1959660.1.patch - the whole banana
larowlan’s picture

Status: Active » Needs review
andypost’s picture

Looks nice and actually more usable for newbies to use

Crell’s picture

Seems reasonable to me. My only question would be how much effort we continue to put into Simpletest/WebTest in the first place. :-) I guess we can't get rid of it entirely any time soon, though.

larowlan’s picture

Updated issue summary with example of new format

sun’s picture

Issue tags: +Testing system

Web tests via PHPUnit/Mink/Goutte are most likely not going to happen for D8 (since that is a completely different can of worms), so keep on rocking there.

xjm’s picture

xjm’s picture

Issue tags: +Testing system

xpost

larowlan’s picture

Status: Needs review » Needs work
Issue tags: +DX (Developer Experience), +Testing system

The last submitted patch, css-selector-1959660.1.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new183.35 KB

Re-roll based on changes to tour tests.

Status: Needs review » Needs work

The last submitted patch, css-selector-1959660.11.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new242.16 KB
larowlan’s picture

Green again

robloach’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/vendor/composer/autoload_classmap.phpundefined
@@ -3,350 +3,350 @@
-    'PHP_Token_XOR_EQUAL' => $baseDir . '/vendor/phpunit/php-token-stream/PHP/Token.php',
-    'SessionHandlerInterface' => $baseDir . '/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php',
-    'Text_Template' => $baseDir . '/vendor/phpunit/php-text-template/Text/Template.php',
+    'File_Iterator' => $baseDir . '/core/vendor/phpunit/php-file-iterator/File/Iterator.php',
+    'File_Iterator_Facade' => $baseDir . '/core/vendor/phpunit/php-file-iterator/File/Iterator/Facade.php',

These changes are just from the composer.json move. Nothing to worry about. PHPUnit tests still run fine.

$ git apply css-selector-1959660.13.patch
css-selector-1959660.13.patch:1080: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

That's the .gitignore from CSS Selector. No problem.

larowlan’s picture

Status: Reviewed & tested by the community » Needs work

xjm pointed out some docblock issues

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new242.26 KB
new1000 bytes

Fixes doc-block issues

larowlan’s picture

Issue tags: +Needs change record

Adding change notice tag

robloach’s picture

Status: Needs review » Reviewed & tested by the community

Good catch on the docblock.

webchick’s picture

Assigned: Unassigned » dries
Issue tags: +Needs issue summary update

Since this adds a new library, assigning to Dries. TBH, despite the noted improvement on test readability, this kinda strikes me as "feature-ish" and should probably be subject to thresholds. Not touching the status for now.

64 files changed, 4906 insertions, 394 deletions.

That's a, um. Serious diffstat. :P

This could use a more fleshed-out issue summary to help understand why this is necessary (some before/after snippets — oops, that's there already, didn't scroll down enough :D), what other libraries were considered, how stable this library is in terms of Symfony's LTS support, etc.

robloach’s picture

It includes a lot of new files because it adds the Symfony CSS Selector.

Attached is the above patch without running composer update symfony/css-selector, or the included vendor code. You can see it replaces the ugly XPath selectors with nicer, much more familiar, CSS selectors. Makes it much easier to write tests which check output of pages.

3 files changed, 29 insertions, 37 deletions.

webchick’s picture

Well, whether it's pulled in via composer or committed directly to the vendor branch, it's still an extra 4600 lines of code we're loading for doing this task that we didn't load before.

larowlan’s picture

FWIW some of those 4600 lines are unit tests but yes we are loading more code, when that method is invoked.

In terms of how stable this library is and what else was considered, symfony/css-selector is required by Mink. Mink is part of the Behat BDD QA family. Mink in conjunction with Goutte provides a headless-browser emulator in php and is fast becoming the defacto-standard for web-tests in the PHP community. Our goal for D9 is to replace SimpleTest with Goutte + Mink (see #1567500: [meta] Pave the way to replace the testing framework with PHPUnit and possibly rewrite Simpletest).
Behat in turn is part of the PHP QA Toolchain, along with PHPUnit (which we already use) and PHP_CS (Code sniffer - which we use too, particularly in contrib - but not to its full extent in core).
Our longer term goal is to remove SimpleTest altogether (see #1567500: [meta] Pave the way to replace the testing framework with PHPUnit and possibly rewrite Simpletest) in favour of a more standard and supported testing toolkit, given we're the only ones left on SimpleTest. The goal of this is to move towards the standard php quality toolkit. Although much of this will have to wait until Drupal 9, this change eases the burden on coders creating new tests. Whilst much of the new test functionality required for Drupal 8 is written, contrib authors will be writing SimpleTest tests for Drupal 8 for at least the next three years, most likely more as Drupal 10 is a long way off. Adding this now lowers the barrier to writing test coverage for code and improves Drupal core and contrib's overall quality.

I will add this to the issue summary too.

Hope that helps

larowlan’s picture

Issue summary: View changes

Updated issue summary.

larowlan’s picture

Issue summary: View changes

Updated issue summary

pfrenssen’s picture

Great idea! This would make my life so much easier.

larowlan’s picture

Status: Reviewed & tested by the community » Needs work

Going to change this to try and use PHPUnit_Util_XML::cssSelect which is already in core

larowlan’s picture

Assigned: dries » larowlan
larowlan’s picture

Assigned: larowlan » dries
Status: Needs work » Reviewed & tested by the community

PHPUnit_Util_XML::cssSelect doesn't support the :contains psuedo selector.
Resetting status etc.

larowlan’s picture

Assigned: dries » Unassigned
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new6.54 KB

It's not as nice but got there in the end.

No interdiff, as bears little resemblence to #17

Before

$elements = $this->xpath('//li[@data-id=:data_id and ./h2[contains(., :text)]]', array(
  ':data_id' => 'tour-test-1',
  ':text' => 'The first tip',
));

After

$elements = $this->cssSelect('h2', 'The quick brown fox', $this->cssSelect("li[data-id=tour-test-2]"));

Leverages the $content option from PHPUnit_Util_XML::cssSelect() which doesn't work with nested selectors (eg 'li h2') but works by chaining (of sorts) as per the above example.

ParisLiakos’s picture

Title: Add Symfony CSS Selector to core, add ::cssSelect() method to WebTestBase » Add ::cssSelect() method to WebTestBase leveraging PHPUnit_Util_XML::cssSelect()

this is awesome!
how about adding it to UnitTestCase as well?

dawehner’s picture

+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.phpundefined
@@ -1848,6 +1848,41 @@ protected function xpath($xpath, array $arguments = array()) {
+  protected function cssSelect($selector, $contains = TRUE, $content = FALSE) {

It would be so great to actually move this to TestBase so also drupal unit tests could use it. Just for example when testing the output of a table in views, I don't give a shit about the whole page, as I can render a view properly in the test.

ParisLiakos’s picture

Title: Add ::cssSelect() method to WebTestBase leveraging PHPUnit_Util_XML::cssSelect() » Add ::cssSelect() method to TestBase leveraging PHPUnit_Util_XML

Both me and dawehner think that testBase should be a better place. you dont need to be in a webtest to test X/Html output

dawehner’s picture

StatusFileSize
new7.76 KB

Moved it and tried to write a test, but it feels like the DX is not perfect.

dawehner’s picture

#32: drupal-1959660-32.patch queued for re-testing.

ParisLiakos’s picture

+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestUnitTest.phpundefined
@@ -0,0 +1,44 @@
+    debug($this->cssSelect('#test_id', TRUE, $content));

shouldnt this be an assertion isntead of debug?

xtfer’s picture

Status: Needs review » Needs work

Dreditor doesnt seem to like this patch...

The only major issue I could see was the debug() statement. The DX is fine, IMHO.

xtfer’s picture

Edit: duplicate comment

clemens.tolboom’s picture

I just created a duplicate #2030369: Add Symfony CssSelector to core which was needed for #2028535: Provide a TourTestBase class for use by core and contrib modules where the CSS selections come from Tour YAML files which we never can code against.

So I really hope this gets in :)

clemens.tolboom’s picture

Status: Needs work » Needs review
StatusFileSize
new9.75 KB

Patch needed a reroll. Had to rewrite one Tour test.

I've fixed #34 and added some more unit tests to core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestUnitTest.php

What I liked about using #2030369: Add Symfony CssSelector to core instead it's selector is a one shot instead of make sure to address the right contexts on complex css selection. But it's a HUGE improvement over XPath selection.

clemens.tolboom’s picture

This needs tests for the comment from the function documentation.

* @param string $contains
* (optional) Filter matching nodes to those containing the given content.
* Note that due to limitations with \PHPUnit_Util_XML::cssSelect this does
* not work when you pass a nested selector such as 'li h2'.

We need a tests for ie

+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestUnitTest.php
@@ -0,0 +1,73 @@
+    $child = $this->cssSelect('div span p', TRUE, $content);

Make a failing one.

dawehner’s picture

+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestUnitTest.phpundefined
@@ -0,0 +1,73 @@
+class SimpleTestUnitTest extends UnitTestBase {

We wrote other phpunit tests for simpletest before, so why not use it here as well? I guess B => C would be enough

xjm’s picture

Issue tags: -Needs change record

This isn't ready for a change notification until it goes into HEAD.

pfrenssen’s picture

StatusFileSize
new8.98 KB
new13.44 KB
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.phpundefined
@@ -1344,4 +1344,42 @@
+   * @param mixed $content
+   *   (optional) Context to parse for selector.

"Context" should be "Content".

+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.phpundefined
@@ -1344,4 +1344,42 @@
+    if (!$content && isset($this->content)) {
+      $content = $this->content;

It would be nice to have some tests that extend WebTestBase so that we can test the usage of $this->content. Granted, the Tour tests already do this, but developers looking for some example implementations will perhaps not go looking in there.

+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.phpundefined
@@ -1344,4 +1344,42 @@
+    if (is_array($content)) {
+      $content = array_reduce($content, function ($value, $item) {
+        $value .= $item->ownerDocument->saveHtml($item);
+        return $value;
+      }, '');

To properly test the anonymous function inside the array_reduce() I would like to add a test that takes a content array with multiple items, in addition to the tests using an array with a single item.

+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestUnitTest.phpundefined
@@ -0,0 +1,73 @@
+  public static function getInfo() {
+    return array(
+      'name' => 'SimpleTest functionality (Unit test)',
+      'description' => "Tests some methods of Simpletest as unit test.",
+      'group' => 'SimpleTest'
+    );

Maybe shorten the name of the unit test from "SimpleTest functionality (Unit test)" to "SimpleTest unit tests" to be consistent with most other unit tests.

+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestUnitTest.phpundefined
@@ -0,0 +1,73 @@
+    $root = $this->cssSelect('#test_id', TRUE, $content);
+    $this->assertEqual(count($root), 1, 'ID selector works');
+
+    $child = $this->cssSelect('p', 'My Subchild My Child', $content);
+    $this->assertEqual(count($child), 1, 'Text content found.');

I think $elements would be a better name for the variable that holds the selected elements (instead of $root or $child).

My new hobby is to do code coverage analysis with XDebug, and I'm happy to announce that the tests cover 100% of the code. To be fully complete though, we should ensure that an empty array is returned when no match was found.

Regarding comments #39 and #40:

This needs tests for the comment from the function documentation.

* @param string $contains
* (optional) Filter matching nodes to those containing the given content.
* Note that due to limitations with \PHPUnit_Util_XML::cssSelect this does
* not work when you pass a nested selector such as 'li h2'.

I too wonder where this is coming from. @dawehner, how did you figure this out? I couldn't find anything about this limitation in the documentation of PHPUnit. I think this might just be a bug. If so, we should either find an existing bug report, or create one, and refer to that. Also if it is a bug in PHPUnit we should not add a test for that, that should be added in PHPUnit.

We wrote other phpunit tests for simpletest before, so why not use it here as well? I guess B => C would be enough

@dawehner, I don't catch your drift, what do you mean with B => C?

Attached patch addresses my own remarks, #39 and #40 are not yet addressed.

pfrenssen’s picture

Marked #597866: Support for QueryPath-based assertions as a duplicate of this issue.

pfrenssen’s picture

* @param string $contains
* (optional) Filter matching nodes to those containing the given content.
* Note that due to limitations with \PHPUnit_Util_XML::cssSelect this does
* not work when you pass a nested selector such as 'li h2'.

This was first mentioned by larowlan in comment #27. Indeed, PHPUnit_Util_XML::cssSelect() is very simple in comparison to the one from Symfony, and doesn't support this. It is still better than nothing though, and certainly easier than XPath.

I don't think we need to test for this case if it is simply not supported upstream.

pfrenssen’s picture

Issue summary: View changes

Added the familiar [contains(concat(" ", normalize-space(@class), " ")] XPath drama to the example.

clemens.tolboom’s picture

42: drupal-1959660-42.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 42: drupal-1959660-42.patch, failed testing.

sun’s picture

  1. +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
    @@ -1326,4 +1326,45 @@ public function copyConfig(StorageInterface $source_storage, StorageInterface $t
    +   *   TRUE will match all content. Note that due to limitations with
    +   *   \PHPUnit_Util_XML::cssSelect this does not work when you pass a nested
    +   *   selector such as 'li h2'.
    

    That is a pretty heavy limitation. It degrades the very DX that we're trying to fix here back to a similarly awkward level as XPath. :-(

    Does the Symfony CssSelector component also have that limitation? — If it does not, then I'd actually rather go back to the original proposal to simply include that.

    Otherwise, it appears that some of the converted tests are working around that limitation by recursively calling cssSelect()... — so if pulling in the Symfony CssSelector component is not an option, I wonder whether we could at least automate that to retain a sane DX?

    CSS selectors are predictable and standardized, so something along the lines of the following might work:

    if (isset($contains) && !isset($content) && 1 < $nested = explode($selector, ' ')) {
      $content = $this->cssSelect($selector);
      $selector = end($nested);
    }
    
  2. +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
    @@ -1326,4 +1326,45 @@ public function copyConfig(StorageInterface $source_storage, StorageInterface $t
    +  protected function cssSelect($selector, $contains = TRUE, $content = FALSE) {
    

    The signature looks really strange to me.

    $selector is fine.

    But why does $contains default to TRUE? The default should be NULL.

    It's also not 100% clear to me what exactly $contains means — (1) does it operate on the raw content/markup (including elements), or (2) does it operate on the raw HTML node values, and in any case, (3) does it operate on the raw HTML content or on decoded text? (cf. htmlentitydecode())

    Likewise, $content should default to NULL. — All of the Boolean flags in this method signature do not make sense.

    Let's also be more accurate in the phpDoc @params and @return data types; i.e.:

    @param string $contains
    @param string|\DOMElement[] $content

    @return \DOMElement[]

    Lastly, DOMElement or DOMNode? Not the same.

  3. +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
    @@ -1326,4 +1326,45 @@ public function copyConfig(StorageInterface $source_storage, StorageInterface $t
    +        $value .= $item->ownerDocument->saveHtml($item);
    

    Note that "HTML" is all-uppercase in DOMDocument::saveHTML()

  4. +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
    @@ -1326,4 +1326,45 @@ public function copyConfig(StorageInterface $source_storage, StorageInterface $t
    +    if ($nodes = \PHPUnit_Util_XML::cssSelect($selector, $contains, $content, TRUE)) {
    
    +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/CssSelectWebTestBaseTest.php
    @@ -0,0 +1,71 @@
    +  function testCssSelect() {
    +    // Construct a simple HTML page with a title and a nested menu.
    +    $testpage = <<<HTML
    

    The "XML" part in this method concerns me.

    Is this compatible with HTML5?

    Let's change the test to additionally operate on some HTML5 elements; i.e.:

    1. Simply wrap the list into a SECTION, followed by an ASIDE, and lastly a NAV.

    2. Add some DETAILS + SUMMARY markup.

    3. Add one or more incomplete/auto-closed tags; e.g., a paragraph that isn't terminated.

    4. Some more dummy elements, time/audio/video/etc.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new6.69 KB
new11.25 MB

Does the Symfony component have that limitation: no
Does PHP Unit work with HTML 5: no, not until we bump above 3.7
Does Symfony: yes
I too favour the original patch, so here it is re-rolled.
Same concept, the do-not-test patch is just the core changes, the other is the whole shebang.
<rant style="old-man-grumbles">
Also I'd like to go on record again that we are using composer wrong, we shouldn't include core/vendor in version control, just composer.lock.
Yes thats an 11Mb patch just from running composer update symfony/css-selector.
</rant>

kim.pepper’s picture

Also I'd like to go on record again that we are using composer wrong, we shouldn't include core/vendor in version control, just composer.lock.

I second the motion.

larowlan’s picture

StatusFileSize
new3.16 KB
new253.53 KB

Seems a composer update changed the way dependencies are resolved, as on 2014-02-13 15:23:53 zf2 and guzzle/guzzle weren't brought in, but on 2014-03-09 15:09:15 they are.
So if I pin zend-feed and guzzle/http to their minor versions, and use --no-dev - I just get css-selector like expected.
Smaller patch.

larowlan’s picture

this is the right do-not-test.patch
and the --no-dev is not important/relevant

sun’s picture

Thank you!

+++ b/composer.json
@@ -18,12 +19,12 @@
-    "guzzle/http": "3.7.*",
+    "guzzle/http": "3.7.1",
...
-    "zendframework/zend-feed": "2.2.*"
+    "zendframework/zend-feed": "2.2.1"

Seems unrelated? Can we revert these?

larowlan’s picture

Please see comment 50

larowlan’s picture

sun’s picture

Title: Add ::cssSelect() method to TestBase leveraging PHPUnit_Util_XML » Replace xpath() with WebTestBase::cssSelect() by leveraging Symfony CssSelector
Status: Needs review » Reviewed & tested by the community

Thanks!

Next to the major argument of lacking HTML5 support, today I learned that the Behat/Mink framework also uses Symfony CssSelector — the grand master plan is to fully migrate from Simpletest to Mink (give or take Behat) in the long run (rather unlikely for 8.0.0, but definitely beyond).

So that makes two important reasons for going with Symfony CssSelector instead of PHPUnit_Util_XML.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 54: css-selector-symfont-1959660.shebang.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new262.26 KB

re-roll

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

back to rtbc, straight re-roll

larowlan’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new262.02 KB
new6.54 KB

@kim.pepper pointed out that the zend-feed pin has snuck back in.

re-roll to remove that and adding a 'core only' patch to aid reviews.

larowlan’s picture

missed the composer.lock change from removing the pin, thanks again @kim.pepper

kim.pepper’s picture

Back to RTBC from me if green.

Status: Needs review » Needs work

The last submitted patch, 60: css-selector-symfont-1959660.60.patch, failed testing.

larowlan’s picture

larowlan’s picture

Status: Needs work » Needs review
kim.pepper’s picture

Status: Needs review » Reviewed & tested by the community

...aaaand back to RTBC

sun’s picture

Thanks a lot, @larowlan!

This is desperately needed. XPath continues to cause pain for developers who are willing to write tests, but who get stuck on more complex DOM element assertions.

Let's pretty please end this pain right here and right now for D8. Sans the vendor component, the actual changes of this patch are almost neutral.

Tons of win at almost no cost. The one and only way to make everyone adopt the "tests by design" mantra is a stellar test authoring DX. This is a major contribution towards that goal.

catch’s picture

Assigned: Unassigned » dries

I like the css selector stuff using mink/behat, good to introduce that here.

Needs Dries for the new library though.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 60: css-selector-symfont-1959660.60.patch, failed testing.

dries’s picture

Assigned: dries » Unassigned

Seems like a handy library to me. Green light to use it!

larowlan’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new262.02 KB

re-roll

xjm’s picture

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

pfrenssen’s picture

Yay!!

larowlan’s picture

Draft change notice is here:
https://drupal.org/node/2276689

pfrenssen’s picture

Change record looks good, does not need more explanation I think. I added a link to the documentation of the Symfony CssSelector component for people that like to read more.

Status: Fixed » Closed (fixed)

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