Problem/Motivation

BrowserTestBase::initFrontPage() exists to work around a limitation in WebDriver where cookies cannot be set unless the domain in question has already been visited.

However, not all functional tests likely need to load the homepage, so maybe we can improve performance a tiny bit by loading an image instead of the homepage - this should set the domain without having to execute any PHP.

Steps to reproduce

Proposed resolution

Change this line in ::initFrontPage():

    $session->visit($this->baseUrl);

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3589236

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

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review

Curious as to whether this makes any difference, I suspect there's not much in it. But perhaps we could remove initFrontPage() altogether (including all subclass overrides) if we can assume the image is enough?

longwave’s picture

Not even sure this is needed at all. The comment says

   * According to the W3C WebDriver specification a cookie can only be set if
   * the cookie domain is equal to the domain of the active document. When the
   * browser starts up the active document is not our domain but 'about:blank'
   * or similar. To be able to set our User-Agent and Xdebug cookies at the
   * start of the test we now do a request to the front page so the active
   * document matches the domain.

but even if I comment the visit() out entirely then I can still place breakpoints inside Drupal and they are hit during a test. Perhaps the webdriver implementation no longer has this issue?

mstrelan’s picture

Are you using xdebug.start_with_request = trigger? Because ddev uses on by default which I don't think requires the cookie. I'd like to not break the trigger mode as we use that a lot outside of ddev.

catch’s picture

We could at least only do the request when xdebug is enabled if it's only really for that?