當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript AppiumDriver.compareElement方法代碼示例

本文整理匯總了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;
     }
 });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:31,代碼來源:tests3.e2e.ts

示例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);
 });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:10,代碼來源:tests2.e2e.ts

示例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;
        });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:22,代碼來源:tests.e2e.ts

示例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);
 });
開發者ID:NativeScript,項目名稱:nativescript-dev-webpack,代碼行數:5,代碼來源:tests.e2e-spec.ts

示例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;
 });
開發者ID:tjvantoll,項目名稱:sample-Groceries,代碼行數:6,代碼來源:groceries.e2e.ts


注:本文中的nativescript-dev-appium.AppiumDriver.compareElement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。