Repository: nightwatchjs/nightwatch (js)

Issue:
Feat: Add `prop` and `property` as an alias of `getProperty` Command in the new Element API 
### Description


The `getProperty` should have the following alias 
- prop 
- property

The `getProperty` can be found in the `lib/api/web-element/commands` directory. 

### TODO 

- [ ] Add missing aliases 
- [ ] Add tests for the added aliases
- [ ] Add missing types and tests for the added types 


### Suggested solution

_No response_

### Alternatives / Workarounds

_No response_

### Additional Information

_No response_

Pull request description:
Add `.prop()` alias to `.getProperty()` command in new Element API. 
fixes #4173  
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 c752b45d..e8dd80f1 100644
--- a/lib/api/web-element/scoped-element.js
+++ b/lib/api/web-element/scoped-element.js
@@ -23,8 +23,8 @@ class ScopedWebElement {
       'findAllByPlaceholderText': ['getAllByPlaceholderText'],
       'findAllByAltText': ['getAllByAltText'],
       'getRect': ['getSize', 'getLocation', 'rect'],
+      'getProperty': ['property', 'prop'],
       'getText': ['text'],
-      'getProperty': ['property'],
       'getCssProperty': ['css'],
       'getAriaRole': ['ariaRole'],
       'isVisible': ['isDisplayed']
diff --git a/types/web-element.d.ts b/types/web-element.d.ts
index a1340784..e1df361f 100644
--- a/types/web-element.d.ts
+++ b/types/web-element.d.ts
@@ -159,6 +159,8 @@ export interface ScopedElement extends Element, PromiseLike<WebElement> {
   submit(): Promise<WebElement>;
 
   getProperty(name: string): ElementValue<string | null>;
+  prop(name: string): ElementValue<string | null>;
+  property(name: string): ElementValue<string | null>;
 
   setProperty(name: string, value: unknown): Promise<WebElement>;
 


Test patch:
diff --git a/test/src/api/commands/web-element/testGetProperty.js b/test/src/api/commands/web-element/testGetProperty.js
index b68b8c3d..58dca869 100644
--- a/test/src/api/commands/web-element/testGetProperty.js
+++ b/test/src/api/commands/web-element/testGetProperty.js
@@ -62,6 +62,30 @@ describe('element().getProperty() command', function () {
     assert.deepStrictEqual(resultValue, ['.signup']);
   });
 
+  it('test .element().prop() alias', async function() {
+    MockServer.addMock({
+      url: '/session/13521-10219-202/element/0/property/classList',
+      method: 'GET',
+      response: JSON.stringify({
+        value: ['.signup']
+      })
+    }, true);
+
+    const resultPromise = this.client.api.element('#signupSection').prop('classList');
+    assert.strictEqual(resultPromise instanceof Element, false);
+    assert.strictEqual(typeof resultPromise.find, 'undefined');
+
+    assert.strictEqual(resultPromise instanceof Promise, false);
+    assert.strictEqual(typeof resultPromise.then, 'function');
+
+    const result = await resultPromise;
+    assert.strictEqual(result instanceof WebElement, false);
+    assert.deepStrictEqual(result, ['.signup']);
+
+    const resultValue = await resultPromise.value;
+    assert.deepStrictEqual(resultValue, ['.signup']);
+  });
+  
   it('test .element().find().getProperty()', async function() {
     MockServer.addMock({
       url: '/session/13521-10219-202/element/1/property/classList',
@@ -109,4 +133,5 @@ describe('element().getProperty() command', function () {
     const resultValue = await resultPromise.value;
     assert.deepStrictEqual(resultValue, ['.signup']);
   });
+
 });
diff --git a/types/tests/webElement.test-d.ts b/types/tests/webElement.test-d.ts
index 0a36e12e..13d0aee7 100644
--- a/types/tests/webElement.test-d.ts
+++ b/types/tests/webElement.test-d.ts
@@ -139,6 +139,8 @@ describe('new element() api', function () {
     expectType<ElementValue<string>>(elem.text());
 
     expectType<ElementValue<string | null>>(elem.getProperty('property-name'));
+    expectType<ElementValue<string | null>>(elem.prop('property-name'));
+    expectType<ElementValue<string | null>>(elem.property('property-name'));
     expectType<ElementValue<string | null>>(elem.getAttribute('attrib-name'));
     expectType<ElementValue<string | null>>(elem.getValue());
     expectType<ElementValue<boolean>>(elem.isEnabled());