Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit f960242

Browse files
Fix screenshot and locator not shown for android webview tests (#35)
1 parent 0bd1a61 commit f960242

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/plugin/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class AppiumDashboardPlugin extends BasePlugin {
9797

9898
let newCapabilities: Record<string, any> = {
9999
"appium:clearDeviceLogsOnStart": true,
100+
"appium:nativeWebScreenshot": true, //to make screenshot endpoint work in android webview tests
100101
};
101102

102103
Object.keys(newCapabilities).forEach((k) => {

src/plugin/locator-factory.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
import { response } from "express";
12
import loki from "lokijs";
23

34
const locatorCollection = new loki("locator.db").addCollection("locators");
45

6+
function getElementId(responseObj: any) {
7+
return (
8+
responseObj["ELEMENT"] || responseObj[Object.keys(responseObj).find((k: string) => k.startsWith("element")) || 0]
9+
);
10+
}
11+
512
async function saveLocator(strategy: any, elementResponse: any[]) {
613
elementResponse.forEach((e, i, arr) => {
714
let obj = {
815
using: strategy.using,
916
value: strategy.value,
10-
id: e["ELEMENT"],
17+
id: getElementId(e),
1118
index: null,
1219
} as any;
1320

0 commit comments

Comments
 (0)