Problem/Motivation

In /core/tests/Drupal/Nightwatch/Assertions/deprecationErrorExists.js, the sessionStorageEntries variable is filtered with Array.prototype.filter(). This filter function checks that message has a specific string using new RegExp('[Deprecation]').test(message). But, this RegExp doesn't mean "[Deprecation]" includes in the message.
The same problem has /core/tests/Drupal/Nightwatch/Assertions/noDeprecationErrors.js too.

Steps to reproduce

1. Add console.warn('D'); next line of console.warn(`[Deprecation] ${message}`); in /core/misc/drupal.js
2. Remove '[Deprecation]' string from console.warn(`[Deprecation] ${message}`); in Drupal.deprecationError().
3. Add breakpoint line 8 at /core/tests/Drupal/Nightwatch/Assertions/deprecationErrorExists.js and run Nightwatch.js test from Node.js debuging terminal.
4. The deprecationMessages variable is assigned with no filtered value.

Proposed resolution

Replace new RegExp('[Deprecation]').test(message) with message.includes('[Deprecation]') in both files.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3503556

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

tom konda created an issue. See original summary.

tom konda’s picture

Status: Active » Needs work

Ran Functional JavaScript tests several times.
But there is an error on Drupal\Tests\ckeditor5\FunctionalJavascript\ImageUrlProviderTest.
Need to resolve this error.

tom konda’s picture

Status: Needs work » Needs review

I reran Functional JavaScript tests and all tests are passed.
It is probably random failure.
Please review.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Seems pretty straight forward

Searched for new RegExp('[Deprecation]'). and all 2 instances have been replaced.

longwave’s picture

Title: It seems to be using wrong Regular Expression for string comparison on Nightwatch.js assertion » Wrong Regular Expression for string comparison in Nightwatch.js assertion
longwave’s picture

Version: 11.x-dev » 10.4.x-dev
Status: Reviewed & tested by the community » Fixed

Good find!

Committed and pushed daf3cd72f76 to 11.x and 22ee1f029b0 to 11.1.x and ddddd508515 to 10.5.x and 6b55b8c6d24 to 10.4.x. Thanks!

  • longwave committed 6b55b8c6 on 10.4.x
    Issue #3503556 by tom konda: Wrong Regular Expression for string...

  • longwave committed ddddd508 on 10.5.x
    Issue #3503556 by tom konda: Wrong Regular Expression for string...

  • longwave committed 22ee1f02 on 11.1.x
    Issue #3503556 by tom konda: Wrong Regular Expression for string...

  • longwave committed daf3cd72 on 11.x
    Issue #3503556 by tom konda: Wrong Regular Expression for string...

longwave’s picture

Status: Fixed » Closed (fixed)

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