Pull to refresh

Comments 1

А у нас был похожий опыт!

Я начал проставлять айдишки в приложении iOS сам. Позднее девелоперы увидев помогли сделать генерацию всех айдишек автоматически если билд не релиз или не продакшн.

пример:

<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="111" width="375" height="56" name="generated_MultipleBalanceView">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="111" width="375" height="56" name="generated_UIStackView">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="95" y="111" width="185" height="56" name="generated_UIStackView">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="95" y="111" width="107" height="56" name="generated_AnimatingBalanceLabel">
<XCUIElementTypeStaticText type="XCUIElementTypeStaticText" enabled="true" visible="false" x="95" y="111" width="107" height="56" name="balanceLabel" label="£0,00" value="£0,00">

таким образом автоматом были доступны мне (я на аппиуме пишу) хоть какие-то ид чтобы писать не зализая в код iOS.

сейчас я уже не часто меняю сгенеренную идшку на свою (тут в примере - `balanceLabel`).

метод уже прижился в нескольких фирмах. реализация правда сделана чуть по разному.

но в обоих меняю ид (если надо) крайне удобно добавив '.id("myID")' к любому элементу:

let saveAmountLabel = Label().id("saveAmountLabel").style(.amount)

вот такой опыт.

Кстати по поводу одиноковых элементов в Аппиуме прекрасные варианты как искать типа:

    // chain: generated_UINavigationBar -> generated_UINavigationBar
    @iOSXCUITFindBys(value = {
            @iOSXCUITBy(id = "generated_UINavigationBar"),
            @iOSXCUITBy(id = "generated__UIButtonBarButton")
    })
    
    // all: X1View or X2View
    @iOSXCUITFindAll(value = {
            @iOSXCUITBy(id = "X1View"),
            @iOSXCUITBy(id = "X2View")
    })
    
    // all chain all: any X1View or X2View -> any X3View or X4View
    @iOSXCUITFindAll(value = {
            @iOSXCUITBy(id = "X1View")
            @iOSXCUITBy(id = "X2View")
    })
    @iOSXCUITFindAll(value = {
            @iOSXCUITBy(id = "X3View"),
            @iOSXCUITBy(id = "X4View")
    }, priority = 1)
    
    // classChain: get second 'generated_LinkButton' then inside first 'XCUIElementTypeStaticText'
    @iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeButton[`name == \"generated_LinkButton\"`][2]/**/XCUIElementTypeStaticText")
    
    // predicate class 'XCUIElementTypeImage' with name contains 'cardActiveImage_'
    @iOSXCUITFindBy(iOSNsPredicate = "type == 'XCUIElementTypeImage' AND name CONTAINS[cd] 'cardActiveImage_'")
    
    // now any combination of all above :-)

Sign up to leave a comment.