61 lines
2.0 KiB
JavaScript
61 lines
2.0 KiB
JavaScript
const pt = require('puppeteer');
|
|
const readline = require("readline");
|
|
|
|
const rl =
|
|
readline.createInterface({
|
|
input: process.stdin,
|
|
output: process.stdout,
|
|
})
|
|
var userEmail= 'ajoo@northpass.com';
|
|
var userPassword= '!MAN2vgh2knc';
|
|
var otp = '';
|
|
var schoolUUID = '52d19519-103f-45e3-9fa8-d21baa0f8aaa'
|
|
var courseUUIDs = [
|
|
'81ea3e9b-c651-42c3-8c33-639a72ebe66f',
|
|
'e78fffce-0e95-4f55-a419-05be0015a2cf',
|
|
'599c93ad-99ad-4f1d-98af-af4324f9b845',
|
|
'e78fffce-0e95-4f55-a419-05be0015a2cf',
|
|
'c0d7d8ce-c05a-452b-80d4-4a186003f2a2',
|
|
'0a50db76-ac51-4a85-ae5b-6579e1c88b00',
|
|
'1a7788ac-e6ec-4820-834b-b5fe9d2f8f71',
|
|
'd8d5fcc7-f51b-42ba-9842-0324e68be7ac',
|
|
'e78fffce-0e95-4f55-a419-05be0015a2cf',
|
|
'd3afe5e0-8725-49e1-93b7-4b03c68c9e84',
|
|
'd3afe5e0-8725-49e1-93b7-4b03c68c9e84',
|
|
'1da1bce7-4454-4c28-b1e1-6ee5536dba13',
|
|
]
|
|
var schoolNameToCloneTo = "Anthology U";
|
|
|
|
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)
|
|
console.log("First Wait")
|
|
await p.type('#administrator_email', userEmail)
|
|
await p.type('#administrator_password', userPassword)
|
|
await p.click('input.button');
|
|
await wait(500)
|
|
console.log("Second Wait")
|
|
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');
|
|
console.log('-- Index: '+i+' -- Cloned course: '+courseUUIDs[i]+' -- ')
|
|
await wait(1000)
|
|
}
|
|
await wait(2000)
|
|
await browser.close()
|
|
})
|