Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added return type as scopedvalue and removed unwanted changes
Browse files Browse the repository at this point in the history
subhajit20 committed Feb 23, 2024

Verified

This commit was signed with the committer’s verified signature.
mxsasha Sasha Romijn
1 parent c990fc6 commit 73b21ac
Showing 3 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/api/web-element/isVisible.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Returns true if the element is visisble.
*
* For more info on working with DOM elements in Nightwatch, refer to the <a href="https://nightwatchjs.org/guide/writing-tests/finding-interacting-with-dom-elements.html">Finding & interacting with DOM Elements</a> guide page.
*
* @example
* export default {
* demoTest(browser: NightwatchAPI): void {
* const result = browser.element('#main ul li a.first').isVisible();
* .assert.valueEquals('custom text');
* },
*
* async demoTestAsync(browser: NightwatchAPI): Promise<void> {
* const result = await browser.element('#main ul li a.first').isVisible();
* console.log('element text:', result);
* }
* }
*
* @since 3.0.0
* @method isVisible
* @memberof ScopedWebElement
* @instance
* @syntax browser.element(selector).isVisible()
* @see https://www.w3.org/TR/webdriver#dfn-get-element-text
* @returns {ScopedValue<string>}
*/
module.exports.command = function() {
return this.runQueuedCommandScoped('isElementDisplayed');
};
1 change: 1 addition & 0 deletions types/tests/webElement.test-d.ts
Original file line number Diff line number Diff line change
@@ -140,6 +140,7 @@ describe('new element() api', function () {
expectType<ElementValue<string | null>>(elem.getProperty('property-name'));
expectType<ElementValue<string | null>>(elem.getAttribute('attrib-name'));
expectType<ElementValue<string | null>>(elem.getValue());
expectType<ElementValue<string | null>>(elem.isVisible());

expectType<ElementValue<ScopedElementRect>>(elem.getRect());
expectType<ElementValue<ScopedElementRect>>(elem.getSize());
2 changes: 2 additions & 0 deletions types/web-element.d.ts
Original file line number Diff line number Diff line change
@@ -188,6 +188,8 @@ export interface ScopedElement extends Element, PromiseLike<WebElement> {
rightClick(): Promise<WebElement>;

waitUntil(signalOrOptions: WaitUntilActions | WaitUntilOptions, waitOptions?: WaitUntilOptions): Promise<WebElement>;

isVisible: ElementValue<string | null>;
}

type WaitUntilOptions = {

0 comments on commit 73b21ac

Please sign in to comment.