NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

/* jshint esversion: 8 */
/* istanbul ignore next */
const SIS = require('../university/sis');
const OraclePeopleSoft = require('../university/oracle.peoplesoft');
const logger = require('../../lib/common/log').logger;
const DuoHandler = require('../mfa/duo.delay.handler');
const Navigator = require('../sis.navigator');
const SUPPORTED_ITEM_TYPE = require('../../lib/common/constants').supportedItemTypes;
const Controller = require('../../lib/controller');
const DownloadUtils = require('../../lib/utils/download-utils');
/**
* University Of Arizona
* Currently onboarded false this datasource as need to check base_url.
* https://studentcenter.cv.studentcenter.arizona.edu/psc/uazsaprd/UA_STUDENT/HRMS/c/SA_LEARNER_SERVICES.SSS_TSRQST_UNOFF.GBL
*/
class Sch_CV8e5LSSkOvsiuaM6WMRopZkieE extends Navigator {

constructor(session_id) {
super(session_id);
this.set_alternative_login(false);
}

async execute_pre_login(page) {
logger.debug('Sch_CV8e5LSSkOvsiuaM6WMRopZkieE -> execute_pre_login - started');

const element = 'input[type="password"]';
// As url take time to redirect to login page.
await this.ph.waitForSelector(element, page, {
timeout: 20000,
visible: true
});
}

async is_login_page(page) {
logger.debug('Sch_CV8e5LSSkOvsiuaM6WMRopZkieE -> is_login_page - started');

let is_login = await super.is_login_page(page);
const errRegexList = ['Account locked', 'Your account has been locked', 'authentication error occured', 'Stale Request'];
let is_error = await this.ph.searchError(errRegexList, page);
if (is_error) {
logger.debug(await this.ph.getErrorText(page));
}
logger.info(`Sch_CV8e5LSSkOvsiuaM6WMRopZkieE -> is_login_page, is_login - ${is_login}, is_error - ${is_error}`);

return (is_login || is_error);
}

async do_login(page, username, password) {
username = username.split('@')[0];
await this.ph.performLogin(username, password, page);
await Promise.race([this.ph.waitForNavigation(page), this.ph.waitFor(10000)]);
}

async has_mfa(page) {
return await new DuoHandler(this.session_id).has_mfa(page);
}

async is_mfa_setup(page) {
logger.debug('Sch_CV8e5LSSkOvsiuaM6WMRopZkieE -> is_mfa_setup - started');
const elements = ['#messages-view'];
const errRegexList = ['you are not enrolled in Duo'];

await this.ph.once(page, 'frameattached', 5000);
let frame = await this.ph.getFrameByIdOrName('duo_iframe', page);

try {
await this.ph.waitForSelector(elements[0], frame, {
visible: true,
timeout: 6000
});
} catch (e) {
logger.warn(e);
}

let is_enroll_duo = await this.ph.searchError(errRegexList, frame);
logger.info(`Sch_CV8e5DeUX6UPpJkd6sODc2wlop8 -> is_mfa_setup -> is_enroll_duo - ${is_enroll_duo}`);

return is_enroll_duo;
}

async navigate_to_dashboard(page) {
let dashboard_url = "https://studentcenter.arizona.edu/app/ui/dashboard";
try {
await this.ph.goto(dashboard_url, page, ['load']);
} catch (e) {
logger.warn(e);
}
return page;
}

async navigate_to_academic_profile(page) {
let profile_url = "https://studentcenter.arizona.edu/app/ui/profile/demographic-info";
let elements = ['//span[text()="Demographic Information"]'];
try {
await this.ph.goto(profile_url, page, ['load']);
await this.ph.waitForXPath(elements[0], page);
} catch (e) {
logger.warn(e);
}

if (!await this.ph.isXpathExist(elements[0], page)) {
throw Controller.getError('general', 'notAvailable', SUPPORTED_ITEM_TYPE.academic_profile);
}

return page;
}

async navigate_to_graduation_status_report(page) {
logger.debug('Sch_CV8e5LSSkOvsiuaM6WMRopZkieE -> navigate_to_graduation_status_report -> started');

let gsr_url = "https://studentcenter.arizona.edu/app/ui/academics/ps/view-my-graduation-status";
try {
await this.ph.goto(gsr_url, page, ['load']);
await this.ph.waitForSelector('body', page);
} catch (e) {
logger.warn(e);
}

if (!await this.ph.searchError(['No Active Academic Programs'], page)) {
return page;
}

this.ops = new OraclePeopleSoft(this.session_id);
this.base_url = 'https://studentcenter.cv.studentcenter.arizona.edu/psc/uazsaprd/UA_STUDENT/HRMS/c';
this.ops.base_url = this.base_url;
this.ops.gsr_type = 'SA_LEARNER_SERVICES.SSS_GRAD_STATUS.GBL';
return await this.ops.navigate_to_graduation_status_report(page);
}

async navigate_to_transcript(page) {
logger.debug('Sch_CV8e5LSSkOvsiuaM6WMRopZkieE -> navigate_to_transcript -> started');

await this.ph.set_pdf_download(this.session, true);

let transcript_url = "https://studentcenter.arizona.edu/app/ui/academics/ps/view-unofficial-transcript";
//let elements = ['a[href="/app/ui/academics/ps/view-unofficial-transcript"]'];
try {
await this.ph.goto(transcript_url, page, ['load']);
//await this.ph.performClick(elements[0], page);
} catch (e) {
logger.warn(e);
}

this.du = new DownloadUtils();
await this.du.createDownloadDir(this.session_id);
await this.ph.downloadFileInitializer(this.du.getDownloadPath(this.session_id), page);
let files = await this.du.getDownloadFilesPath(this.session_id, 20000);
try {
if (files.length === 0) {
throw new Error('File is not available in the download path');
}
this.session.extract_file_path = files[0];
return page;
} catch (e) {
logger.warn(e);
return await this.alt_navigate_to_transcript(page);
}
}

async alt_navigate_to_transcript(page) {
logger.debug('Sch_CV8e5LSSkOvsiuaM6WMRopZkieE -> alt_navigate_to_transcript - started');
this.sis = new SIS(this.session_id);
this.sis.base_url = 'https://studentcenter.cv.studentcenter.arizona.edu/psc/uazsaprd/UA_STUDENT/HRMS/c';
this.session.data.is_alt_transcript = true;
return await this.sis.navigate_to_transcript(page);
}

async get_iterator(page, type) {
if (type === SUPPORTED_ITEM_TYPE.transcript && this.session.data.is_alt_transcript) {
return await this.sis.get_iterator(page, type);
}
return await super.get_iterator(page, type);
}

async get_extractor(page, type) {
if (type === SUPPORTED_ITEM_TYPE.transcript && this.session.data.is_alt_transcript) {
return await this.sis.get_extractor(page, type);
}
return await super.get_extractor(page, type);
}

async navigate_to_grade_report(page) {
let grade_url = "https://studentcenter.arizona.edu/app/ui/academics/grades";
try {
await this.ph.goto(grade_url, page, ['load']);
} catch (e) {
logger.warn(e);
}
if (await this.ph.searchError(['You have no access to grades at this time'], page)) {
throw Controller.getError('general', 'notAvailable', SUPPORTED_ITEM_TYPE.grade_report);
}

throw Controller.getError('general', 'retrievalFailed', SUPPORTED_ITEM_TYPE.grade_report);

return page;
}

async is_expiry_page(page) {
logger.debug('Sch_CV8e5LSSkOvsiuaM6WMRopZkieE -> is_expiry_page -> started');

await this.pu.debugger(page, this.session_id);
let expiry_url = "https://shibboleth.arizona.edu/idp/profile/Logout";
try {
if (await page.url().includes(expiry_url) || await this.ph.searchError(['You are logged out of WebAuth'], page) || await this.ph.searchError(['Please exit your browser to completely logout of all applications accessed during this browser session'], page)) {
return true;
}
} catch (e) {
logger.warn(e);
}
return false;
}

/*async navigate_to_transcript(page) {
return await super.custom_navigate_to_transcript(page, 'UAZ00');
}*/

}

module.exports = Sch_CV8e5LSSkOvsiuaM6WMRopZkieE;
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.