本文整理匯總了TypeScript中nativescript-dev-appium.AppiumDriver.compareElement方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AppiumDriver.compareElement方法的具體用法?TypeScript AppiumDriver.compareElement怎麽用?TypeScript AppiumDriver.compareElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nativescript-dev-appium.AppiumDriver
的用法示例。
在下文中一共展示了AppiumDriver.compareElement方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("Tap disable btn and verify swipe is disabled", async () => {
const disableBtn = await driver.findElementByText("DISABLE", SearchOptions.exact);
await disableBtn.click();
let item = await driver.findElementByText("Joel Robertson", SearchOptions.exact);
expect(item).to.exist;
if (isAndroid) {
const rectangle = await item.getRectangle();
const centerX = rectangle.x + rectangle.width / 2;
const centerY = rectangle.y + rectangle.height / 2;
const wd = driver.wd();
const action = new wd.TouchAction(driver.driver);
action.press({ x: centerX, y: centerY })
.wait(100)
.moveTo({ x: 10, y: centerY })
.release();
await action.perform();
const selection = await driver.compareElement(item, "item");
expect(selection).to.equal(true);
}
else {
await driver.driver.execute('mobile: dragFromToForDuration', {
duration: 2.0,
fromX: 150,
fromY: 150,
toX: 50,
toY: 150
});
const del = await driver.findElementByTextIfExists("delete", SearchOptions.exact);
expect(del).to.be.undefined;
}
});
示例2: it
it("Select item and verify it is marked as selected", async () => {
const item0 = await driver.findElementByText("Item 0", SearchOptions.exact);
await item0.click();
const locator = isAndroid ? "android.view.ViewGroup" : "XCUIElementTypeCell";
const items = await driver.findElementsByClassName(locator);
const selected = isAndroid ? items[4] : items[0];
expect(selected).to.exist;
const selection = await driver.compareElement(selected, "selectedState");
expect(selection).to.equal(true);
});
示例3: it
it("should open Customization view", async () => {
await navigateBackToHome(driver);
const customizationButton = await driver.findElementByText(customizationText);
await customizationButton.click();
const customizationTitle = await driver.findElementByText(customizationText);
expect(customizationTitle).to.exist;
await driver.wait(1000);
const textField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
await textField.sendKeys("Bul");
const suggestionImage = isAndroid ?
await driver.findElementByClassName("com.telerik.widget.autocomplete.SuggestionItemViewHolder") :
await driver.findElementByAccessibilityId("bulgaria");
const compareSuggestion = await driver.compareElement(suggestionImage, "customization-suggestion");
expect(compareSuggestion).to.be.true;
const suggestionText = await driver.findElementByText("Bulgaria");
await suggestionText.click();
const autoCompleteClassName = isAndroid ? "com.telerik.widget.autocomplete.RadAutoCompleteTextView" : driver.locators.getElementByName("scrollview");
const autoComplete = await driver.findElementByClassName(autoCompleteClassName);
const compareToken = await driver.compareElement(autoComplete, "customization-tokens");
expect(compareToken).to.be.true;
});
示例4: it
it(`should find an element with ${styleType} style applied`, async function () {
const element = await driver.findElementByText(styleTypes[styleType]);
const result = await driver.compareElement(element, "style");
assert.isTrue(result);
});
示例5: it
it("should mark element as Done", async () => {
await clickOnCrossOrCheckboxBtn();
const appleItem = await driver.findElementByText(fruit);
const isItemDone = await driver.compareElement(appleItem, "itemDone", 0.07);
expect(isItemDone).to.be.true;
});