O'Reilly logo

React Native Cookbook by Crysfel Villa, Stan Bershadskiy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Pressing a button and testing the result

Now that we know how to get elements using XPath, we can find the button that we have and then press it to test whether there's an alert message.

Getting ready

In order to complete this recipe, we need to have the Appium server running, integrated Mocha with WD (take a look at recipe number 3 in this chapter), and our device should be plugged in to our Mac.

This recipe depends on the previous one; we will be updating the same files.

How to do it...

  1. Let's open the src/features/input.test.js file; we are going to create a new test to type an e-mail address and click the button. There are several steps that we need to do in here:
           it('should show an alert with the email address',       function() {       // ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required