def test_ais(ctx): # Open 'cierna skrynka' apps = aisikl.portal.get_apps(ctx) app, prev_ops = Application.open(ctx, apps['AS042'].url) # Open main dialog dlg = app.awaited_open_main_dialog([prev_ops[0]]) # Open another selection dialog dlg = app.awaited_open_dialog([prev_ops[1]]) # Select the last row in the table app.d.table.select(len(app.d.table.all_rows()) - 1) # Click confirm (closes the dialog) with app.collect_operations() as ops: app.d.enterButton.click() dlg = app.awaited_close_dialog(ops) # Click on pridatPrispevokButton with app.collect_operations() as ops: app.d.pridatPrispevokButton.click() # Opens a dialog dlg = app.awaited_open_dialog(ops) # Write a short message app.d.textTextArea.write('Dobry den pani prodekanka, toto prosim ignorujte, len testujem ten nestastny AIS.') # Confirm the message with app.collect_operations() as ops: app.d.enterButton.click()
def _open_administracia_studia(self): url = '/ais/servlets/WebUIServlet?fajr=A&appClassName=ais.gui.vs.es.VSES017App&kodAplikacie=VSES017&uiLang=SK' ignored_messages = DEFAULT_IGNORED_MESSAGES + [ 'Štúdium je prerušené. Zvoľte aktívne štúdium.' ] app, ops = Application.open(self.context, url, ignored_messages) app.awaited_open_main_dialog(ops) return app
def test(self): apps = aisikl.portal.get_apps(self.context) del apps['SSSP031'] # pri otvarani vyhodi AISParseError for a in apps: app, ops = Application.open(self.context, apps[a].url) if not _check_testing_started(app, ops): _test_app(app, ops) self.context.log('benchmark', 'Test successfully finished')
def _open_register_osob(self): url = '/ais/servlets/WebUIServlet?fajr=A&appClassName=ais.gui.lz.LZ014App&kodAplikacie=LZ014&uiLang=SK' app, ops = Application.open(self.context, url) assert_ops(ops, 'openMainDialog', 'openDialog') app.open_main_dialog(*ops[0].args) app.open_dialog(*ops[1].args) return app
def _open_sprava_datumov(self): '''Opens 'Správa dátumových akcií' application (VSST010). :return: a :class:`~Application` object. ''' url = '/ais/servlets/WebUIServlet?appClassName=ais.gui.vs.st.VSST010App' \ '&fajr=A&kodAplikacie=VSST010&uiLang=SK' app, ops = Application.open(self.context, url) app.awaited_open_main_dialog(ops) return app
def otvor_reporty(client): url = '/ais/servlets/WebUIServlet?appClassName=ais.gui.rp.zs.RPZS003App&kodAplikacie=RPZS003&uiLang=SK' app, ops = Application.open(client.context, url) app.awaited_open_main_dialog(ops) return app
def save_application_form(ctx, application, lists, application_id, process_type): session = flask.json.loads(application.application) notes = {} apps = aisikl.portal.get_apps(ctx) app, prev_ops = Application.open(ctx, apps['VSPK014'].url) # Otvori sa dialog a v nom dalsi dialog dlg = app.awaited_open_main_dialog([prev_ops[0]]) dlg = app.awaited_open_dialog([prev_ops[1]]) # Zavrieme ten dalsi dialog with app.collect_operations() as ops: app.d.enterButton.click() dlg = app.awaited_close_dialog(ops) # Vyrobime novu prihlasku with app.collect_operations() as ops: app.d.novyButton.click() dlg = app.awaited_open_dialog(ops) # Opyta sa nas to na stupen studia app.d.stupenComboBox.select(0) with app.collect_operations() as ops: app.d.enterButton.click() # Zavreme prvy dialog a otvori sa nam novy dlg = app.awaited_close_dialog([ops[0]]) dlg = app.awaited_open_dialog([ops[1]]) ########## # Vyplname prihlasku ########## # Vymazeme obcianstvo with app.collect_operations() as ops: app.d.button16.click() app.d.kodStatTextField.write(session['nationality']) with app.collect_operations() as ops: app.d.button3.click() # If the birth number is not filled in, just skip the whole "guess the # person by their birth number" part if len(session['birth_no'].strip()) != 0: app.d.rodneCisloTextField.write(session['birth_no']) # Click on relevant rodneCisloButton with app.collect_operations() as ops: app.d.rodneCisloButton.click() # FIXME: This i here is simply one nasty hack. Its purpose is simple: # we really do not know what sort of an op will AIS return. Thus, we'll # try openDialog and confirmBox and throw an exception otherwise while len(ops) != 0: # Close the dialog if some shows up if len(ops) == 1 and ops[0].method == 'openDialog': app.awaited_open_dialog(ops) with app.collect_operations() as ops: app.d.closeButton.click() app.awaited_close_dialog(ops) # Clear the ops ops = [] # It may happen that a confirmBox gets shown (for whatever reason). # Should that happen, the confirmBox should be just closed. elif len(ops) == 1 and ops[0].method == 'confirmBox': with app.collect_operations() as ops: app.confirm_box(-1) elif len(ops) == 1: raise Exception('Unexpected ops {}'.format(ops)) # If the priezviskoTextField is not empty, it most probably means the # person is already registered in if app.d.priezviskoTextField.value != '' and process_type is None: notes['person_exists'] = { 'name': app.d.menoTextField.value, 'surname': app.d.priezviskoTextField.value, 'date_of_birth': app.d.datumNarodeniaDateControl.value, 'place_of_birth': app.d.sklonovanieNarTextField.value, 'phone': app.d.telefonTextField.value, 'email': app.d.emailPrivateTextField.value } # end the process here by returning return None, notes # Turn off automatic generation of ID numbers for applications. app.d.ecAutomatickyCheckBox.set_to(False) app.d.evidCisloNumberControl.write(str(application.id)) # If we are in the 'no_fill' process_type, the personal data and address # should be taken from whatever AIS2 provides if process_type != 'no_fill': app.d.menoTextField.write(session['basic_personal_data']['name']) app.d.priezviskoTextField.write(session['basic_personal_data']['surname']) if session['basic_personal_data']['surname'] != session['basic_personal_data']['born_with_surname']: app.d.povPriezviskoTextField.write(session['basic_personal_data']['born_with_surname']) # This should basically never happen in production, but when testing, # it would be nice not to fail in case the application does not have # the submitted_at date filled in yet. if application.submitted_at is not None: app.d.datumOdoslaniaDateControl.write(application.submitted_at.strftime('%d.%m.%Y')) app.d.datumNarodeniaDateControl.write(session['date_of_birth']) # Sex selection if session['sex'] == 'male': app.d.kodPohlavieRadioBox.select(0) else: app.d.kodPohlavieRadioBox.select(1) #rodinny_stav_text = lists['marital_status'][session['marital_status']].split(' - ')[0] ## FIXME: AIS2 hack #if rodinny_stav_text == 'nezistený': # rodinny_stav_text = 'neurčené' #rodinny_stav_index = None #for idx, option in enumerate(app.d.kodRodinnyStavComboBox.options): # option_text = option.title.split('/')[0].lower() # if option_text == rodinny_stav_text: # rodinny_stav_index = idx #if rodinny_stav_index is not None: # app.d.kodRodinnyStavComboBox.select(rodinny_stav_index) # Clean up place of birth and state of birth with app.collect_operations() as ops: app.d.c30Button.click() app.d.c31Button.click() if session['country_of_birth'] == '703': app.d.sklonovanieNarTextField.write(session['place_of_birth']) with app.collect_operations() as ops: app.d.vyberMiestoNarodeniabutton.click() else: app.d.statNarodeniaTextField.write(lists['country'][session['country_of_birth']]) # noqa with app.collect_operations() as ops: app.d.button22.click() app.d.sklonovanieNarTextField.write(session['place_of_birth_foreign']) # noqa app.d.telefonTextField.write(session['phone']) app.d.emailPrivateTextField.write(session['email']) # Address fill_in_address('address_form', app, session, lists) # Correspondence address if session['has_correspondence_address']: app.d.pouzitPSAdresuCheckBox.toggle() fill_in_address('correspondence_address', app, session, lists) # Vyplnime prvy odbor app.d.program1TextField.write(session['study_programme'][0]) # Nechame doplnit cely nazov odboru with app.collect_operations() as ops: app.d.button12.click() print('After filling in study programme: {}'.format(ops), file=sys.stderr) # Deal with the dialog that opens up when a prefix of a programme # matches various options, e.g. FYZ and FYZ/k choose_study_programme(app, ops, session['study_programme'][0]) # Nechame doplit povinne predmety with app.collect_operations() as ops: app.d.c11Button.click() second_study_programme = None third_study_programme = None if session['study_programme'][2] != '_': third_study_programme = session['study_programme'][2] if session['study_programme'][1] == '_' and \ session['study_programme'][2] != '_': second_study_programme = session['study_programme'][2] third_study_programme = '_' if session['study_programme'][1] != '_': second_study_programme = session['study_programme'][1] # Second study programme if second_study_programme is not None: app.d.program2TextField.write(second_study_programme) # Nechame doplnit cely nazov odboru with app.collect_operations() as ops: app.d.button13.click() # Deal with the dialog that opens up when a prefix of a programme # matches various options, e.g. FYZ and FYZ/k choose_study_programme(app, ops, second_study_programme) # Nechame doplit povinne predmety with app.collect_operations() as ops: app.d.c12Button.click() # Third study programme if third_study_programme not in [None, '_']: app.d.program3TextField.write(third_study_programme) # Nechame doplnit cely nazov odboru with app.collect_operations() as ops: app.d.button14.click() # Deal with the dialog that opens up when a prefix of a programme # matches various options, e.g. FYZ and FYZ/k choose_study_programme(app, ops, third_study_programme) # Nechame doplit povinne predmety with app.collect_operations() as ops: app.d.c13Button.click() app.d.rokZaverSkuskyNumberControl.write(str(session['basic_personal_data']['matura_year'])) if session['finished_highschool_check'] == 'SK': # 'XXXXXXX' signifies "highschool not found" if session['studies_in_sr']['highschool'] != 'XXXXXXX': app.d.sSKodTextField.write(session['studies_in_sr']['highschool']) app.d.button10.click() app.d.odborySkolyCheckBox.toggle() # 'XXXXXX' signifies 'study programme not found' if session['studies_in_sr']['study_programme_code'] != 'XXXXXX': app.d.kodOdborTextField.write(session['studies_in_sr']['study_programme_code']) app.d.c1Button.click() # Select correct option index based on education_level typ_vzdelania_index = None for idx, option in enumerate(app.d.sSKodTypVzdelaniaComboBox.options): if option.id == session['studies_in_sr']['education_level']: typ_vzdelania_index = idx if typ_vzdelania_index is not None: app.d.sSKodTypVzdelaniaComboBox.select(typ_vzdelania_index) else: # foreign high school app.d.sSKodTextField.write('999999999') app.d.button10.click() # študijný odbor na zahraničnej škole app.d.kodOdborTextField.write('0000500') # Remove all rows in vysvedceniaTable print("Final: {}".format(ops), file=sys.stderr) while len(app.d.vysvedceniaTable.all_rows()) > 0: with app.collect_operations() as ops: app.d.odobratButton.click() print("Removing: {}".format(ops), file=sys.stderr) # really confirm with app.collect_operations() as ops: app.confirm_box(2) if ops: rodne_cislo_dlg = app.awaited_open_dialog(ops) with app.collect_operations() as ops: app.d.closeButton.click() rodne_cislo_dlg = app.awaited_close_dialog([ops[0]]) print("In dialog: {}".format(ops), file=sys.stderr) if len(ops) > 1: rodne_cislo_dlg = app.awaited_open_dialog([ops[1]]) with app.collect_operations() as ops: app.d.closeButton.click() print("after close: {}".format(ops), file=sys.stderr) rodne_cislo_dlg = app.awaited_close_dialog(ops) print("After confirm: {}".format(ops), file=sys.stderr) ABBRs, F = generate_subject_abbrevs(session) for abbr in ABBRs: add_subject(app, abbr) fill_in_table_cells(app, abbr, F, session) # Unselect everything in prilohyTable (literally) unselect_table(app.d.prilohyTable) checkboxes = generate_checkbox_abbrs(session) # Add dean's letter if session['basic_personal_data']['dean_invitation_letter'] and\ session['basic_personal_data']['dean_invitation_letter_no']: checkboxes.add('ListD') competition_checkboxes_map = { 'MAT': 'OlymM', 'FYZ': 'OlymF', 'INF': 'OlymI', 'BIO': 'OlymB', 'CHM': 'OlymCH', 'SOC_MAT': 'SočM', 'SOC_INF': 'SočI', 'SOC_BIO': 'SočB', 'SOC_CHM': 'SočCH', 'TMF': 'TMF', 'FVAT_MAT': 'FVAT_M', 'FVAT_FYZ': 'FVAT_F', 'FVAT_INF': 'FVAT_I', 'FVAT_BIO': 'FVAT_B', 'FVAT_CH': 'FVAT_Ch', 'ROBOCUP': 'RoboCup', 'IBOBOR': 'iBobor', 'ZENIT': 'ZENIT', 'TROJSTEN_KMS': 'KMS', 'TROJSTEN_FKS': 'FKS', 'TROJSTEN_KSP': 'KSP' } # Add checkboxes based on competitions for s in ['competition_1', 'competition_2', 'competition_3']: if s in session and session[s]['competition'] != '_': comp = session[s]['competition'] checkboxes.add(competition_checkboxes_map[comp]) # TODO: "SVOC_MAT" currently means both SocM and SocF # This line is a simple band-aid at best and should be # refactored if comp == 'SVOC_MAT': checkboxes.add('SočF') # Check those items in prilohyCheckList that have been generated from the # submitted application form (the code above) for idx, row in enumerate(app.d.prilohyTable.all_rows()): if row.cells[1].value in checkboxes: app.d.prilohyTable.edit_cell('checkBox', idx, True) # Prepare poznamka_text poznamka_items = [] if 'SCIO' in checkboxes: poznamka_items.append('SCIO') if 'ExtMat' in checkboxes: poznamka_items.append('ExternaMaturitaMat') poznamka_items.append(url_for('admin_view', id=application_id, _external=True)) poznamka_text = '\n'.join(poznamka_items) app.d.poznamkaTextArea.write(poznamka_text) # Submit the app with app.collect_operations() as ops: app.d.enterButton.click() print("Post submit: {}".format(ops), file=sys.stderr) # A set of confirm boxes may show up if highschool grades were filled in if len(ABBRs) > 0: ops = deal_with_confirm_boxes(app, ops, notes) errors = app.d.statusHtmlArea.content ops = deal_with_confirm_boxes(app, ops, notes) if len(ops) == 1 and ops[-1].method == 'messageBox': if 'existuje osoba s Vami zadaným emailom.' in errors: email = app.d.emailPrivateTextField.value notes['email_exists'] = email app.d.emailPrivateTextField.write('') with app.collect_operations() as ops: app.d.enterButton.click() ops = deal_with_confirm_boxes(app, ops, notes) else: with app.collect_operations() as ops: app.d.enterButton.click() print("After messageBox: {}".format(ops), file=sys.stderr) errors = app.d.statusHtmlArea.content print("errors: {}".format(errors), file=sys.stderr) app.awaited_close_dialog(ops) return errors, notes
def _open_nastenka_predmetu(self): url = '/ais/servlets/WebUIServlet?fajr=A&appClassName=ais.gui.vs.st.VSST157App&kodAplikacie=VSST157&uiLang=SK' app, ops = Application.open(self.context, url) app.awaited_open_main_dialog(ops) return app
def _open_administracia_studia(self): url = '/ais/servlets/WebUIServlet?fajr=A&appClassName=ais.gui.vs.es.VSES017App&kodAplikacie=VSES017&uiLang=SK' ignored_messages = DEFAULT_IGNORED_MESSAGES + ['Štúdium je prerušené. Zvoľte aktívne štúdium.'] app, ops = Application.open(self.context, url, ignored_messages) app.awaited_open_main_dialog(ops) return app