2023-11-17 17:18:13 -05:00
|
|
|
const pt = require('puppeteer');
|
|
|
|
|
const readline = require("readline");
|
|
|
|
|
|
|
|
|
|
const rl =
|
|
|
|
|
readline.createInterface({
|
|
|
|
|
input: process.stdin,
|
|
|
|
|
output: process.stdout,
|
|
|
|
|
})
|
|
|
|
|
var userEmail= 'nrasmussen@northpass.com';
|
|
|
|
|
var userPassword= 'ecx5pmy!MAN2vgh2knc';
|
2024-01-08 16:41:01 -05:00
|
|
|
var otp = '229118';
|
|
|
|
|
var schoolUUID = '5692537e-4921-40e8-9c8d-1218b0ffa2da'
|
2024-01-05 17:07:59 -05:00
|
|
|
var courseUUIDs = [
|
|
|
|
|
]
|
2024-01-08 16:41:01 -05:00
|
|
|
var schoolNameToCloneTo = 'Cin7 Employee Academy';
|
2023-11-17 17:18:13 -05:00
|
|
|
|
|
|
|
|
function wait(ms) {
|
|
|
|
|
return new Promise(r => setTimeout(r, ms));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pt.launch({ headless: false }).then(async browser => {
|
|
|
|
|
var p = await browser.newPage();
|
|
|
|
|
await p.setViewport({ width: 1000, height: 500 })
|
|
|
|
|
await p.goto('https://app.northpass.com/admin/sign_in')
|
|
|
|
|
await wait(500)
|
|
|
|
|
await p.type('#administrator_email', userEmail)
|
|
|
|
|
await p.type('#administrator_password', userPassword)
|
|
|
|
|
await p.click('input.button');
|
|
|
|
|
await wait(500)
|
|
|
|
|
await p.goto('https://app.northpass.com/admin/twofactorauth/edit')
|
|
|
|
|
await wait(500)
|
|
|
|
|
await p.type('#otp_otp_attempt',otp)
|
|
|
|
|
await p.click('input.button');
|
|
|
|
|
await wait(500)
|
|
|
|
|
for (var i = 0; i < courseUUIDs.length;i++) {
|
|
|
|
|
await p.goto('https://app.northpass.com/admin/schools/'+ schoolUUID +'/courses/'+ courseUUIDs[i] +'/clone/new')
|
|
|
|
|
await p.type('#react-select-2-input',schoolNameToCloneTo)
|
|
|
|
|
await p.keyboard.press('Enter');
|
|
|
|
|
await wait(100)
|
|
|
|
|
await p.click('input.button');
|
|
|
|
|
await wait(1000)
|
|
|
|
|
}
|
|
|
|
|
await wait(2000)
|
|
|
|
|
await browser.close()
|
|
|
|
|
})
|