2016-01-11 14:28:28 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const TestFairyBridge = require("react-native").NativeModules.TestFairyBridge;
|
|
|
|
|
|
|
|
class TestFairy {
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Initialize a TestFairy session with options.
|
|
|
|
*
|
|
|
|
* @param appToken Your key as given to you in your TestFairy account
|
|
|
|
* @param options A dictionary of options controlling the current session
|
|
|
|
*/
|
2016-01-11 14:28:28 +00:00
|
|
|
static begin(appKey, options = {}) {
|
|
|
|
TestFairyBridge.begin(appKey, options);
|
|
|
|
}
|
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Sets a correlation identifier for this session. This value can
|
|
|
|
* be looked up via web dashboard. For example, setting correlation
|
|
|
|
* to the value of the user-id after they logged in. Can be called
|
|
|
|
* only once per session (subsequent calls will be ignored.)
|
|
|
|
*
|
|
|
|
* @param correlationId Id for the current session
|
|
|
|
*/
|
2016-01-11 14:28:28 +00:00
|
|
|
static setCorrelationId(correlationId) {
|
|
|
|
TestFairyBridge.setCorrelationId(correlationId);
|
|
|
|
}
|
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Sets a correlation identifier for this session. This value can
|
|
|
|
* be looked up via web dashboard. For example, setting correlation
|
|
|
|
* to the value of the user-id after they logged in. Can be called
|
|
|
|
* only once per session (subsequent calls will be ignored.)
|
|
|
|
*
|
|
|
|
* @param correlationId Id for the current session
|
|
|
|
* @param traits Attributes and custom attributes to be associated with this session
|
|
|
|
*/
|
2016-01-11 14:28:28 +00:00
|
|
|
static identify(correlationId, traits = {}) {
|
|
|
|
TestFairyBridge.identify(correlationId, traits);
|
|
|
|
}
|
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Takes a screenshot.
|
|
|
|
*/
|
2016-01-11 14:28:28 +00:00
|
|
|
static takeScreenshot() {
|
|
|
|
TestFairyBridge.takeScreenshot();
|
|
|
|
}
|
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Pauses the current session. This method stops recoding of
|
|
|
|
* the current session until resume has been called.
|
|
|
|
*
|
|
|
|
* @see resume
|
|
|
|
*/
|
2016-01-11 14:28:28 +00:00
|
|
|
static pause() {
|
|
|
|
TestFairyBridge.pause();
|
|
|
|
}
|
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Resumes the recording of the current session. This method
|
|
|
|
* resumes a session after it was paused.
|
|
|
|
*
|
|
|
|
* @see pause
|
|
|
|
*/
|
2016-01-11 14:28:28 +00:00
|
|
|
static resume() {
|
|
|
|
TestFairyBridge.resume();
|
|
|
|
}
|
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Marks a checkpoint in session. Use this text to tag a session
|
|
|
|
* with a checkpoint name. Later you can filter sessions where your
|
|
|
|
* user passed through this checkpoint, for bettering understanding
|
|
|
|
* user experience and behavior.
|
|
|
|
*
|
|
|
|
* @param name The checkpoint name
|
|
|
|
*/
|
2016-01-11 14:28:28 +00:00
|
|
|
static checkpoint(name) {
|
|
|
|
TestFairyBridge.checkpoint(name);
|
|
|
|
}
|
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Send a feedback on behalf of the user. Call when using a in-house
|
|
|
|
* feedback view controller with a custom design and feel. Feedback will
|
|
|
|
* be associated with the current session.
|
|
|
|
*
|
|
|
|
* @param feedbackString Feedback text
|
|
|
|
*/
|
2016-01-11 14:28:28 +00:00
|
|
|
static sendUserFeedback(feedback) {
|
|
|
|
TestFairyBridge.sendUserFeedback(feedback);
|
|
|
|
}
|
2016-01-12 20:12:56 +00:00
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
/**
|
|
|
|
* Hides a specific view from appearing in the video generated.
|
|
|
|
*
|
|
|
|
* @param view The specific view you wish to hide from screenshots
|
|
|
|
*/
|
2016-01-12 20:12:56 +00:00
|
|
|
static hideView(viewTag) {
|
|
|
|
TestFairyBridge.hideView(viewTag);
|
|
|
|
}
|
2016-01-11 14:28:28 +00:00
|
|
|
}
|
|
|
|
|
2016-01-12 21:01:01 +00:00
|
|
|
module.exports = TestFairy;
|