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-06-10 19:23:16 -04:00
|
|
|
var otp = '528686';
|
|
|
|
|
var schoolUUID = '52d19519-103f-45e3-9fa8-d21baa0f8aaa'
|
2024-01-05 17:07:59 -05:00
|
|
|
var courseUUIDs = [
|
2024-06-10 19:23:16 -04:00
|
|
|
"e78fffce-0e95-4f55-a419-05be0015a2cf",
|
|
|
|
|
"ab16655f-3e99-4d37-82c6-8ea3f100f184",
|
|
|
|
|
"925a0380-cdf2-45ce-9f67-0183eb881fb7",
|
|
|
|
|
"22c1831f-6e12-423b-9959-6afb62fa06a9",
|
|
|
|
|
"21494afa-787a-4522-88ce-b556ddbb28ef",
|
|
|
|
|
"0fb94072-4119-455e-8f08-4f08cf113b67",
|
|
|
|
|
"ba9437f8-78bc-4a83-9b62-b91a312b2a9b",
|
|
|
|
|
"3070d735-894f-46f7-b0b5-a095f740e114",
|
|
|
|
|
"c6f90043-674f-4077-b4a0-cb0a15fb5283",
|
|
|
|
|
"b4e8ed8d-baaf-494f-a108-34a2a83967cf",
|
|
|
|
|
"1a071eb6-fc22-4bdd-bdd8-14742cebfdfa",
|
|
|
|
|
"e752059a-ff8c-47f4-9a7c-b5a335bb2bed",
|
|
|
|
|
"bec96106-adb3-4224-a561-415bd7c70073",
|
|
|
|
|
"6af6e861-3e4b-47ac-b804-3f0e8b24e0da",
|
|
|
|
|
"88f3dd64-9382-4929-aa65-57e7fadf40eb",
|
2024-01-05 17:07:59 -05:00
|
|
|
]
|
2024-06-10 19:23:16 -04:00
|
|
|
var schoolNameToCloneTo = "Anthology 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-06-10 19:23:16 -04: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-06-10 19:23:16 -04: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-06-10 19:23:16 -04:00
|
|
|
await p.goto('https://app.northpass.com/admin/schools/'+ schoolUUID +'/courses/'+ courseUUIDs[i] +'/clone/new')
|
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-03-07 16:15:01 -05: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()
|
|
|
|
|
})
|