Fix race conditions in OffCanvasTestBase

Created on 21 February 2018, over 6 years ago
Updated 30 January 2023, almost 2 years ago

Problem/Motivation

OffCanvasTestBase and tests that use it are potential sources of random test failures since they involve a series of link-clicking race conditions.

1) Drupal\Tests\system\FunctionalJavascript\OffCanvasTest::testOffCanvasLinks with data set "stark" ('stark')
WebDriver\Exception\UnknownError: unknown error: Element ... is not clickable at point (516, 87). Other element would receive the click: ...

Apparently, there's a race where we can't click the link when we think we can, as other elements are still moving around on the page and the link we want to click is obscured when the test is trying to click.

Proposed resolution

Modify OffCanvasTest to use an alternative clickLink() method that waits for the link to be clickable before trying to click it.

If we timeout and the link is not clickable after "enough" waiting, we throw the "this ain't clickable" exception and the test will fail. If some other exception is caught, we immediately throw it.

Patch #23 shows the basic approach, and was run 360 times by the d.o testbot. It only failed once, and that was an unrelated mkdir() problem, not the race condition for the link clicking.

Remaining tasks

  1. Rename the OffCanvasTestBase::clickLink() method to something else. Either safeClick() (via @tedbow / @alexpott in #30) or perhaps _safeClick() (via @dww in #32) so as not to conflict with whatever we do at #3032275: Create a fault-tolerant method for interacting with links and fields in Javascript tests β†’ .
  2. Verify final testbot result.
  3. Re-RTBC.
  4. Commit.

User interface changes

None.

API changes

None.

Data model changes

None.

Original report by @tedbow

Looking to see if possible to use WebDriver for off-canvas and setting_tray related tests

Suggested to solve testing πŸ› [PP-1] Settings Tray prevents editing some fields with QuickEdit module Postponed

πŸ“Œ Task
Status

Needs work

Version

10.1 ✨

Component
Settings trayΒ  β†’

Last updated 8 days ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @tedbow
Created by

πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

Production build 0.71.5 2024