Repository: nightwatchjs/nightwatch (js)

Issue:
Add `tagName` as an alias of `getTagName` in the new Element API
### Description


The `getTagName` should have the following alias 
- `tagName` 


The `getTagName` 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 `.tagname()` as an alias for `.getTagName()`
fixes #4175 

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 3f691a06..539e0127 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'],
+      'getTagName': ['tagName'],
       'getAccessibleName': ['accessibleName'],
       'getCssProperty': ['css'],
       'getAriaRole': ['ariaRole'],
diff --git a/types/web-element.d.ts b/types/web-element.d.ts
index b33e07a0..f2e6de63 100644
--- a/types/web-element.d.ts
+++ b/types/web-element.d.ts
@@ -148,6 +148,7 @@ export interface ScopedElement extends Element, PromiseLike<WebElement> {
   getLocation(): ElementValue<ScopedElementRect>;
 
   getTagName(): ElementValue<string>;
+  tagName(): ElementValue<string>;
 
   getText(): ElementValue<string>;
   text(): ElementValue<string>;


Test patch:
diff --git a/test/src/api/commands/web-element/testGetTagName.js b/test/src/api/commands/web-element/testGetTagName.js
index a1b0f64e..2c7f3318 100644
--- a/test/src/api/commands/web-element/testGetTagName.js
+++ b/test/src/api/commands/web-element/testGetTagName.js
@@ -38,6 +38,30 @@ describe('element().getTagName() command', function () {
     assert.strictEqual(resultValue, 'div');
   });
 
+  it('test .element().tagName() alias', async function() {
+    MockServer.addMock({
+      url: '/session/13521-10219-202/element/0/name',
+      method: 'GET',
+      response: JSON.stringify({
+        value: 'div'
+      })
+    }, true);
+
+    const resultPromise = this.client.api.element('#signupSection').tagName();
+    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.strictEqual(result, 'div');
+
+    const resultValue = await resultPromise.value;
+    assert.strictEqual(resultValue, 'div');
+  });
+
   it('test .element().find().getTagName()', async function() {
     MockServer.addMock({
       url: '/session/13521-10219-202/element/1/name',
@@ -110,4 +134,5 @@ describe('element().getTagName() command', function () {
     assert.strictEqual(await resultPromise.assert.not.contains('dx'), 'div');
     assert.strictEqual(await resultPromise.assert.not.matches(/di[a-z]{2}x/), 'div');
   });
+
 });
diff --git a/types/tests/webElement.test-d.ts b/types/tests/webElement.test-d.ts
index b9c2b45c..17b58b6e 100644
--- a/types/tests/webElement.test-d.ts
+++ b/types/tests/webElement.test-d.ts
@@ -144,6 +144,7 @@ describe('new element() api', function () {
 
     expectType<ElementValue<string>>(elem.getId());
     expectType<ElementValue<string>>(elem.getTagName());
+    expectType<ElementValue<string>>(elem.tagName());
     expectType<ElementValue<string>>(elem.getText());
     expectType<ElementValue<string>>(elem.text());