Repository: nightwatchjs/nightwatch (js)

Issue:
Add `accessibleName` as an alias for `getAccessibleName` in the new Element API.
### Description

The `getAccessibleName` should have the following alias 
- `accessibleName` 


The `getAccessibleName` can be found in the `lib/api/web-element/commands` directory. 


### Suggested solution

_No response_

### Alternatives / Workarounds

_No response_

### Additional Information

_No response_

Pull request:
Feat: Added `.accessibleName()` as an alias for `.getAccessibleName()`.

fixes #4177  

Thanks in advance for your contribution. Please follow the below steps in submitting a pull request, as it will help us with reviewing it quicker.

- [ . ] Before marking your PR for review, please test and verify your changes by making appropriate modifications to any of the Nightwatch example tests (present in `examples/tests` directory of the project) and running them. `ecosia.js` and `duckDuckGo.js` are good examples to work with.
- [ . ] Create a new branch from master (e.g. `features/my-new-feature` or `issue/123-my-bugfix`);
- [ . ] If you're fixing a bug also create an issue if one doesn't exist yet;
- [ ] If it's a new feature explain why do you think it's necessary. Please check with the maintainers beforehand to make sure it is something that we will accept. Usually we only accept new features if we feel that they will benefit the entire community;
- [ ] Please avoid sending PRs which contain drastic or low level changes. If you are certain that the changes are needed, please discuss them beforehand and indicate what the impact will be;
- [ ] If your change is based on existing functionality please consider refactoring first. Pull requests that duplicate code will most likely be ignored;
- [ ] Do not include changes that are not related to the issue at hand;
- [ ] Follow the same coding style with regards to spaces, semicolons, variable naming etc.;
- [ ] Always add unit tests - PRs without tests are most of the times ignored.


Patch:
diff --git a/lib/api/web-element/scoped-element.js b/lib/api/web-element/scoped-element.js
index e8dd80f1..3f691a06 100644
--- a/lib/api/web-element/scoped-element.js
+++ b/lib/api/web-element/scoped-element.js
@@ -25,6 +25,7 @@ class ScopedWebElement {
       'getRect': ['getSize', 'getLocation', 'rect'],
       'getProperty': ['property', 'prop'],
       'getText': ['text'],
+      'getAccessibleName': ['accessibleName'],
       'getCssProperty': ['css'],
       'getAriaRole': ['ariaRole'],
       'isVisible': ['isDisplayed']
diff --git a/types/web-element.d.ts b/types/web-element.d.ts
index 699aa6cf..b33e07a0 100644
--- a/types/web-element.d.ts
+++ b/types/web-element.d.ts
@@ -181,6 +181,7 @@ export interface ScopedElement extends Element, PromiseLike<WebElement> {
   upload(file: string): Promise<WebElement>;
 
   getAccessibleName(): ElementValue<string>;
+  accessibleName(): ElementValue<string>;
 
   getAriaRole(): ElementValue<string>;
   ariaRole(): ElementValue<string>;


Test patch:
diff --git a/test/src/api/commands/web-element/testGetAccessibleName.js b/test/src/api/commands/web-element/testGetAccessibleName.js
index 349ddc22..5b3bca5a 100644
--- a/test/src/api/commands/web-element/testGetAccessibleName.js
+++ b/test/src/api/commands/web-element/testGetAccessibleName.js
@@ -40,6 +40,31 @@ describe('element().getAccessibleName() command', function () {
     assert.strictEqual(resultValue, 'Signup');
   });
 
+  it('test .element().accessibleName() alias', async function() {
+    MockServer.addMock({
+      url: '/session/13521-10219-202/element/0/computedlabel',
+      method: 'GET',
+      response: JSON.stringify({
+        value: 'Signup'
+      })
+    }, true);
+
+    const resultPromise = this.client.api.element('#signupSection').accessibleName();
+    assert.strictEqual(resultPromise instanceof Element, false);
+    assert.strictEqual(typeof resultPromise.find, 'undefined');
+
+    assert.strictEqual(resultPromise instanceof Promise, false);
+    assert.strictEqual(typeof resultPromise.then, 'function');
+    assert.strictEqual(typeof resultPromise.value, 'object');
+
+    const result = await resultPromise;
+    assert.strictEqual(result instanceof WebElement, false);
+    assert.strictEqual(result, 'Signup');
+
+    const resultValue = await resultPromise.value;
+    assert.strictEqual(resultValue, 'Signup');
+  });
+
   it('test .element().find().getAccessibleName()', async function() {
     MockServer.addMock({
       url: '/session/13521-10219-202/element/1/computedlabel',
@@ -115,4 +140,5 @@ describe('element().getAccessibleName() command', function () {
     assert.strictEqual(await resultPromise.assert.not.contains('Signupx'), 'Signup');
     assert.strictEqual(await resultPromise.assert.not.matches(/Si[a-z]{2}upx/), 'Signup');
   });
+
 });
diff --git a/types/tests/webElement.test-d.ts b/types/tests/webElement.test-d.ts
index 8e183e91..b9c2b45c 100644
--- a/types/tests/webElement.test-d.ts
+++ b/types/tests/webElement.test-d.ts
@@ -162,6 +162,7 @@ describe('new element() api', function () {
     expectType<ElementValue<ScopedElementRect>>(elem.getLocation());
 
     expectType<ElementValue<string>>(elem.getAccessibleName());
+    expectType<ElementValue<string>>(elem.accessibleName());
     expectType<ElementValue<string>>(elem.getAriaRole());
     expectType<ElementValue<string>>(elem.ariaRole());
     expectType<ElementValue<string>>(elem.getCssProperty('height'));