It seems to be using wrong Regular Expression for string comparison on Nightwatch.js assertion

Created on 31 January 2025, 2 months ago

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

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

javascript

Created by

πŸ‡―πŸ‡΅Japan tom konda Kanagawa, Japan

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024