package ru.otus.mobile.ui;

import io.appium.java_client.AppiumBy;
import org.openqa.selenium.By;
import ru.otus.mobile.config.MobileContext;

public final class MobileSelectors {
    private MobileSelectors() {
    }

    public static By id(String id) {
        return AppiumBy.id(MobileContext.packageName() + ":id/" + id);
    }

    public static By accessibilityId(String id) {
        return AppiumBy.accessibilityId(id);
    }

    public static By textContains(String text) {
        String safeText = text.replace("\"", "\\\"");
        return AppiumBy.androidUIAutomator("new UiSelector().textContains(\"" + safeText + "\")");
    }
}
