TestFairy allows developers to hide specific views from the recorded video. As a developer, you may choose to hide one or more views from the video for security and privacy reasons.

For example, you might want to prevent all information related to credit card data from appearing in a session.


To hide a view from video:

TestFairy.hideView(View myView);

Replace R.id.my_view with the identifier of the view you wish to hide.

Code Example

public class MyActivity extends Activity {

    protected void onCreate(Bundle savedInstanceState) {




To hide a view from video, call the static instance method hideView in the TestFairy class:

UIView *view = ...
[TestFairy hideView:view];

Code Example

@interface MyViewController : UIViewController {
    IBOutlet UITextField *usernameView;
    IBOutlet UITextField *creditCardView;
    IBOutlet UITextField *cvvView;

@implementation MyViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [TestFairy hideView:creditCardView];
    [TestFairy hideView:cvvView];


In order to hide views from your recorded session, you will need to pass a reference to a view to TestFairy. First, give the element to be hidden a ref attribute. For example:

<Text ref="instructions">This will be hidden</Text>

Next, in a component callback, such as componentDidMount, pass the reference ID back to TestFairy by invoking hideView.

Code Example

const TestFairy = require('react-native-testfairy');
var MyComponent = React.createClass({

    componentDidMount: function() {

    render: function() {
        return (<Text ref="instructions">This will be hidden</Text>);



Code Example

// in Nativescript
import { TestFairySDK } from 'nativescript-testfairy';

// in Javascript
var TestFairySDK = require('nativescript-testfairy').TestFairySDK;



TestFairy.HideView (View view) (Android)

TestFairy.HideView (UIView view) (iOS)

Code Example

// Be sure to import TestFairy
using TestFairyLib;

// On Android
View view = ...
TestFairy.HideView (view);

// On iOS
UIView view = ...
TestFairy.HideView (view);

Sample Video

Below is a sample screen taken from a demo video. On the left, you can see what the app normally looks like. On the right, there is a screenshot taken with the "Card Number" EditText hidden by testfairy-secure-viewid.


  • Hidden views are removed before sending video.
  • You may hide multiple views.
  • You may add the same view multiple times, no checks needed.

Last updated on 2023-06-06