Galooshi / happo

Visual diffing in CI for user interfaces
504 stars 16 forks source link

Add React Native Support #185

Closed lelandrichardson closed 7 years ago

lelandrichardson commented 7 years ago

to: @lencioni @trotzig

This PR is broken into 3 commits.

The first commit is Add RN Runner App, which is mostly just the output of react-native init HappoRunner to create a standard RN app. The app is only tweaked in a couple of small ways to allow for the snapshotting. This commit could mostly be ignored.

The second commit is Add RN Target which adds the actual happo target plugin. The plugin does the following:

  1. Launch a websockets server for communication with the app
  2. Launch the RN packager with the appropriate configuration
  3. Launch the simulator/emulator using Appium. The actual app that is being run is a small RN app that will be included with this module, but it will be running the user's JavaScript RN code.
  4. Waits for the app to send it a list of all the snapshots.
  5. Sends a message to the app telling it to render a certain snapshot, waiting for the app to respond back with a success message, including a base64 encoded image.
  6. Once all images are complete, happo will compare them all and send back results to the happo CLI.

Tested with both iOS and Android.

The third commit is another "example" project that shows the example in action.

lelandrichardson commented 7 years ago

cc @spikebrehm

lencioni commented 7 years ago

We regularly use tools like git log, git blame, and git show to understand why a particular line of code is the way it is. To help out our future selves, it would be really great if you could capture the "why" in each of your commit messages. More info: https://brigade.engineering/the-secrets-to-great-commit-messages-106fc0a92a25

lelandrichardson commented 7 years ago

@lencioni @trotzig I've addressed most feedback. Think this is ready to merge now?

lencioni commented 7 years ago

I didn't look too closely at the updated commits, but if you feel good about it, go for it.

trotzig commented 7 years ago

I'm all 👍