Make it possible to generate regression tests for Flipper plugins

Summary:
This Pull request makes it possible to automatically generate regression tests for plugins. The idea here is to record all incoming states for a specific plugin, the start state of the plugin, and the enstate of the plugin.

By replaying the same events in a test, the same plugin should result in the same end state. This will make it easy to test regressions and refactorings on real life scenarios. Execution time is recorded as well.

The API's are exposed as

- `flipperStartPluginRecording()`
- `flipperStopPluginRecording()`

This process generates both a data snapshot and unit test.

Reviewed By: passy

Differential Revision: D18907455

fbshipit-source-id: 923f814f534ccfa6aa2ff2bfa2f80bee41a1c182
This commit is contained in:
Michel Weststrate
2019-12-11 05:50:02 -08:00
committed by Facebook Github Bot
parent 99547168fc
commit 5429d1f235
5 changed files with 218 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ import {setPersistor} from './utils/persistor';
import React from 'react';
import path from 'path';
import {store} from './store';
import {registerRecordingHooks} from './utils/pluginStateRecorder';
const logger = initLogger(store);
const bugReporter = new BugReporter(logger, store);
@@ -90,6 +91,7 @@ function init() {
initLauncherHooks(config(), store);
const sessionId = store.getState().application.sessionId;
initCrashReporter(sessionId || '');
registerRecordingHooks(store);
window.flipperGlobalStoreDispatch = store.dispatch;
}