本文整理匯總了TypeScript中nativescript-dev-appium/lib/parser.runType類的典型用法代碼示例。如果您正苦於以下問題:TypeScript runType類的具體用法?TypeScript runType怎麽用?TypeScript runType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了runType類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("Verify data-form date is visible and responsive", async () => {
let date;
let month;
let day;
if (isAndroid) {
date = await driver.findElementByText("Wed, 06.04", SearchOptions.exact);
await date.click();
if (runType.includes("android27") || runType.includes("android23")) {
month = await driver.findElementByText("Apr", SearchOptions.exact);
day = await driver.findElementByText("06", SearchOptions.exact);
}
if (runType.includes("android24")) {
month = await driver.findElementByText("Wed, Apr 6", SearchOptions.contains);
day = await driver.findElementByText("6", SearchOptions.exact);
}
}
else {
date = await driver.findElementByAccessibilityId("Apr 6, 2016", SearchOptions.exact);
await date.click();
month = await driver.findElementByText("April", SearchOptions.exact);
day = await driver.findElementByText("6", SearchOptions.exact);
}
expect(date).to.exist;
expect(day).to.exist;
expect(month).to.exist;
if (isAndroid) {
if (runType.includes("android23")) {
return;
} else {
const seven = await driver.findElementByText("7", SearchOptions.exact);
await seven.click();
}
const ok = await driver.findElementByText("OK", SearchOptions.exact);
await ok.click();
date = await driver.findElementByText("Thu, 07.04", SearchOptions.exact);
expect(date).to.exist;
} else {
await clickBelowElementCenter(day, driver);
date = await driver.findElementByAccessibilityId("Apr 7, 2016", SearchOptions.exact);
await date.click();
}
});
示例2: navigateBackToHome
import { AppiumDriver, SearchOptions, Direction, UIElement } from "nativescript-dev-appium";
import { runType } from "nativescript-dev-appium/lib/parser";
const isAndroid: boolean = runType.includes("android");
export const QUEUE_WAIT_TIME: number = 600000; // Sometimes SauceLabs threads are not available and the tests wait in a queue to start. Wait 10 min before timeout.
export async function navigateBackToHome(driver: AppiumDriver, view?: string) {
let location = view !== undefined ? view : "ListView Angular";
let homeTitle = await driver.findElementByTextIfExists(location, SearchOptions.exact);
while (homeTitle === undefined) {
await driver.navBack();
await driver.wait(1000);
homeTitle = await driver.findElementByTextIfExists(location, SearchOptions.exact);
}
}
export async function navigateBackToView(driver: AppiumDriver, view: string) {
await navigateBackToHome(driver, view);
}
export async function scrollToElement(driver: AppiumDriver, element: string, direction: Direction = Direction.down) {
let listView;
if (isAndroid) {
listView = await driver.findElementByClassName("android.widget.FrameLayout");
}
else {
listView = await driver.findElementByClassName("XCUIElementTypeCollectionView");
}
const listItem = await listView.scrollTo(
direction,
() => driver.findElementByText(element, SearchOptions.contains),
示例3: function
import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium";
import { isSauceLab, runType, capabilitiesName } from "nativescript-dev-appium/lib/parser";
import { expect } from "chai";
import { ImageOptions } from "nativescript-dev-appium/lib/image-options";
const isSauceRun = isSauceLab;
const isAndroid: string = runType.includes("android");
describe("Groceries", async function () {
let driver: AppiumDriver;
const loginButtonText = "Login";
const email = "groceries@mailinator.com";
const password = "123";
const fruit = "apple";
const recentButtonText = "Recent";
const doneButtonText = "Done";
const logOffButtonText = "Log Off";
const invalidEmail = "groceries@mailinator";
const invalidEmailWarningText = "valid email";
const okButtonText = "OK";
const cancelButtonText = "Cancel";
const signUpHereButtonText = "Sign up here";
const signUpButtonText = "Sign up";
const backToLoginButtonText = "Back to login";
const forgotPasswordButtonText = "Forgot";
const forgotPasswordFormText = "reset";
const clickOnCrossOrCheckboxBtn = async () => {
if (isAndroid) {
// First image is the menu, second is the cross button. The rest are pairs checkbox/bin per list item.
const allImages = await driver.findElementsByClassName(driver.locators.image);