1 of 29

DETOX�MOBILE AUTOMATION TEST

Flavio, Di Carlo | Software engineer

2 of 29

MEETING AGENDA

  1. Case study: Poker Platform
  2. Automation Test Tools
  3. Detox: what is it?
  4. Detox: API
  5. Detox: let’s start
  6. Demo

3 of 29

CASE STUDY�POKER PLATFORM

4 of 29

POKER PLATFORM

CASE STUDY

5 of 29

MANUAL TESTING ADVANTAGES

  • Anyone can test (no technical skills required)
  • Easiest and most efficient way to improve quality
  • Focused on customer’s work flow
  • User Experience

CASE STUDY

6 of 29

HOW CAN AUTOMATION HELP

  • No-regression Test
  • Multi-platform Test
  • Multi-language Test
  • Device Coverage
  • OS Coverage

CASE STUDY

7 of 29

CUMULATED COSTS

CASE STUDY

8 of 29

AUTOMATION�TEST TOOLS

9 of 29

AUTOMATION TEST TOOLS

10 of 29

MOBILE AUTOMATION

PROS

CONS

  • Most used framework
  • Native, web & hybrid app
  • Real device & simulator
  • Can use Java, JS, PHP, etc
  • Compatible with Selenium
  • Auto-generated test script
  • Complex configuration
  • Slow execution
  • High CPU/RAM usage
  • Only one device at a time
  • Black-box test

AUTOMATION TEST TOOLS

11 of 29

DETOX�WHAT IS IT?

12 of 29

DETOX

WHAT IS IT?

  • End-to-end test based on JavaScript
  • Multi-platform: iOS, Android, ReactNative
  • Uses native framework: EarlGrey and Espresso
  • Gray-box test
  • Supports a large variety of test runners (Jest, Mocha, etc)
  • Made for CI platforms like Jenkins, GitLab, Travis, etc.

13 of 29

DETOX

ARCHITECTURE

DETOX

DETOX

TESTER

DETOX�MEDIATOR�SERVER

DETOX�NATIVE�CLIENT

TEST�RUNNER

test.js

EARL�GREY

RESULT

14 of 29

DETOX�API

15 of 29

OBJECT

DETOX

DETOX

DEVICE

.init()

.cleanup()

.beforeAll()

.beforeEach()

.afterAll()

.afterEach()

.installApp()

.launchApp()

.terminateApp()

.takeScreenshot()

.setLocation(lat, lon)

.sendUserNotification(n)

.matchFace()

.unmatchFace()

16 of 29

METHODS

DETOX

MATCHERS

ACTIONS

EXPECT

by.id()

by.label()

by.text()

by.type()

.tap()

.swipe()

.typeText()

.clearText()

.longPress()

.scrollToIndex()

.getAttributes()

.toExist()

.toBeVisible()

.toBeFocused()

.toHaveId()

.toHaveText()

.toHaveValue()

.not()

17 of 29

DETOX

EXAMPLE TEST SCRIPT

18 of 29

DETOX�LET’S START

19 of 29

DETOX

          • npm
          • nodeJS
          • detox CLI
          • Android Studio, xCode
          • applesimutils (optional)

PRE-REQUIREMENTS

20 of 29

DETOX

INSTALL AND INIT

21 of 29

DETOX

CONFIGURE DETOX PROJECT

22 of 29

DETOX

CONFIGURE DETOX PROJECT

23 of 29

DETOX

EXECUTE TEST

Execute specific .js file

$ detox test --configuration ios e2e/firstTest.e2e.js

Execute all .js files in e2e folder

$ detox test --configuration ios

24 of 29

DETOX

DEBUGGING PARAMS

--loglevel              Log level ["fatal", "error", "warn", "info", "verbose", "trace"]

--record-logs           Save logs during each test to artifact directory

--record-timeline     Record tests and events timeline, for visual display on the � chrome://tracing tool [Jest Only]

--record-videos       Save screen recordings before and after each test to artifacts directory

--take-screenshots  Save screenshots before and after each test to artifacts directory�

25 of 29

DETOX

TEST RESULT LOG

26 of 29

DEMO

27 of 29

QUESTIONS

28 of 29

THANK YOU

29 of 29