<commit_before>var TestHelper = function () {
	var self = this;
	var contextDiv = $("body");
	var doneFunc = null,
		continuations = [];


	var jqFilter = function (val) {
		if(contextDiv == null) {
			self.showError ("Context is null");
		}
		if(typeof(val) === "string") {
			var contextFound = contextDiv.find(val);
			if(contextFound.length === 0) {
				self.showError("Cannot find selector " + val + " in context");
			}
			if(contextFound.length > 1) {
				console.warn("the number of elements found for ", val, "is ", contextFound.length);
			}
			return $(contextDiv.find(val)[0]);
		}
		if(typeof(val) === "object") {
			if(val.length === 0) {
				self.showError("Empty jquery object passed");
			}
			if(val.length > 1) {
				console.warn("the number of elements found for ", val, "is ", contextFound.length);
			}

			return val;
		}

		if(typeof(val) === "function") {
			return val(contextDiv);
		}
		throw "Unexpected type for jquery filter";
	}
	self.start = function (done) {
		log("Starting");
		doneFunc = done;
		contextDiv = $("body");
		continuations = [];

		return self;
	};

	self.setContext = function (context) {
		addSyncContinuation(function () {
			// First, reset the context div to body
			contextDiv = $("body");
			contextDiv = jqFilter(context); 
		});
		return self;
	};

	self.assertText = function (selector, value) {
		addSyncContinuation(function () {
			log("Asserting text is " + value);
			var item = jqFilter(selector);
			expect(item.text()).toBe(value);
		});
		return self;
	};

	self.wait = function (timeout) {
		addASyncContinuation(function (done) {
			log("Waiting for " + timeout);
			setTimeout(done, timeout);
		});
		return self;
	};

	self.click = function (selector, data) {
		return self.triggerEvent(selector, "click");
	};

	self.triggerEvent = function (selector, eventName, data) {
		addSyncContinuation(function () {
			log("clicking!!");
			var item = jqFilter(selector);
			item.trigger(eventName);
		});
		return self;
	}

	self.debug = function () {
		addSyncContinuation(function () {
			// DO NOT REMOVE THIS DEBUGGER. It's actually MEANT to be here.
			debugger;
		});
		return self;
	}

	self.finish = function () {
		runContinuations(continuations);
	};

	self.assertCSS = function (selector, propName, expected) {
		addSyncContinuation(function () {
			var item = jqFilter(selector);

			if(typeof(propName) == "string") {
				var found = item.css(propName);
				compareFoundToExpected(found, expected);
			}
			else if(typeof(propName) == "object") {
				for(var key in propName) {
					if(propName.hasOwnProperty(key)) {
						var expectedVal = propName[key];
						var found = item.css(key);

						compareFoundToExpected(found, expectedVal);
					}
				}<commit_msg>Add component kpi tests<commit_after>var TestHelper = function () {
	var self = this;
	var contextDiv = $("body");
	var doneFunc = null,
		continuations = [];


	var jqFilter = function (val) {
		if(contextDiv == null) {
			self.showError ("Context is null");
		}
		if(typeof(val) === "string") {
			var contextFound = contextDiv.find(val);
			if(contextFound.length === 0) {
				self.showError("Cannot find selector " + val + " in context");
			}
			if(contextFound.length > 1) {
				console.warn("the number of elements found for ", val, "is ", contextFound.length);
			}
			return $(contextDiv.find(val)[0]);
		}
		if(typeof(val) === "object") {
			if(val.length === 0) {
				self.showError("Empty jquery object passed");
			}
			if(val.length > 1) {
				console.warn("the number of elements found for ", val, "is ", contextFound.length);
			}

			return val;
		}

		if(typeof(val) === "function") {
			return val(contextDiv);
		}
		throw "Unexpected type for jquery filter";
	}
	self.start = function (done) {
		log("Starting");
		doneFunc = done;
		contextDiv = $("body");
		continuations = [];

		return self;
	};

	self.setContext = function (context, reset) {
		if(typeof(reset) == "undefined")
		{
			reset = true;
		}
		addSyncContinuation(function () {
			// First, reset the context div to body
			if(reset) {
				contextDiv = $("body");
			}
			contextDiv = jqFilter(context); 
		});
		return self;
	};

	self.assertText = function (selector, expected, options) {
		options = options ? options : {};
		addSyncContinuation(function () {
			log("Asserting text is " + expected);
			var item = jqFilter(selector);
			var found = item.text();
			if(options.trim) {
				found = found.trim();
			}

			compareFoundToExpected(found, expected);
		});
		return self;
	};

	self.wait = function (timeout) {
		addASyncContinuation(function (done) {
			log("Waiting for " + timeout);
			setTimeout(done, timeout);
		});
		return self;
	};

	self.click = function (selector, data) {
		return self.triggerEvent(selector, "click");
	};

	self.triggerEvent = function (selector, eventName, data) {
		addSyncContinuation(function () {
			log("clicking!!");
			var item = jqFilter(selector);
			item.trigger(eventName);
		});
		return self;
	}

	self.debug = function () {
		addSyncContinuation(function () {
			console.log("Launching a debugger");
			console.log("The current div is ", contextDiv)
			// DO NOT REMOVE THIS DEBUGGER. It's actually MEANT to be here.
			debugger;
		});
		return self;
	}

	self.finish = function () {
		runContinuations(continuations);
	};

	self.assertCSS = function (selector, propName, expected) {
		addSyncContinuation(function () {
			var item = jqFilter(selector);

			if(typeof(propName) == "string") {
				var found = item.css(propName);
				compareFoundToExpected(found, expected);
			}
			else if(typeof(propName) == "object") {
				for(var key in propName) {
					if(propName.hasOwnProperty(key)) {
						var expectedVal = propName[key];
						var found = item.css(key);

						compareFoundToExpected(found, expectedVal);
					}
				}
{'fraction_non_alphanumeric': 0.1520206362854686, 'fraction_numerical': 0.0017196904557179708, 'mean_word_length': 3.456704980842912, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1193021', 'n_tokens_mistral': 2219, 'n_tokens_neox': 1872, 'n_words': 442}