Skip to content

Localization testing with appium mocha #260

@schnapzz

Description

@schnapzz

Hi.

I'm currently trying to figure out a good way to test localization of an app and have some trouble accessing the label text of a button UIElement after i've accessed the element by automation text. After accessing the button UIElement i'm only able to get the automationText to test against.
It's my first time doing any form of testing with nativescript, appium and mocha and i might go about it completely wrong and if so advise would be much appreciated.

What i'm testing on
iPad simulator (9.7 inch) with OS v. 12.4
node v10.16.3
npm v6.9.0
{N} v. 6.0.1
runtimes v 6.0.1
nativescript-localize for i18n localization

I've followed setup instructions and found some issues here where people hadn't installed carthage, which i've installed.

A simple test looks something like this
const daDK = require(dk.default.json); // localization file for danish const changeUserButton = await driver.findElementByAutomationText('changeUserButton'); expect(await changeUserButton.text()).to.be.equal(daDK.user.change_user);
Doing a log of the await changeUserButton.text() retreives the automationText where it should have been Skift Bruger.

I've also tried to access elements in different way ie. with findElementByXPath and findElementByText (though i've read text is only android).

Any suggestions as to solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions