Skip to content

Instantly share code, notes, and snippets.

{
elementSafeBounds: { y: 0, x: 0, width: 375, height: 17 },
label: 'Tap Me',
frame: { y: 84, x: 0, width: 375, height: 17 },
activationPoint: { x: 187, y: 8 },
text: 'Tap Me',
elementBounds: { y: 0, x: 0, width: 375, height: 17 },
visible: true,
normalizedActivationPoint: { x: 0.5, y: 0.5 },
enabled: true,
@rotemmiz
rotemmiz / recordingSpec.js
Created May 19, 2020 09:26
Detox Recorder Output example
describe('My Recorded Spec', () => {
it('should follow my recorded test', async () => {
await element(by.label("Button")).tap();
await element(by.label("Button")).tap();
await element(by.id("MySwitch")).tap();
await element(by.id("MySwitch")).tap();
await element(by.type("UIView")).atIndex(37).tap();
await element(by.type("UIView")).atIndex(37).longPress(1002);
await element(by.id("MyDatePicker")).setDatePickerDate("2020-05-21T10:37:04+03:00", "yyyy-MM-dd'T'HH:mm:ssZZZZZ");
await element(by.id("MyDatePicker")).setDatePickerDate("2020-05-21T09:37:04+03:00", "yyyy-MM-dd'T'HH:mm:ssZZZZZ");
@rotemmiz
rotemmiz / notifications.test.js
Created February 22, 2018 00:05
Detox: A Year in. Building It, Testing With It
it('should send push token to notification server after user allows push permissions', async () => {
appStateServer.forUser(appStateServer.testUserId()).withBusinesses(1);
await device.launchApp({delete: true});
await element(by.text('Log In TestUser1')).tap();
notificationServer.expectLastRegiscribe().toNotExist();
await element(by.text('Allow')).tap();
await expect(element(by.text('feed.FeedScreen'))).toBeVisible();
notificationServer.expectLastRegiscribe().toContain({appleDeviceToken: consts.DeviceToken});
@rotemmiz
rotemmiz / MockNotificationServer.js
Last active February 22, 2018 00:04
Detox: A Year in. Building It, Testing With It
class MockNotificationServer {
start({port}) {
this.app.post('/regiscribe', this.onRegiscribe.bind(this));
this.app.post('/unsubscribe', this.onUnsubscribe.bind(this));
this.server = this.app.listen(port);
}
reset() {
this.lastRegiscribe = {};
this.lastUnsubscribe = {};
@rotemmiz
rotemmiz / login.test.js
Created February 22, 2018 00:01
Detox: A Year in. Building It, Testing With It
describe('Login', () => {
const server = new MockServer();
beforeEach(async () => {
await server.start();
});
afterEach(async () => {
await server.stop();
});
@rotemmiz
rotemmiz / DetoxSignupExample.js
Last active September 9, 2017 11:32
Detox.Medium.DetoxSignupExample.js
describe('Login flow', () => {
it('should login successfully', async () => {
  await device.reloadReactNative();
  await expect(element(by.id('email'))).toBeVisible();
  await element(by.id('email')).typeText('[email protected]');
  await element(by.id('password')).typeText('123456');
  await element(by.text('Login')).tap();
@rotemmiz
rotemmiz / busyjsthread.js
Last active January 2, 2017 16:10
[RN] Busy JS thread example
class SearchBar extends React.Component {
render() {
...
return (
...
<TouchableOpacity onPress={this.actBusy.bind(this)}>
<View style={styles.button}>
<Text>Spam mqt_js</Text>
</View>
</TouchableOpacity>
@rotemmiz
rotemmiz / MessageQueue Spy - touch.md
Last active October 22, 2016 20:58
[RN] MessageQueue spy - touch
2584 I ReactNativeJS: N->JS : RCTEventEmitter.receiveTouches(["topTouchStart",[{"identifier":0,"locationY":47.9301872253418,"locationX":170.43936157226562,"pageY":110.02542877197266,"timestamp":2378613,"target":26,"pageX":245.4869842529297}],[0]])
2584 I ReactNativeJS: JS->N : Timing.createTimer([18,130,1477140761852,false])
2584 I ReactNativeJS: JS->N : Timing.createTimer([19,500,1477140761852,false])
2584 I ReactNativeJS: JS->N : UIManager.setJSResponder([23,false])
2584 I ReactNativeJS: N->JS : RCTEventEmitter.receiveTouches(["topTouchEnd",[{"identifier":0,"locationY":47.9301872253418,"locationX":170.43936157226562,"pageY":110.02542877197266,"timestamp":2378703,"target":26,"pageX":245.4869842529297}],[0]])
2584 I ReactNativeJS: JS->N : UIManager.clearJSResponder([])
2584 I ReactNativeJS: JS->N : Timing.deleteTimer([19])
2584 I ReactNativeJS: JS->N : Timing.deleteTimer([18])
@rotemmiz
rotemmiz / MessageQueue Spy - network.md
Last active October 22, 2016 20:58
[RN] MessageQueue spy - network
5835 I ReactNativeJS: JS->N : Networking.sendRequest(["GET","http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apikey=7waqfqbprs7pajbz28mqf6vz&page_limit=20&page=1",1,[],{"trackingName":"unknown"},"text",false,0])
5835 I ReactNativeJS: N->JS : RCTDeviceEventEmitter.emit(["didReceiveNetworkResponse",[1,200,{"Connection":"keep-alive","X-Xss-Protection":"1; mode=block","Content-Security-Policy":"frame-ancestors 'self' rottentomatoes.com *.rottentomatoes.com ;","Date":"Sat, 22 Oct 2016 13:58:53 GMT","Set-Cookie":"JSESSIONID=63B283B5ECAA9BBECAE253E44455F25B; Path=/; HttpOnly","Server":"nginx/1.8.1","X-Content-Type-Options":"nosniff","X-Mashery-Responder":"prod-j-worker-us-east-1b-115.mashery.com","Vary":"User-Agent,Accept-Encoding","Content-Language":"en-US","Content-Type":"text/javascript;charset=ISO-8859-1","X-Content-Security-Policy":"frame-ancestors 'self' rottentomatoes.com *.rottentomatoes.com ;"},"http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apike
@rotemmiz
rotemmiz / MessageQueue Spy - layout.md
Last active October 22, 2016 20:59
[RN] MessageQueue spy - layout
2584 I ReactNativeJS: Running application "MoviesApp" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === false, development-level warning are OFF, performance optimizations are ON
2584 I ReactNativeJS: JS->N : UIManager.createView([4,"RCTView",1,{"flex":1,"overflow":"hidden","backgroundColor":-1}])
2584 I ReactNativeJS: JS->N : UIManager.createView([5,"RCTView",1,{"flex":1,"backgroundColor":0,"overflow":"hidden"}])
2584 I ReactNativeJS: JS->N : UIManager.createView([6,"RCTView",1,{"pointerEvents":"auto","position":"absolute","overflow":"hidden","left":0,"right":0,"bottom":0,"top":0}])
2584 I ReactNativeJS: JS->N : UIManager.createView([7,"RCTView",1,{"flex":1,"backgroundColor":-1}])
2584 I ReactNativeJS: JS->N : UIManager.createView([8,"RCTView",1,{"flexDirection":"row","alignItems":"center","backgroundColor":-5658199,"height":56}])
2584 I ReactNativeJS: JS->N : UIManager.createView([9,"RCTView",1,{"nativeBackgroundAndroid":{"type":"ThemeAttrAndroid","attribute":"selectableItemBackgroundBorderle