<commit_before>'use strict';

var _ = require('lodash');
var until = require('selenium-webdriver').until;

module.exports = {
    get: function (key, success, failure) {
        key = _.camelCase(key);
        var query = this.config[key];
        if (_.isUndefined(query)) {
            console.error('Cannot match ' + key + ' within page object config');
        } else if (success) {
            return this.world.findElement(query, success, failure);
        } else {
            return this.world.findElement(query);
        }
    },
    untilVisible: function(key) {
        return new Promise((resolve) => {
            this.world.currentPage.get(key, (el) =>  this.world.driver.wait(until.elementIsVisible(el)).then(() => resolve(el)));
        })
    },
    getTitle: function () {
        return this.world.driver.getTitle();
    },
    expectPageTitle: function (title, next) {
        this.world.driver.wait(until.titleMatches(title)).then(next);
    },
    expectPageToContain: function (id, next) {
        this.get(id, () => {
            next();
        }, () => {
            throw new Error('Element not found: "' + id + '"');
        });
    },
    expectPageToNotContain: function (id, next) {<commit_msg>Make sure title test uses reg expression<commit_after>'use strict';

var _ = require('lodash');
var until = require('selenium-webdriver').until;

module.exports = {
    get: function (key, success, failure) {
        key = _.camelCase(key);
        var query = this.config[key];
        if (_.isUndefined(query)) {
            console.error('Cannot match ' + key + ' within page object config');
        } else if (success) {
            return this.world.findElement(query, success, failure);
        } else {
            return this.world.findElement(query);
        }
    },
    untilVisible: function(key) {
        return new Promise((resolve) => {
            this.world.currentPage.get(key, (el) =>  this.world.driver.wait(until.elementIsVisible(el)).then(() => resolve(el)));
        })
    },
    getTitle: function () {
        return this.world.driver.getTitle();
    },
    expectPageTitle: function (title, next) {
        this.world.driver.wait(until.titleMatches(new RegExp(title))).then(() => next());
    },
    expectPageToContain: function (id, next) {
        this.get(id, () => {
            next();
        }, () => {
            throw new Error('Element not found: "' + id + '"');
        });
    },
    expectPageToNotContain: function (id, next) {
{'fraction_non_alphanumeric': 0.15859030837004406, 'fraction_numerical': 0.0, 'mean_word_length': 2.35752688172043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '6494656', 'n_tokens_mistral': 731, 'n_tokens_neox': 725, 'n_words': 150}