khcanvas_test.js 1.08 KB
//@ts-check
//https://github.com/gatoona/AWS-Selenium
import * as canvas from '../khcanvas.js'
import * as rd from 'readline'
import { assert } from 'console';

describe('khcanvas', () => {
    it('opening selenium', () => {
        //this.timeout(1000);
        canvas.using_selenium(async (driver) => {
            await driver.get("http://khuhub.khu.ac.kr");
            await driver.getTitle().then(function (title) {
                console.log(title);
            });
        });
    })
});


describe('khcanvas', () => {
    it('get schedule', async () => {
        const rl = rd.createInterface({
            input: process.stdin,
            output: process.stdout
        })

        rl.question('a', async (a) => {
            rl.question('b', async (b) => {
                await canvas.get_schedule(a, b, new Date())
                    .then(it => { 
                        console.log(it)
                    })
                    .catch(it => {
                        console.log(it)
                        throw new Error();
                    })
            })
        })
    })
});