SlideShare a Scribd company logo
REACT Native is coming
The story of hybrid mobile application testing
Agenda
Agenda
1. Introduction
2. Cross-platform frameworks for mobile development
3. UI testing approaches for hybrid apps
4. Detox guide for applying UI tests in React Native projects
Agenda
1. Introduction
2. Cross-platform frameworks for mobile development
3. UI testing approaches for hybrid apps
4. Detox guide for applying UI tests in React Native projects
Agenda
1. Introduction
2. Cross-platform frameworks for mobile development
3. UI testing approaches for hybrid apps
4. Detox guide for applying UI tests in React Native projects
Agenda
1. Introduction
2. Cross-platform frameworks for mobile development
3. UI testing approaches for hybrid apps
4. Detox guide for applying UI tests in React Native projects
Long Story Short
SOme Time Ago...
Customers
And Their
money
meantime in Software Houses
But Now
Customers
And Their
money
Oh no !
O Nie !
Para Pollo !
Zonk !
Meanwhile in Software Houses
Cross Platform frameworks
How to Automate this as before ???
The Native white Box Test
The Native white Box Test
+ Fast
+ Easy setup
+ Wide range of open source
helpers
+ Compatible with Cloud Device
Farms
The Native white Box Test
+ Fast
+ Easy setup
+ Wide range of open source
helpers
+ Compatible with Cloud Device
Farms
− Different languages in project
repository
− Duplicated test code
The Cross Platform Black Box Test
The Cross Platform Black Box Test
+ Many supported languages
+ Wide community
+ Similar to Selenium
+ Single test code base
+ Compatible with Cloud Device
Farms
The Cross Platform Black Box Test
+ Many supported languages
+ Wide community
+ Similar to Selenium
+ Single test code base
+ Compatible with Cloud Device
Farms
− Slow
− Difficult debugging
− Lack of stability
The Cross Platform Gray Box Test
The Cross Platform Gray Box Test
+ Fast
+ Easy setup
+ Single test code base
+ The same language as default
project one
+ Close integration with source
code
+ API designed for a specific
platform
The Cross Platform Gray Box Test
+ Fast
+ Easy setup
+ Single test code base
+ The same language as default
project one
+ Close integration with source
code
+ API designed for a specific
platform
− No way / difficult to integrate
with Cloud Device Farm
− No outspread community
− Often still not developed
enough
Based on experience
with React Native
Automation Guide with Detox - cross platform React Native
Framework
How to add Detox to an existing project - Package.json file
How to add Detox to an existing project - Package.json file
"detox": {
How to add Detox to an existing project - Package.json file
"detox": {
"test-runner": "mocha",
"specs": "e2e",
"configurations": {
How to add Detox to an existing project - Package.json file
"detox": {
"test-runner": "mocha",
"specs": "e2e",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app",
"build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk
iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone X"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_24"
}
}
}
}
How to add Detox to an existing project - Package.json file
"detox": {
"test-runner": "mocha",
"specs": "e2e",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app",
"build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk
iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone X"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_24"
}
}
}
}
How to add Detox to an existing project - Package.json file
"detox": {
"test-runner": "mocha",
"specs": "e2e",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app",
"build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk
iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone X"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_24"
}
}
}
}
How to add Detox to an existing project - Package.json file
"detox": {
"test-runner": "mocha",
"specs": "e2e",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app",
"build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk
iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone X"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_24"
}
}
}
}
How to add Detox to an existing project - Package.json file
"detox": {
"test-runner": "mocha",
"specs": "e2e",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app",
"build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk
iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone X"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_24"
}
}
}
}
How to make apps testable?
<Text
style={styles.textStyle}>
{!this.state.clicked? defaultButtonText: "Polidea"}
</Text>
<Text
accessible= {true}
testID= {"ButtonText"}
accessibilityLabel= {"ButtonTextDesc"}
style={styles.textStyle}>
{!this.state.clicked? defaultButtonText: "Polidea"}
</Text>
How to make apps testable?
<Text
accessible= {true}
testID= {"ButtonText"}
accessibilityLabel= {"ButtonTextDesc"}
style={styles.textStyle}>
{!this.state.clicked? defaultButtonText: "Polidea"}
</Text>
How to write Test scripts - API Overview
Detox Object
Test plan
configuration
Device Object
Key events, Gestures,
Device settings
Matchers, Actions, Expectations
Finding Views, User’s actions, Validation
API
How to write Test scripts - Init script by example
require('babel-polyfill');
How to write Test scripts - Init script by example
require('babel-polyfill');
const detox = require('detox');
const config = require('../package.json').detox;
How to write Test scripts - Init script by example
require('babel-polyfill');
const detox = require('detox');
const config = require('../package.json').detox;
beforeAll(async () => {
await detox.init(config);
});
How to write Test scripts - Init script by example
require('babel-polyfill');
const detox = require('detox');
const config = require('../package.json').detox;
beforeAll(async () => {
await detox.init(config);
});
beforeEach(async () => {
await adapter.beforeEach();
});
How to write Test scripts - Init script by example
require('babel-polyfill');
const detox = require('detox');
const config = require('../package.json').detox;
beforeAll(async () => {
await detox.init(config);
});
beforeEach(async () => {
await adapter.beforeEach();
});
afterAll(async () => {
await adapter.afterAll();
await detox.cleanup();
});
How to write Test scripts - Test class by example
How to write Test scripts - Test class by example
describe('Example', () => {
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText')))
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible()
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it ('should Press me text be morphed in Polidea title after click on button',async
() =>{
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it ('should Press me text be morphed in Polidea title after click on button',async
() =>{
await element(by.id('ButtonText'))
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it ('should Press me text be morphed in Polidea title after click on button',async
() =>{
await element(by.id('ButtonText')).tap();
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it ('should Press me text be morphed in Polidea title after click on button',async
() =>{
await element(by.id('ButtonText')).tap();
await waitFor(element(by.text("Press Me")))
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it ('should Press me text be morphed in Polidea title after click on button',async
() =>{
await element(by.id('ButtonText')).tap();
await waitFor(element(by.text("Press Me"))).toNotExist()
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it ('should Press me text be morphed in Polidea title after click on button',async
() =>{
await element(by.id('ButtonText')).tap();
await waitFor(element(by.text("Press Me"))).toNotExist().withTimeout(2000);
How to write Test scripts - Test class by example
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it ('should Press me text be morphed in Polidea title after click on button',async
() =>{
await element(by.id('ButtonText')).tap();
await waitFor(element(by.text("Press Me"))).toNotExist().withTimeout(2000);
await waitFor(element(by.text("Polidea"))).toBeVisible().withTimeout(100);
});
})
How to integrate With CI - Gitlab CI
How to integrate With CI - Gitlab CI
detox_test:iOS: detox_test:android:
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
detox_test:android:
stage: test
before_script:
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
- detox build -c ios.sim.debug
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
- ./detox_node/bin/detox build -c android.emu.debug
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
- detox build -c ios.sim.debug
- detox test -c ios.sim.debug
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
- ./detox_node/bin/detox build -c android.emu.debug
- ./detox_node/bin/detox test -c android.emu.debug
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
- detox build -c ios.sim.debug
- detox test -c ios.sim.debug
- kill -9 $(lsof -n -i4TCP:2137)
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
- ./detox_node/bin/detox build -c android.emu.debug
- ./detox_node/bin/detox test -c android.emu.debug
- kill -9 $(lsof -n -i4TCP:2137)
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
- detox build -c ios.sim.debug
- detox test -c ios.sim.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
- ./detox_node/bin/detox build -c android.emu.debug
- ./detox_node/bin/detox test -c android.emu.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
- detox build -c ios.sim.debug
- detox test -c ios.sim.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
- xcode-9.2
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
- ./detox_node/bin/detox build -c android.emu.debug
- ./detox_node/bin/detox test -c android.emu.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
- android-emu
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
- detox build -c ios.sim.debug
- detox test -c ios.sim.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
- xcode-9.2
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
- ./detox_node/bin/detox build -c android.emu.debug
- ./detox_node/bin/detox test -c android.emu.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
- android-emu
services:
- name: android-emulator:latest
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
- detox build -c ios.sim.debug
- detox test -c ios.sim.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
- xcode-9.2
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
- ./detox_node/bin/detox build -c android.emu.debug
- ./detox_node/bin/detox test -c android.emu.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
- android-emu
services:
- name: android-emulator:latest
alias: pixel
How to integrate With CI - Gitlab CI
detox_test:iOS:
stage: test
before_script:
- brew tap wix/brew
- brew install --HEAD applesimutils
- npm install -g detox-cli
- npm install -g react-native-cli
- npm install
script:
- react-native start --port 2137 &
- detox build -c ios.sim.debug
- detox test -c ios.sim.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
- xcode-9.2
detox_test:android:
stage: test
before_script:
- adb connect pixel:5555; sh ./scripts/waitForDevice.sh
pixel
- mkdir -p ./detox_node/
- npm install --prefix ./detox_node/ -g detox-cli
- npm install --prefix ./detox_node/ -g react-native-cli
- npm install
script:
- ./detox_node/bin/react-native start --port 2137 &
- ./detox_node/bin/detox build -c android.emu.debug
- ./detox_node/bin/detox test -c android.emu.debug
- kill -9 $(lsof -n -i4TCP:2137)
tags:
- android-emu
services:
- name: android-emulator:latest
alias: pixel
entrypoint: ["/start-emulator.sh", "android-23",
"x86", "pixel"]
Show time!
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobile application testing
Key TAkeaways
● Cross platform apps can be tested with the same
frameworks as native ones
● For typical apps you can avoid code duplication and use cross-
platform frameworks
● Detox is a great tool for React Native UI testing
Questions ? :)
Thank You!
You can read about Testing and more at
polidea.com/blog
@astasIcons by: Freepik and Roundicons

More Related Content

PDF
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
PPTX
[AnDevCon 2016] Mutation Testing for Android
PDF
Efficient JavaScript Unit Testing, JavaOne China 2013
PDF
vJUG - The JavaFX Ecosystem
PDF
Dependency Injection
PDF
Node.js vs Play Framework
PDF
Unit testing - A&BP CC
PDF
Efficient JavaScript Unit Testing, May 2012
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[AnDevCon 2016] Mutation Testing for Android
Efficient JavaScript Unit Testing, JavaOne China 2013
vJUG - The JavaFX Ecosystem
Dependency Injection
Node.js vs Play Framework
Unit testing - A&BP CC
Efficient JavaScript Unit Testing, May 2012

What's hot (20)

PDF
Testing Web Applications
KEY
Working Effectively With Legacy Code
PDF
Unit-testing and E2E testing in JS
PDF
PHP Unit Testing in Yii
PDF
Codeception introduction and use in Yii
PDF
Modern Release Engineering in a Nutshell - Why Researchers should Care!
PPTX
Intro to JavaScript Tooling in Visual Studio Code
PDF
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
ODP
Integration Testing in Python
PDF
Acceptance & Functional Testing with Codeception - Devspace 2015
PDF
Front-End Testing: Demystified
PDF
The Play Framework at LinkedIn
PDF
Codeception
PPTX
Codeception
PPTX
JavaLand - Integration Testing How-to
PPTX
Apache ant
PDF
React Ecosystem
PDF
Codeception presentation
PDF
Testing PHP with Codeception
PDF
JavaFX8 TestFX - CDI
Testing Web Applications
Working Effectively With Legacy Code
Unit-testing and E2E testing in JS
PHP Unit Testing in Yii
Codeception introduction and use in Yii
Modern Release Engineering in a Nutshell - Why Researchers should Care!
Intro to JavaScript Tooling in Visual Studio Code
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Integration Testing in Python
Acceptance & Functional Testing with Codeception - Devspace 2015
Front-End Testing: Demystified
The Play Framework at LinkedIn
Codeception
Codeception
JavaLand - Integration Testing How-to
Apache ant
React Ecosystem
Codeception presentation
Testing PHP with Codeception
JavaFX8 TestFX - CDI
Ad

Similar to QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobile application testing (20)

PPTX
Detox: tackling the flakiness of mobile automation
PDF
Guide to End-to-End Detox Testing Headspin
PDF
A Detailed Guide to End-to-End Detox Testing.pdf
PDF
Reactmtl meetup3-talk
PDF
6 Popular Test Automation Tools For React Native App.pdf
PDF
6 Popular Test Automation Tools for React Native Apps.pdf
PDF
5 Popular Test Automation Tools For React Native Apps.pdf
PPTX
Detox Mobile Automation
PDF
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
PDF
Effective Detox Testing - React Advanced 2023
PPTX
From React to React Native - Things I wish I knew when I started
PDF
[4developers2016] The ultimate mobile DX using JS as a primary language (Fato...
PDF
React Native in 2025 - Detox or Appium.pdf
PDF
Why is React Native the Best Choice for Cross-Platform Mobile App Development...
PDF
React Native in Production
PDF
Top 5 Android testing frameworks you need to consider in 2024.pdf
PDF
Philip Shurpik "Architecting React Native app"
PDF
What to choose for Mobile app development- React Native vs Native.
PPTX
NodeJs Can do that !! (NodeJs peut faire ça !!)
PDF
Best Mobile Test Automation Solutions: Beyond Appium
Detox: tackling the flakiness of mobile automation
Guide to End-to-End Detox Testing Headspin
A Detailed Guide to End-to-End Detox Testing.pdf
Reactmtl meetup3-talk
6 Popular Test Automation Tools For React Native App.pdf
6 Popular Test Automation Tools for React Native Apps.pdf
5 Popular Test Automation Tools For React Native Apps.pdf
Detox Mobile Automation
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Effective Detox Testing - React Advanced 2023
From React to React Native - Things I wish I knew when I started
[4developers2016] The ultimate mobile DX using JS as a primary language (Fato...
React Native in 2025 - Detox or Appium.pdf
Why is React Native the Best Choice for Cross-Platform Mobile App Development...
React Native in Production
Top 5 Android testing frameworks you need to consider in 2024.pdf
Philip Shurpik "Architecting React Native app"
What to choose for Mobile app development- React Native vs Native.
NodeJs Can do that !! (NodeJs peut faire ça !!)
Best Mobile Test Automation Solutions: Beyond Appium
Ad

More from QAFest (20)

PDF
QA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилин
PPTX
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
PPTX
QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...
PDF
QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...
PDF
QA Fest 2019. Никита Галкин. Как зарабатывать больше
PDF
QA Fest 2019. Сергей Пирогов. Why everything is spoiled
PDF
QA Fest 2019. Сергей Новик. Между мотивацией и выгоранием
PPTX
QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...
PPTX
QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...
PDF
QA Fest 2019. Иван Крутов. Bulletproof Selenium Cluster
PPTX
QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...
PDF
QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...
PPTX
QA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automation
PDF
QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...
PDF
QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...
PDF
QA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях IT
PPTX
QA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложении
PPTX
QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...
PDF
QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...
PPTX
QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22
QA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилин
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...
QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...
QA Fest 2019. Никита Галкин. Как зарабатывать больше
QA Fest 2019. Сергей Пирогов. Why everything is spoiled
QA Fest 2019. Сергей Новик. Между мотивацией и выгоранием
QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...
QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...
QA Fest 2019. Иван Крутов. Bulletproof Selenium Cluster
QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...
QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...
QA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automation
QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...
QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...
QA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях IT
QA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложении
QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...
QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...
QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22

Recently uploaded (20)

PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Pre independence Education in Inndia.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Lesson notes of climatology university.
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Classroom Observation Tools for Teachers
PPTX
Institutional Correction lecture only . . .
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
master seminar digital applications in india
Renaissance Architecture: A Journey from Faith to Humanism
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pre independence Education in Inndia.pdf
Sports Quiz easy sports quiz sports quiz
Anesthesia in Laparoscopic Surgery in India
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Lesson notes of climatology university.
human mycosis Human fungal infections are called human mycosis..pptx
GDM (1) (1).pptx small presentation for students
STATICS OF THE RIGID BODIES Hibbelers.pdf
VCE English Exam - Section C Student Revision Booklet
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
TR - Agricultural Crops Production NC III.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Classroom Observation Tools for Teachers
Institutional Correction lecture only . . .
01-Introduction-to-Information-Management.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
master seminar digital applications in india

QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobile application testing

  • 1. REACT Native is coming The story of hybrid mobile application testing
  • 3. Agenda 1. Introduction 2. Cross-platform frameworks for mobile development 3. UI testing approaches for hybrid apps 4. Detox guide for applying UI tests in React Native projects
  • 4. Agenda 1. Introduction 2. Cross-platform frameworks for mobile development 3. UI testing approaches for hybrid apps 4. Detox guide for applying UI tests in React Native projects
  • 5. Agenda 1. Introduction 2. Cross-platform frameworks for mobile development 3. UI testing approaches for hybrid apps 4. Detox guide for applying UI tests in React Native projects
  • 6. Agenda 1. Introduction 2. Cross-platform frameworks for mobile development 3. UI testing approaches for hybrid apps 4. Detox guide for applying UI tests in React Native projects
  • 11. Oh no ! O Nie ! Para Pollo ! Zonk !
  • 14. How to Automate this as before ???
  • 15. The Native white Box Test
  • 16. The Native white Box Test + Fast + Easy setup + Wide range of open source helpers + Compatible with Cloud Device Farms
  • 17. The Native white Box Test + Fast + Easy setup + Wide range of open source helpers + Compatible with Cloud Device Farms − Different languages in project repository − Duplicated test code
  • 18. The Cross Platform Black Box Test
  • 19. The Cross Platform Black Box Test + Many supported languages + Wide community + Similar to Selenium + Single test code base + Compatible with Cloud Device Farms
  • 20. The Cross Platform Black Box Test + Many supported languages + Wide community + Similar to Selenium + Single test code base + Compatible with Cloud Device Farms − Slow − Difficult debugging − Lack of stability
  • 21. The Cross Platform Gray Box Test
  • 22. The Cross Platform Gray Box Test + Fast + Easy setup + Single test code base + The same language as default project one + Close integration with source code + API designed for a specific platform
  • 23. The Cross Platform Gray Box Test + Fast + Easy setup + Single test code base + The same language as default project one + Close integration with source code + API designed for a specific platform − No way / difficult to integrate with Cloud Device Farm − No outspread community − Often still not developed enough
  • 24. Based on experience with React Native
  • 25. Automation Guide with Detox - cross platform React Native Framework
  • 26. How to add Detox to an existing project - Package.json file
  • 27. How to add Detox to an existing project - Package.json file "detox": {
  • 28. How to add Detox to an existing project - Package.json file "detox": { "test-runner": "mocha", "specs": "e2e", "configurations": {
  • 29. How to add Detox to an existing project - Package.json file "detox": { "test-runner": "mocha", "specs": "e2e", "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app", "build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", "type": "ios.simulator", "name": "iPhone X" }, "android.emu.debug": { "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", "type": "android.emulator", "name": "Nexus_5X_API_24" } } } }
  • 30. How to add Detox to an existing project - Package.json file "detox": { "test-runner": "mocha", "specs": "e2e", "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app", "build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", "type": "ios.simulator", "name": "iPhone X" }, "android.emu.debug": { "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", "type": "android.emulator", "name": "Nexus_5X_API_24" } } } }
  • 31. How to add Detox to an existing project - Package.json file "detox": { "test-runner": "mocha", "specs": "e2e", "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app", "build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", "type": "ios.simulator", "name": "iPhone X" }, "android.emu.debug": { "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", "type": "android.emulator", "name": "Nexus_5X_API_24" } } } }
  • 32. How to add Detox to an existing project - Package.json file "detox": { "test-runner": "mocha", "specs": "e2e", "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app", "build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", "type": "ios.simulator", "name": "iPhone X" }, "android.emu.debug": { "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", "type": "android.emulator", "name": "Nexus_5X_API_24" } } } }
  • 33. How to add Detox to an existing project - Package.json file "detox": { "test-runner": "mocha", "specs": "e2e", "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app", "build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", "type": "ios.simulator", "name": "iPhone X" }, "android.emu.debug": { "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", "type": "android.emulator", "name": "Nexus_5X_API_24" } } } }
  • 34. How to make apps testable? <Text style={styles.textStyle}> {!this.state.clicked? defaultButtonText: "Polidea"} </Text> <Text accessible= {true} testID= {"ButtonText"} accessibilityLabel= {"ButtonTextDesc"} style={styles.textStyle}> {!this.state.clicked? defaultButtonText: "Polidea"} </Text>
  • 35. How to make apps testable? <Text accessible= {true} testID= {"ButtonText"} accessibilityLabel= {"ButtonTextDesc"} style={styles.textStyle}> {!this.state.clicked? defaultButtonText: "Polidea"} </Text>
  • 36. How to write Test scripts - API Overview Detox Object Test plan configuration Device Object Key events, Gestures, Device settings Matchers, Actions, Expectations Finding Views, User’s actions, Validation API
  • 37. How to write Test scripts - Init script by example require('babel-polyfill');
  • 38. How to write Test scripts - Init script by example require('babel-polyfill'); const detox = require('detox'); const config = require('../package.json').detox;
  • 39. How to write Test scripts - Init script by example require('babel-polyfill'); const detox = require('detox'); const config = require('../package.json').detox; beforeAll(async () => { await detox.init(config); });
  • 40. How to write Test scripts - Init script by example require('babel-polyfill'); const detox = require('detox'); const config = require('../package.json').detox; beforeAll(async () => { await detox.init(config); }); beforeEach(async () => { await adapter.beforeEach(); });
  • 41. How to write Test scripts - Init script by example require('babel-polyfill'); const detox = require('detox'); const config = require('../package.json').detox; beforeAll(async () => { await detox.init(config); }); beforeEach(async () => { await adapter.beforeEach(); }); afterAll(async () => { await adapter.afterAll(); await detox.cleanup(); });
  • 42. How to write Test scripts - Test class by example
  • 43. How to write Test scripts - Test class by example describe('Example', () => {
  • 44. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => {
  • 45. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await
  • 46. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device
  • 47. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative();
  • 48. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor
  • 49. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element
  • 50. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText')))
  • 51. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible()
  • 52. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); });
  • 53. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); }); it
  • 54. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); }); it ('should Press me text be morphed in Polidea title after click on button',async () =>{
  • 55. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); }); it ('should Press me text be morphed in Polidea title after click on button',async () =>{ await element(by.id('ButtonText'))
  • 56. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); }); it ('should Press me text be morphed in Polidea title after click on button',async () =>{ await element(by.id('ButtonText')).tap();
  • 57. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); }); it ('should Press me text be morphed in Polidea title after click on button',async () =>{ await element(by.id('ButtonText')).tap(); await waitFor(element(by.text("Press Me")))
  • 58. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); }); it ('should Press me text be morphed in Polidea title after click on button',async () =>{ await element(by.id('ButtonText')).tap(); await waitFor(element(by.text("Press Me"))).toNotExist()
  • 59. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); }); it ('should Press me text be morphed in Polidea title after click on button',async () =>{ await element(by.id('ButtonText')).tap(); await waitFor(element(by.text("Press Me"))).toNotExist().withTimeout(2000);
  • 60. How to write Test scripts - Test class by example describe('Example', () => { beforeEach(async () => { await device.reloadReactNative(); await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000); }); it ('should Press me text be morphed in Polidea title after click on button',async () =>{ await element(by.id('ButtonText')).tap(); await waitFor(element(by.text("Press Me"))).toNotExist().withTimeout(2000); await waitFor(element(by.text("Polidea"))).toBeVisible().withTimeout(100); }); })
  • 61. How to integrate With CI - Gitlab CI
  • 62. How to integrate With CI - Gitlab CI detox_test:iOS: detox_test:android:
  • 63. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: detox_test:android: stage: test before_script:
  • 64. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel
  • 65. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install
  • 66. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script:
  • 67. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 &
  • 68. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & - detox build -c ios.sim.debug detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 & - ./detox_node/bin/detox build -c android.emu.debug
  • 69. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & - detox build -c ios.sim.debug - detox test -c ios.sim.debug detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 & - ./detox_node/bin/detox build -c android.emu.debug - ./detox_node/bin/detox test -c android.emu.debug
  • 70. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & - detox build -c ios.sim.debug - detox test -c ios.sim.debug - kill -9 $(lsof -n -i4TCP:2137) detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 & - ./detox_node/bin/detox build -c android.emu.debug - ./detox_node/bin/detox test -c android.emu.debug - kill -9 $(lsof -n -i4TCP:2137)
  • 71. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & - detox build -c ios.sim.debug - detox test -c ios.sim.debug - kill -9 $(lsof -n -i4TCP:2137) tags: detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 & - ./detox_node/bin/detox build -c android.emu.debug - ./detox_node/bin/detox test -c android.emu.debug - kill -9 $(lsof -n -i4TCP:2137) tags:
  • 72. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & - detox build -c ios.sim.debug - detox test -c ios.sim.debug - kill -9 $(lsof -n -i4TCP:2137) tags: - xcode-9.2 detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 & - ./detox_node/bin/detox build -c android.emu.debug - ./detox_node/bin/detox test -c android.emu.debug - kill -9 $(lsof -n -i4TCP:2137) tags: - android-emu
  • 73. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & - detox build -c ios.sim.debug - detox test -c ios.sim.debug - kill -9 $(lsof -n -i4TCP:2137) tags: - xcode-9.2 detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 & - ./detox_node/bin/detox build -c android.emu.debug - ./detox_node/bin/detox test -c android.emu.debug - kill -9 $(lsof -n -i4TCP:2137) tags: - android-emu services: - name: android-emulator:latest
  • 74. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & - detox build -c ios.sim.debug - detox test -c ios.sim.debug - kill -9 $(lsof -n -i4TCP:2137) tags: - xcode-9.2 detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 & - ./detox_node/bin/detox build -c android.emu.debug - ./detox_node/bin/detox test -c android.emu.debug - kill -9 $(lsof -n -i4TCP:2137) tags: - android-emu services: - name: android-emulator:latest alias: pixel
  • 75. How to integrate With CI - Gitlab CI detox_test:iOS: stage: test before_script: - brew tap wix/brew - brew install --HEAD applesimutils - npm install -g detox-cli - npm install -g react-native-cli - npm install script: - react-native start --port 2137 & - detox build -c ios.sim.debug - detox test -c ios.sim.debug - kill -9 $(lsof -n -i4TCP:2137) tags: - xcode-9.2 detox_test:android: stage: test before_script: - adb connect pixel:5555; sh ./scripts/waitForDevice.sh pixel - mkdir -p ./detox_node/ - npm install --prefix ./detox_node/ -g detox-cli - npm install --prefix ./detox_node/ -g react-native-cli - npm install script: - ./detox_node/bin/react-native start --port 2137 & - ./detox_node/bin/detox build -c android.emu.debug - ./detox_node/bin/detox test -c android.emu.debug - kill -9 $(lsof -n -i4TCP:2137) tags: - android-emu services: - name: android-emulator:latest alias: pixel entrypoint: ["/start-emulator.sh", "android-23", "x86", "pixel"]
  • 78. Key TAkeaways ● Cross platform apps can be tested with the same frameworks as native ones ● For typical apps you can avoid code duplication and use cross- platform frameworks ● Detox is a great tool for React Native UI testing
  • 80. Thank You! You can read about Testing and more at polidea.com/blog @astasIcons by: Freepik and Roundicons