Defining a Client-Side Factor

Client-Side Factors work on the client side (your browser) to change the page using JavaScript and are not processed using the SiteSpect engine on the server side. They make it easier to test websites that are heavily built with JavaScript. These Factors, along with a JavaScript SDK, give you a powerful approach to testing your Single-Page Application built with JavaScript frameworks like Backbone and Angular.

Defining a Client-Side Factor in Standard Mode

To define a Client-Side Factor:

  1. Start by creating a Factor as described in the topic Creating a Factor.
  2. When you come to the section that describes the Variation Template, select Client-Side Factor and continue here.

When you select Client-Side Factor in the Variation Template area of the Factor page, the following fields are available to you:

Selector – Enter the name of a CSS Selector. When a page component matches this Selector, SiteSpect applies the settings in the Changes section defined for the Variation.

Note: Linked Client-Side Factors require a unique Selector.

Changes

HTML Replacement – Replaces the HTML content of the selected components.

Attributes – Replaces the Attribute with the specified value if the Attribute exists. If the Attribute does not exist, this adds it. Enter the name of the Attribute on the left side of the field and the Value on the right side.

CSS – Replaces the CSS rule with the specified value if the rule exists. If the CSS rule does not exists, this adds it. Enter the rule on the left side of the field and the value on the right. Note that if there is an !important rule, this won't override it unless this rule is also !important.

Custom – Lets you provide JavaScript code to execute on each matching component. The first line and the last line of the field are not editable. Note that this function is run against each matching component. In addition, each time it's run, the current component it's working on can be accessed with the keyword this.