<commit_before>$(function(){
    chai.should();
    var $container = $('.page-body');
    var $iframe = $('#scaled-frame');
    var $window = $(window).on('resize', function(){
        var height = $(this).height()-100;
        $container.height(height);
        $iframe.height(height * 1.3);
        $iframe.width($(this).width()/2 * 1.3);
    }).trigger('resize'); //on page load

    var tests = [
        {
            suite:'login',
            title:'Verify user can login with valid user account',
            verify: function($dom) {
                $dom.find('a[href$="/login"]').trigger('click');
            }
        }
    ];

    $('#tests').html('');

    for (var i = 0; i < tests.length; i++) {
        var test = tests[i];
        $('#tests').append('<h2 class="test-suite">' + test.suite + '</h2>');
        $('#tests').append('<p><span class="test-status"></span>' + test.title + '</p>');
        test.verify($('#scaled-frame').contents());
    };

    $("iframe#scaled-frame").load(function () {
        var $content = $("iframe").contents();
        var $element = $content.find('a[href="/login"]');
        if($element.length) {
            //$element.get(0).click();
        }

        
    });
    
    $('#btn').click(function(){
        console.log("1");
        $("iframe#scaled-frame").contents().find('#btn-login').get(0).click();
            console.log("2");

        $("iframe#scaled-frame").one( "load", function() { 
            console.log("3");
            $("iframe#scaled-frame").contents().find('#email').val('<EMAIL>');
            console.log("4");
            $("iframe#scaled-frame").contents().find('#pwd').val('<PASSWORD>');
            console.log("5");
            $("iframe#scaled-frame").contents().find('#submit-btn').get(0).click();
            
            $("iframe#scaled-frame").one( "load", function() { 
                console.log("6");
                console.log($("iframe#scaled-frame").contents().find('.login-welcome-msg').text().should.equal('Your login is successful'));
            });
        });
    });
    
});<commit_msg>some trials with the concept<commit_after>$(function(){
    chai.should();

    var x = new function(iframe) {
        var $iframe = $(iframe).contents();
        this.element = null;
        
        this.element = function (selector) {
            this.element = $iframe.find(selector);
            if(!element.length) {
                console.log('Element ' + selector + ' cannot be found!');
            }
            return this;
        };
        this.click = function() {
            this.element.get(0).click();
        };
        this.text = function() {
            return this.element.text();
        };
        this.enter = function(text) {
            this.element.val(text);
        };
        this.waitForPage = function() {

        };
    }

    var $container = $('.page-body');
    var $iframe = $('#scaled-frame');
    var $window = $(window).on('resize', function(){
        var height = $(this).height()-100;
        $container.height(height);
        $iframe.height(height * 1.3);
        $iframe.width($(this).width()/2 * 1.3);
    }).trigger('resize'); //on page load

    var tests = [
        {
            suite:'login',
            title:'Verify user can login with valid user account',
            verify: function($dom) {
                $dom.find('a[href$="/login"]').trigger('click');
            }
        }
    ];

    $('#tests').html('');

    for (var i = 0; i < tests.length; i++) {
        var test = tests[i];
        $('#tests').append('<h2 class="test-suite">' + test.suite + '</h2>');
        $('#tests').append('<p><span class="test-status"></span>' + test.title + '</p>');
        test.verify($('#scaled-frame').contents());
    };

    $("iframe#scaled-frame").load(function () {
        var $content = $("iframe").contents();
        var $element = $content.find('a[href="/login"]');
        if($element.length) {
            //$element.get(0).click();
        }

        
    });
    
    $('#btn').click(function(){
        console.log("1");
        $("iframe#scaled-frame").contents().find('#btn-login').get(0).click();
            console.log("2");

        $("iframe#scaled-frame").one( "load", function() { 
            console.log("3");
            $("iframe#scaled-frame").contents().find('#email').val('<EMAIL>');
            console.log("4");
            $("iframe#scaled-frame").contents().find('#pwd').val('<PASSWORD>');
            console.log("5");
            $("iframe#scaled-frame").contents().find('#submit-btn').get(0).click();
            
            $("iframe#scaled-frame").one( "load", function() { 
                console.log("6");
                console.log($("iframe#scaled-frame").contents().find('.login-welcome-msg').text().should.equal('Your login is successful'));
            });
        });
    });
    x.element('#btn-login').click();
    x.waitForPage();
    x.element('#email').enter('');
    x.element('#pwd').enter('');
    x.element('#ubmit-btn').click('');
    x.waitForPage();
    x.element('.login-welcome-msg').text().should.equal('xx');

    x.element('#btn-login').click();
    x.waitForPage.then(function(){

        x.element('#email').enter('');
        x.element('#pwd').enter('');
        x.element('#ubmit-btn').click('');
        
        x.waitForPage.then(function() {
            x.element('.login-welcome-msg').text().should.equal('xx');
        });
    });
});
{'fraction_non_alphanumeric': 0.2297693152691322, 'fraction_numerical': 0.007506407909190773, 'mean_word_length': 2.0673778775968557, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, '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': '5289393', 'n_tokens_mistral': 1661, 'n_tokens_neox': 1602, 'n_words': 229}