Appium tips for react-native apps

Petr Lzicar
2 min readJan 12, 2022

--

I’ve been collected some tips, which about i want to share you. I believe, that can helps, when you are about start with appium or searching for improvements in yours test suites.

Keep test suites small

In my opinion is maintaining tests as small and simple units the right way. Don’t do complex passages in an application. It helps you to identify where problem is in broken or failed tests. E2E tests has tendency to outgrow to easy-break, unstable and long-running beast.

Appium test suites in Prace za rohem app

Choose right test suites structure

Main point is in break code into structures, which are clear and ensure the reuse of individual parts. In our projects we divide these structures into:

  • Test Specifications -> standalone test case
  • Pages -> every page in application
  • Forms -> every form in application
  • Page objects -> reusable pieces, or encapsulated widgets

The project can be split in more detail, down to individual atoms, but it was not suitable for our needs.

Illustration of test specification

Use helpers

Create a reusable collection for common tasks with Gestures, Alerts, Webviews, etc… I’ve using collection from https://github.com/webdriverio/appium-boilerplate and I am satisfied with it.

Avoid position=”absolute” for container's views

There is a problem that appium doesn’t see elements inside absolutely positioned views. So you can’t interact with. Learn more.

Set GPS coordinates directly

In our application requires getting location soon after startup and we use 2 tests for it:
1. for manual getting location from Map thru suggestion list

Appium — use suggestion list in Prace za rohem app

2. via GPS. All other tests use location via GPS, it's helps with speedup theirs runs.

Appium — use GPS in Prace za rohem app

Inspire yourself

I highly recommend exploring https://github.com/webdriverio/appium-boilerplate for more inspiration.

Thanks for reading!

--

--