GithubHelp home page GithubHelp logo

isabella232 / detoxsync Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wix-incubator/detoxsync

0.0 0.0 0.0 921 KB

Synchronization framework for Detox and other testing frameworks

License: MIT License

JavaScript 1.71% Ruby 0.35% C 2.98% Objective-C 94.88% Swift 0.08%

detoxsync's Introduction

DetoxSync

DetoxSync is a synchronization framework for Detox and other testing frameworks, where there app synchronization is needed.

DetoxSync tracks various application states (resources), such as animations, network requests and dispatch queues, and is able to execute blocks whenever the system is deemed idle. The idle status of the system can be queried using a dedicated API. The system also provides a detailed event reporting through its delegate methods.

Tracked Resources

Delayed Perform Selectors

This sync resource tracks Objective C selectors scheduled to run in the future, using API such as -[NSObject performSelector:withObject:afterDelay:]. Such delayed selectors are tracked for run loops that are tracked by the system.

Once all pending selectors have been called, this sync resource becomes idle.

Dispatch Queues

This sync resource tracks dispatch queues and their work items. Once a work item is submitted to a tracked dispatch queue, the sync resource is considered busy.

Once all pending work items have been executed, the sync resource becomes idle.

Run Loops

The run loop sync resource tracks run loops and their states. A run loop is considered idle if it is waiting for their monitored sources. Once the run loop wakes up due to one of its sources, it is considered busy.

During the normal lifecycle of an app, its run loops normally switch often between busy and idle states, and no special significance should be paid to a busy run loop, as it is usually accompanied by other busy sync resources, which better describe what the system is doing.

One-time Events

One-time events are single, one-off events which start at some point during the lifetime of the app, and once finished, are released. The system is considered idle if no such events are currently tracked.

One-time events include:

  • Network requests
  • Special animations
  • Special application modes
  • Gesture recognizer handling
  • Scrolling
  • Special run loop operations
  • React Native load
  • User provided custom events

Each one-time event description may include an object and/or other identifiable information to help hint what the event is.

This sync resource is considered idle once all tracked one-time events are finished.

Timers

This sync resource tracks run loop timers and display links. Once a timer or display link is scheduled with a tracked run loop, it is automatically tracked by the system, and the sync resource becomes busy.

The sync resource is considered idle once all tracked timers are either cancelled or fired, and are no longer tracked.

UI Elements

Tracked event categories include:

  • View display (draw) and layout
  • Layer display and layout
  • View controller appearance and disappearance
  • View animations
  • CA (layer) animations
  • Layers pending animation

Each event category is tracked independently, and the system is considered busy if at least one event exists in any category.

The sync resource is considered idle when there are no active events in all categories.

JS Timers

This sync resource tracks JS timers in React Native applications, started with the setTimeout() API. When a JS timer is started, it is automatically tracked by the system, and the sync resource becomes busy.

The sync resource is considered idle once all tracked timers are either cancelled or fired, and are no longer tracked.

Sync Status

The sync status of the system can be queried using the +[DTXSyncManager statusWithCompletionHandler:] method. For more information of the returned syntax, see Sync Status Documentation.

React Native

DetoxSync comes with React Native support out of the box, automatically tracking React Native bundle load, the React Native JavaScript run loop, its internal dispatch queues and the dispatch queues of all native modules. When a React Native bridge is reloaded, the system automatically untracks the previous run loop and any associated dispatch queues.

API Documentation

For most up-to-date documentation, check out the DTXSyncManager header.

detoxsync's People

Contributors

asafkorem avatar ball-hayden avatar dependabot[bot] avatar igorgn avatar leonatan avatar owjsub avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.