<commit_before>/*
 * Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
 * These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
 *
 * Usage:
 * $ casperjs screenshots.js http://example.com
 */

var casper = require("casper").create();

var screenshotUrl = 'http://www.lokalepolitie.be/5388',
    screenshotNow = new Date(),
    screenshotDateTime = screenshotNow.getFullYear() + pad(screenshotNow.getMonth() + 1) + pad(screenshotNow.getDate()) + '-' + pad(screenshotNow.getHours()) + pad(screenshotNow.getMinutes()) + pad(screenshotNow.getSeconds()),
    viewports = [
        {
            'name': 'smartphone-portrait',
            'viewport': {width: 320, height: 480}
        },
        {
            'name': 'smartphone-landscape',
            'viewport': {width: 480, height: 320}
        },
        {
            'name': 'tablet-portrait',
            'viewport': {width: 768, height: 1024}
        },
        {
            'name': 'tablet-landscape',
            'viewport': {width: 1024, height: 768}
        },
        {
            'name': 'desktop-standard',
            'viewport': {width: 1280, height: 1024}
        }
    ];

casper.start(screenshotUrl, function() {
    this.echo('Current location is ' + this.getCurrentUrl(), 'info');
});

casper.each(viewports, function(casper, viewport) {
    this.then(function() {
        this.viewport(viewport.viewport.width, viewport.viewport.height);
    });
    this.thenOpen(screenshotUrl, function() {
        this.wait(5000);
    });
    this.then(function(){
        this.echo('Screenshot for ' + viewport.name + ' (' + viewport.viewport.width + 'x' + viewport.viewport.height + ')', 'info');
        this.capture('output/' + screenshotDateTime + '/' + viewport.name + '-' + viewport.viewport.width + 'x' + viewport.viewport.height + '.png', {
            top: 0,
            left: 0,
            width: viewport.viewport.width,
            height: 1400
        });
    });
});

casper.run();

function pad(number) {
    var r = String(number);
    if ( r.length === 1 ) {
        r = '0' + r;
    }
    return r;
}<commit_msg>Refactored test to use breakpoints<commit_after>/*
 * Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
 * These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
 *
 * Usage:
 * $ casperjs screenshots.js http://example.com
 */

var casper = require("casper").create();

var screenshotUrl = 'http://www.lokalepolitie.be/5388',
    screenshotNow = new Date(),
    screenshotDateTime = screenshotNow.getFullYear() + pad(screenshotNow.getMonth() + 1) + pad(screenshotNow.getDate()) + '-' + pad(screenshotNow.getHours()) + pad(screenshotNow.getMinutes()) + pad(screenshotNow.getSeconds()),
    viewports = [
        {
            'name': '320',
            'viewport': {width: 320}
        },
        {
            'name': '600',
            'viewport': {width: 600}
        },
        {
            'name': '767',
            'viewport': {width: 767}
        },
        {
            'name': '998',
            'viewport': {width: 998}
        }
    ];

casper.start(screenshotUrl, function() {
    this.echo('Current location is ' + this.getCurrentUrl(), 'info');
});

casper.each(viewports, function(casper, viewport) {
    this.then(function() {
        this.viewport(viewport.viewport.width, 1200);
    });
    this.thenOpen(screenshotUrl, function() {
        this.wait(5000);
    });
    this.then(function(){
        this.echo('Screenshot for ' + viewport.name + ' (' + viewport.viewport.width + ')', 'info');
        this.capture('output/' + screenshotDateTime + '/' + viewport.name + '.png', {
            top: 0,
            left: 0,
            width: viewport.viewport.width,
            height: 1200
        });
    });
});

casper.run();

function pad(number) {
    var r = String(number);
    if ( r.length === 1 ) {
        r = '0' + r;
    }
    return r;
}
{'fraction_non_alphanumeric': 0.15850642927794262, 'fraction_numerical': 0.02373887240356083, 'mean_word_length': 2.3485099337748343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2538518', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1263, 'n_words': 268}