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,
|
|
|
|
|
})
|
2024-11-15 15:09:45 -05:00
|
|
|
var userEmail= 'nrasmussen@northpass.com';
|
2025-01-14 22:33:32 -05:00
|
|
|
var userPassword= 'ecx5pmy!MAN2vgh2knc';
|
|
|
|
|
var otp = '056467';
|
2025-01-10 16:45:57 -05:00
|
|
|
var schoolUUID = '52d19519-103f-45e3-9fa8-d21baa0f8aaa'
|
2024-01-05 17:07:59 -05:00
|
|
|
var courseUUIDs = [
|
2025-01-21 16:32:05 -05:00
|
|
|
|
2024-01-05 17:07:59 -05:00
|
|
|
]
|
2025-01-10 16:45:57 -05:00
|
|
|
|
|
|
|
|
var schoolNameToCloneTo = "Anthology Partner U";
|
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 })
|
2024-11-13 17:06:39 -05:00
|
|
|
await p.goto('https://app.northpass.com/admin/sign_in')
|
2023-11-17 17:18:13 -05:00
|
|
|
await wait(500)
|
2024-05-31 22:32:56 -04:00
|
|
|
console.log("First Wait")
|
2023-11-17 17:18:13 -05:00
|
|
|
await p.type('#administrator_email', userEmail)
|
|
|
|
|
await p.type('#administrator_password', userPassword)
|
|
|
|
|
await p.click('input.button');
|
|
|
|
|
await wait(500)
|
2024-05-31 22:32:56 -04:00
|
|
|
console.log("Second Wait")
|
2024-11-13 17:06:39 -05:00
|
|
|
await p.goto('https://app.northpass.com/admin/twofactorauth/edit')
|
2023-11-17 17:18:13 -05:00
|
|
|
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++) {
|
2024-11-13 17:06:39 -05:00
|
|
|
await p.goto('https://app.northpass.com/admin/schools/'+ schoolUUID +'/courses/'+ courseUUIDs[i] +'/clone/new')
|
2024-09-25 17:31:07 -04:00
|
|
|
await p.waitForSelector('#react-select-2-input')
|
2023-11-17 17:18:13 -05:00
|
|
|
await p.type('#react-select-2-input',schoolNameToCloneTo)
|
|
|
|
|
await p.keyboard.press('Enter');
|
|
|
|
|
await wait(100)
|
|
|
|
|
await p.click('input.button');
|
2024-09-23 20:52:09 -04:00
|
|
|
console.log('-- Index: '+i+' -- Cloned course: '+courseUUIDs[i]+' -- ')
|
2023-11-17 17:18:13 -05:00
|
|
|
await wait(1000)
|
|
|
|
|
}
|
|
|
|
|
await wait(2000)
|
|
|
|
|
await browser.close()
|
|
|
|
|
})
|