我已经使用Appium的打字稿+摩卡+柴写了端到端测试。我试图向下滚动或隐藏键盘,以便可以在测试期间访问字段。
这是我的考试
import { AppiumDriver, createDriver, SearchOptions, nsCapabilities } from "nativescript-dev-appium";
import { assert } from "chai";
describe("Create", () => {
let driver: AppiumDriver;
it.only("creates new item", async function () {
driver = await createDriver();
driver.hideKeyboard();
const commentField = await driver.findElementByAutomationText("comment");
await commentField.sendKeys("Used as a camera");
}
}
当我运行它时,出现以下错误;
> node ./node_modules/nativescript-dev-appium/check-dev-deps.js && tsc -p e2e && mocha --opts ./e2e/config/mocha.opts "--runType" "device.samsung"
e2e/1_asset_create.e2e-spec.ts:61:20 - error TS2339: Property 'hideKeyboard' does not exist on type 'AppiumDriver'.
61 driver.hideKeyboard();
~~~~~~~~~~~~
Found 1 error.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ e2e: `node ./node_modules/nativescript-dev-appium/check-dev-deps.js && tsc -p e2e && mocha --opts ./e2e/config/mocha.opts "--runType" "device.samsung"`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/map7/.npm/_logs/2019-11-14T01_51_33_806Z-debug.log