App-Dochazka-WWW

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

- tests: js: first dochazka-www unit test
- tests: js: migrate unit test to QUnit 2.4.0
- build/ops: require App::MFILE::WWW 0.158

0.149 2017-09-24 00:03 CEST
- build/ops: add ext/codepaths file to MANIFEST
- js: tests: add simple test cases for mainMenu targets
- Dispatch.pm: upon login success, expurgate currentUser object
- js: tests: force root user for mainMenu test
- js: tests: refactor and add test for mainEmpl menu
- js: tests: use setTimeout properly
- js: tests/main-menu.js: refactor to do login/logout
- Dispatch.pm: use _prep_ajax_response for logout
- daction-start.js: call loggout instead of logout
- tests/main-menu.js: use current user object correctly
- js: tests: refactor all three existing tests

0.150 2017-09-25 17:36 CEST
- js: emp-lib: migrate ldapLookupSubmit() to target stack
- js: tests: add LDAP lookup test case
- js: tests: put focus on selection field when populating it

share/js/dochazka-www/tests/01-users.js  view on Meta::CPAN

        test_desc;

    return function () {

        test_desc = 'create "active" and "inactive" users if necessary';
        QUnit.test(test_desc, function (assert) {
            console.log('***TEST*** ' + prefix + test_desc);
            var done = assert.async(6);
            assert.expect(25);
            login({"nam": "root", "pwd": "immutable"});
            setTimeout(function () {
                ct.login(assert, "root", "admin");
                done();
            }, 1000);
            setTimeout(function () {
                ct.mainMenu(assert);
                done();
            }, 2000);
            setTimeout(function () {
                // create the employees
                ct.employeeCreate(assert, "active");
                ct.employeeCreate(assert, "inactive");
                done();
            }, 2400);
            setTimeout(function () {
                // add privhistory records
                ct.employeePriv(assert, "active", "active");
                ct.employeePriv(assert, "inactive", "inactive");
                done();
            }, 2800);
            setTimeout(function () {
                // assert that employees have expected privlevels
                ct.employeeHasPriv(assert, "active", "active");
                ct.employeeHasPriv(assert, "inactive", "inactive");
                loggout();
                done();
            }, 3200);
            setTimeout(function () {
                ct.loggout(assert);
                done();
            }, 3600);
        });

    };

});

share/js/dochazka-www/tests/ldap.js  view on Meta::CPAN

    var prefix = "dochazka-www: ",
        test_desc;

    return function () {

        test_desc = 'LDAP lookup - success';
        QUnit.test(test_desc, function (assert) {
            console.log('***TEST*** ' + prefix + test_desc);
            var done = assert.async(4);
            login({"nam": "root", "pwd": "immutable"});
            setTimeout(function () {
                ct.login(assert, "root", "admin");
                ct.mainMenuToMainEmpl(assert);
                ct.mainEmplToLdapLookup(assert);
                ct.submitLdapLookup(assert, 'ncutler');
                done();
            }, 1000);
            setTimeout(function () {
                var ldapDochazka;
                ct.stack(
                    assert,
                    4,
                    'Displaying LDAP employee after successful LDAP lookup',
                    'dform',
                    'ldapDisplayEmployee',
                );
                ct.mainareaForm(assert, 'ldapDisplayEmployee');
                assert.strictEqual(

share/js/dochazka-www/tests/main-empl.js  view on Meta::CPAN

        test_desc;

    return function () {

        test_desc = 'employee profile - passerby';
        QUnit.test(test_desc, function (assert) {
            var done = assert.async(4),
                fullProfile;
            console.log("***TEST*** " + prefix + test_desc);
            login({"nam": "demo", "pwd": "demo"});
            setTimeout(function() {
                ct.login(assert, "demo", "passerby");
                done();
            }, 1500);
            setTimeout(function () {
                ct.mainMenu(assert);
                // assert.ok(true, "Employee profile cache: " + QUnit.dump.parse(appCaches.profileCache));
                assert.ok(appCaches.profileCacheLength() > 0, "Employee profile cache populated");
                fullProfile = appCaches.getProfileByNick('demo');
                assert.ok("emp" in fullProfile, "Employee profile cache populated with an employee");
                assert.strictEqual(
                    fullProfile.emp.nick,
                    "demo",
                    "Employee profile cache populated with employee \"demo\""
                );
                assert.ok(true, 'select 1 ("Profile") in mainMenu as demo');
                $('input[name="sel"]').val('1');
                $('input[name="sel"]').focus();
                $('input[name="sel"]').trigger($.Event("keydown", {keyCode: 13}));
                // no AJAX call is initiated, because the profile is already in the cache
                // ct.ajaxCallInitiated(assert);
                done();
            }, 2000);
            setTimeout(function() {
                // assert.ok(true, $("#mainarea").html());
                ct.mainareaForm(assert, 'empProfile');
                // FIXME: test for non-existence of entries here, since we are
                // just a "passerby"
                loggout();
                done();
            }, 2500);
            setTimeout(function () {
                ct.loggout(assert);
                done();
            }, 3000);
        });

        test_desc = 'Search Dochazka employees - success no wildcard';
        // searches for an exact match - the resulting dbrowser will
        // contain only one object
        QUnit.test(test_desc, function (assert) {
            console.log('***TEST*** ' + prefix + test_desc);
            var done = assert.async(5);
            login({"nam": "root", "pwd": "immutable"});
            setTimeout(function () {
                ct.login(assert, "root", "admin");
                done();
            }, 1500);
            setTimeout(function () {
                var sel;
                ct.mainMenu(assert);
                ct.mainMenuToMainAdmin(assert);
                ct.mainAdminToSearchEmployee(assert);
                // enter search term into form
                $('#searchEmployee input[name="entry0"]').val('inactive');
                sel = ct.getMenuEntry(assert, $('#minimenu').html(), 'Search');
                $('input[name="sel"]').val(sel);
                $('input[name="sel"]').focus();
                start.mmKeyListener($.Event("keydown", {keyCode: 13}));
                ct.log(assert, "*** REACHED initiated search for Dochazka employee inactive");
                done();
            }, 2000);
            setTimeout(function () {
                var htmlbuf = $("#mainarea").html();
                ct.log(assert, htmlbuf);
                ct.stack(
                    assert,
                    4,
                    'Reached simpleEmployeeBrowser dbrowser',
                    'dbrowser',
                    'simpleEmployeeBrowser'
                );
                ct.contains(

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.784 second using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )