Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
> *Remark* [This repository] is a fork of [the original by Nativescript] (https://github.com/NativeScript/nativescript-dev-appium.git)

Fork from (https://github.com/EddyVerbruggen/nativescript-plugin-firebase/pull/1640).

# nativescript-dev-appium

A package to help with writing and executing e2e [Appium](http://appium.io) tests.
Expand Down
6 changes: 6 additions & 0 deletions lib/ui-element.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,10 @@ export declare class UIElement {
x: number;
y: number;
}): Promise<void>;

/**
* Returns if an element is enable
*/
isEnabled(): Promise<boolean>;

}
36 changes: 35 additions & 1 deletion lib/ui-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,4 +624,38 @@ export class UIElement {
await multiAction.perform();
logInfo("End pinch gesture!");
}
}

/**
* Returns if an element is enabled
*/
public async isEnabled() {
const el = (await this.element());
if (!el) {
return false;
}
if (this._args.isAndroid) {
try {
const isEnabled = await el.getAttribute("clickable");
return isEnabled === "true" || isEnabled === true;
}
catch (error) {
console.error("Check if this is the correct element!");
}
}
try {
return await el.isEnabled();
}
catch (ex) {
console.warn("'enabled' attr is not reachable on this element!");
}

console.warn("Trying use 'value' attr!");
try {
const attrValue = await el.getAttribute("value");
return attrValue === "1" || attrValue === "true" || attrValue === true;
}
catch (error) {
return false;
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-dev-appium",
"version": "6.1.3",
"version": "6.1.4",
"description": "A NativeScript plugin to help integrate and run Appium tests",
"author": "NativeScript",
"license": "MIT",
Expand Down