Now that we require 8.6.x, we can update our JavaScript trait to use the new WebDriver capabilities, allowing us to move to Chrome! Which is a lot faster and more stable

Issue fork commerce-2998745

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mglaman created an issue. See original summary.

zaporylie’s picture

Status: Active » Needs review
StatusFileSize
new3 KB

I'm wondering if it is not enough to just swap BrowserTestBase for WebDriverTestBase in CommerceBrowserTestBase and remove some overrides we add in JavascriptTestTrait. Let's see how will it go.

Status: Needs review » Needs work

The last submitted patch, 2: 2998745-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

zaporylie’s picture

Ah, of course, CommerceBrowserTestBase is also used by Functional tests - stupid me. Well, IMHO we should go for a new base class - CommerceWebDriverTestBase. And perhaps deprecate the JavascriptTestTrait there altogether?

mglaman’s picture

zaporylie the trait was used to make it easier to share a base class and common helpers across Functional and FunctionalJavascript tests. It probably would have been easier to share core's base classes and create our own helper traits. I think the biggest part was simplifying setUp across classes.

It would probably be best to extend core classes so we don't lose on improvements, and just create helper test traits

zaporylie’s picture

I had the same conclusion after seeing tests failing and reading codebase focusing on how the tests were structured. And I agree that extracting reusable methods from each of the base classes and move it to the respective trait that will be later used across Functional and/or FunctionalJavascript tests is the way to go here. I don't have time to do it at this minute but I'll make a patch later this weekend.

Thanks for taking the time to answer here @mglaman.

zaporylie’s picture

Status: Needs work » Needs review
StatusFileSize
new44.07 KB

That will still fail but this time only about web driver incompatible tests.

Status: Needs review » Needs work

The last submitted patch, 7: 2998745-7.patch, failed testing. View results

zaporylie’s picture

Status: Needs work » Needs review
StatusFileSize
new44 KB

Ups, I should have checked that one before posting the patch.

Status: Needs review » Needs work

The last submitted patch, 9: 2998745-9.patch, failed testing. View results

zaporylie’s picture

That looks much better 😊

mglaman’s picture

Thank you so much for this. Now we just need to fix any status check calls it looks like.

zaporylie’s picture

Status: Needs work » Needs review
StatusFileSize
new2.96 KB
new46.27 KB

That should fix most of the tests. In fact, I only expect one remaining failure:

1) Drupal\Tests\commerce_cart\FunctionalJavascript\MultipleCartFormsTest::testUniqueAddToCartFormIds
Behat\Mink\Exception\UnsupportedDriverActionException: Response headers are not available from Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver

What's the value of the following test code? Can we simply remove it?

    $this->assertSession()->responseHeaderNotEquals('BigPipe-Test-Placeholders', '<none>');
    $this->assertSession()->responseHeaderEquals('BigPipe-Test-No-Js-Placeholders', '<none>');

----
Edit:
BTW Something really strange happens when you set the value for date input (@see PromotionTest::testCreatePromotionWithEndDate). I had to change the format and the date itself so that it doesn't start with 0. I feel like this is an issue with chromedriver but couldn't easily debug it so I gave up and just changed the date.

Status: Needs review » Needs work

The last submitted patch, 13: 2998745-13.patch, failed testing. View results

mglaman’s picture

What's the value of the following test code? Can we simply remove it?

It's our big_pipe integration test. We'll have to see how the core big_pipe tests were migrated.

zaporylie’s picture

But what's the exact reason we're checking if the headers are (not) ''? Is it used to ensure the page was loaded using big_pipe?

I can't find any test and/or patch file that would suggest there was a FunctionalJavascript test in core's big_pipe module that was using responseHeaderNotEquals/responseHeaderEquals in the past.

I only found this - https://github.com/drupalcommerce/commerce/pull/756#discussion_r126111860 - which is where we started testing this header in the first place.

mglaman’s picture

It's probably safe to remove that test based on Wim's comments:

I'm not sure why you're testing these two things?
And if you are, you probably want to test the specific value of this header?

It is only present as an assert in big_pipe's Functional test. Let's purge those assertions.

zaporylie’s picture

Status: Needs work » Needs review
StatusFileSize
new1.77 KB
new46.74 KB

It was my impression that these two assertions should just be removed. That's good we agree 👍

bojanz’s picture

This looks good at a glance. Now we need to figure out how to make the tests work on Travis. That might require a PR to https://github.com/LionsAd/drupal_ti

mglaman’s picture

Panopoly uses Chromedriver: https://github.com/panopoly/panopoly/blob/7.x-1.x/.travis.yml

I think if we export the MINK_ARGS properly it could "just work" when it comes to TravisCI.

@bojanz so we'd need to take that patch + adjustments to .travis.yml and prop it up on GitHub as a PR, yeah?

zaporylie’s picture

I am testing it now here - https://travis-ci.org/zaporylie/commerce/jobs/448019594
Seems to be working fine 🎊

zaporylie’s picture

or is it really :/
Jobs were terminated after 50 minutes due to a maximum time limit. Not sure if that's travis being slow or something wrong with the chromedriver.

zaporylie’s picture

It must be something related to the modified webdriver setup. The time spent on Unit/Kernel/Functional is more or less the same as before but FunctionalJavascript takes much longer.

mglaman’s picture

Assigned: Unassigned » mglaman

Working on pushing this to the end. Got it working 2/3 of the times.

mglaman’s picture

Assigned: mglaman » Unassigned
StatusFileSize
new49.65 KB

Here are the results: https://travis-ci.org/mglaman/commerce/builds/457635900

With chromedriver we can use concurrency. So I set FunctionalJavascript to 5, just to keep builds faster.

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

Waiting to commit push once https://travis-ci.org/drupalcommerce/commerce passes

  • mglaman committed f9b3442 on 8.x-2.x authored by zaporylie
    Issue #2998745 by zaporylie, mglaman: Take advantage of...
mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Woo! Committed. Thanks, zaporylie 👏👏👏👏

Status: Fixed » Closed (fixed)

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

Neha Mahajan made their first commit to this issue’s fork.

Neha Mahajan’s picture