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.

Syntax

To hide a view from video:

TestFairy.hideView(Integer.valueOf(R.id.my_view));
or
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 {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_activity);

        TestFairy.hideView(findViewById(R.id.credit_card));
    }
}
            

Syntax

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];
}
            

Syntax

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() {
        TestFairy.hideView(this.refs.instructions);
    },

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

Syntax

TestFairySDK.hideView(view);

Code Example

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

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

TestFairySDK.hideView(view);
            

Syntax

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.


Notes


  • 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-05-23