Problem/Motivation

In order to make the jump to the next major version of Nightwatch as painless as possible (hah!), let's replace the deprecated functions in this issue before attempting to make the jump.

Steps to reproduce

The output of the GitLab CI Nightwatch job currently tells us that they are present with a cheery:
- This command has been deprecated and is removed from the W3C Webdriver standard. for keys()
- DEPRECATED: the assertion .containsText() has been deprecated and will be removed from future versions. Use assert.textContains(). for .containsText()
- DEPRECATED: the assertion .value() has been deprecated and will be removed from future versions. Use assert.valueEquals() instead. for .value()

Proposed resolution

Deprecated command keys()

Replace the keys() command with an extended Selenium user actions API command.

Before:

.keys(some.key)

After:

.perform(function () {
  return this.actions().sendKeys(some.key);
})

Deprecated command .containsText()

Replace the .containsText() command with .textContains().

Before:

.assert.containsText(
  'selector',
  'some text',
)

After:

.assert.textContains(
  'selector',
  'some text',
)

Deprecated command value()

Replace the .value() command with .valueEquals().

Before:

.assert.value(
  'selector',
  'some text',
)

After:

.assert.valueEquals(
  'selector',
  'some text',
)

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3413135

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

Spokje created an issue. See original summary.

spokje’s picture

Issue summary: View changes
spokje’s picture

Issue summary: View changes
spokje’s picture

Issue summary: View changes
spokje’s picture

Issue summary: View changes
spokje’s picture

Issue summary: View changes

spokje’s picture

Issue summary: View changes
spokje’s picture

Issue summary: View changes
spokje’s picture

Issue summary: View changes
spokje’s picture

Issue summary: View changes
spokje’s picture

Assigned: spokje » Unassigned
Status: Active » Needs review
smustgrave’s picture

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

Applied the MR and did a search and replacement seems good.

longwave’s picture

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

All looks correct to me. Backported to 10.2.x to keep things in sync.

Committed and pushed 95348401e9 to 11.x and 36c793867c to 10.2.x. Thanks!

  • longwave committed 36c79386 on 10.2.x
    Issue #3413135 by Spokje: Replace deprecated functions in Nightwatch...

  • longwave committed 95348401 on 11.x
    Issue #3413135 by Spokje: Replace deprecated functions in Nightwatch...

Status: Fixed » Closed (fixed)

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