def goToModifierEtape(self, urlCourante, stepNum): # recuperation de l'etape a venir en utilisant l'image # Attention, le ctxMenuItemStyle rencontré en premier est celui de l'étape en cours idLink = '<a id=\"dm_route_elements:nxl_feuille_route_instance_listing_' + stepNum + ':nxw_dr_listing_step_actions_' + stepNum + ':titleref\"' htmlEtapeAVenir = extractToken( self.ftest.getBody(), idLink, 'img/icons/bullet_ball_glass_grey_16.png') # recuperation des differents elements de la requete hiddenSourceDocId = extractToken(htmlEtapeAVenir, 'hiddenSourceDocId\').value = \'', '\';') parameterStep = 'dm_route_elements:nxl_feuille_route_instance_listing_' + stepNum + ':nxw_dr_listing_step_actions_' + stepNum + ':nxw_dr_listing_step_actions_' + stepNum + '_edit:editStepListTable:2:documentActionSubviewUpperListLink' self.ftest.post( self.ftest.server_url + urlCourante, params=[ ['stepId', hiddenSourceDocId], # 865380c5-337d-4aa9-827e-7d5f2ae1875b [parameterStep, parameterStep], ['dm_route_elements_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ] ], description="Aller vers modification de l'étape à venir")
def creation_goTerminer(self): # Type acte Amnistie, Circulaire, decret simple type_acte_array = ["1"] type_acte_index = random.randrange(0, len(type_acte_array)) type_acte = type_acte_array[type_acte_index] self.ftest.post( self.ftest.server_url + "/espace_creation/view_creation_dossier_100.faces", params= [[ 'creation_dossier_100:nxl_creation_dossier_layout_100_a:nxw_type_acte_field_select_one_menu', type_acte ], [ 'creation_dossier_100:nxl_creation_dossier_layout_100_b:nxw_ministere_resp_field_nodeId', '50002618' ], [ 'creation_dossier_100:nxl_creation_dossier_layout_100_b:nxw_direction_resp_field_nodeId', '50001814' ], [ 'creation_dossier_100:nxl_creation_dossier_layout_100_b:nxw_direction_resp_field_nodeNor', '' ], ['creation_dossier_100:buttonTerminer', 'Terminer'], ['creation_dossier_100_SUBMIT', '1'], ['javax.faces.ViewState', extractJsfState(self.ftest.getBody())]], description="Terminer la création d'un dossier") self.ftest.assert_("<title>SOLON EPG - Espace de création")
def creation_ajouterUnDossier(self): self.ftest.post(self.ftest.server_url + "/espace_creation/view_espace_creation.faces", params=[[ 'formCreationDossier:buttonCreationDossier', 'Ajouter un dossier' ], ['formCreationDossier_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ]], description="Ajouter un dossier")
def clickOnMainTab(self, action): self.ftest.post( self.ftest.server_url + self.urlCourante, params=[['userServicesForm_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ], [ 'userServicesForm:userServicesActionsTable:' + str(action.index) + ':userServicesActionCommandLink', 'userServicesForm:userServicesActionsTable:' + str(action.index) + ':userServicesActionCommandLink' ], ['id', action.id]], description="Post go to " + action.id)
def verrouillerDossier(self): lockTableParam = self.extractLockTableParam(self.ftest.getBody()) self.ftest.post( self.ftest.server_url + self.urlCourante, params=[ ['formFdr:Avalider_non_concerne_panelOpenedState', ''], [lockTableParam, lockTableParam], ['formFdr_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ], ], description="Verrouille le dossier") self.ftest.assert_("Verrouillé le " in self.ftest.getBody(), "chaine verrouillé le non trouve")
def rs_chercherDossier(self, nor): self.ftest.post( self.ftest.server_url + self.urlCourante, params=[ ['userMetaServicesSearchForm:numeroNor', nor], [ 'userMetaServicesSearchForm:rechercheNumeroSubmitButton', 'Atteindre' ], ['userMetaServicesSearchForm_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ] ], description="Atteindre (" + nor + ")") self.urlCourante = self.urlResultatsRechercheNor
def __navigateById(self, id, title): self.ftest.post( self.ftest.server_url + self.urlEspaceTraitement, params=[ [ id + '.x', '13' ], # la valeur de ce parametre varie, mais ne semble pas avoir d'effet [ id + '.y', '7' ], # la valeur de ce parametre varie, mais ne semble pas avoir d'effet ['corbeille_content_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ] ], description="Go to " + title + " for : " + self.ftest.login)
def validerDossier(self): fdrParam = self.extractLockTableParam(self.ftest.getBody()) idNode = extractToken(self.ftest.getBody(), 'formFdr:j_id', '\':\'formFdr:j_id') self.ftest.post( self.ftest.server_url + self.urlCourante, params=[ ['formFdr_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ], ['formFdr:j_id' + idNode, 'formFdr:j_id' + idNode], [ 'formFdr:fdrActionsTable:valider_non_concerne_panelOpenedState', '' ], ], description="Valide le dossier")
def openResult(self, index, content_view, description): strIndex = str(index) dossierListingId = extractJsfId( self.ftest.getBody(), "nxw_dossier_listing_titre_dto_" + strIndex) self.ftest.post( self.ftest.server_url + self.urlCourante, params=[[content_view + '_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ], [ content_view + ':nxl_dossier_listing_dto_' + strIndex + ':nxw_dossier_listing_titre_dto_' + strIndex + ':' + dossierListingId, content_view + ':nxl_dossier_listing_dto_' + strIndex + ':nxw_dossier_listing_titre_dto_' + strIndex + ':' + dossierListingId ]], description=description)
def modifyStep(self, deadline, poste, task): if deadline == None: deadline = '' if task == None: task = '2' #tache "pour avis" self.ftest.post( self.ftest.server_url + '/edit_route_element.faces', params= [[ 'edit_step:nxl_routing_task_detail:nxw_routing_task_deadline:nxw_routing_task_deadline_from', deadline ], [ 'edit_step:nxl_routing_task_detail:nxw_routing_task_distribution_mailbox_nodeId', poste ], ['edit_step:nxl_routing_task_detail:routing_task_type', task], ['edit_step:update_step', 'Enregistrer'], ['edit_step_SUBMIT', '1'], ['javax.faces.ViewState', extractJsfState(self.ftest.getBody())]], description="Modifier l'étape à venir")
def ajoutDonneesBordereau(self, urlCourante): # Il faut conserver le html de la page d'origine pour recuperer des information a l'interieur. # les futur appels a la methode getBody vont retourner le resultat des requetes AJAX. htmlPageOrigine = self.ftest.getBody() idNode = extractToken( htmlPageOrigine, '\'parameters\':{\'bordereauForm:nxl_bordereau_indexation:', '\':\'bordereauForm:nxl_bordereau_indexation:') print idNode # Requete ajax d'ajout de la donnée d'indexation self.ftest.post( self.ftest.server_url + urlCourante, params= [[ 'AJAXREQUEST', 'bordereauForm:nxl_bordereau_indexation:nxw_indexation_rubriques_ajax_region' ], [ 'bordereauForm:nxl_bordereau_donnees_principales:nxw_categorie_acte_bord', '1' ], [ 'bordereauForm:nxl_bordereau_date_publication:nxw_date_publication_fieldInputCurrentDate', '03/2013' ], [ 'bordereauForm:nxl_bordereau_date_signature:nxw_date_signature_fieldInputCurrentDate', '03/2013' ], [ 'bordereauForm:nxl_bordereau_parution:nxw_pour_fourniture_epreuve_fieldInputCurrentDate', '03/2013' ], [ 'bordereauForm:nxl_bordereau_parution:nxw_vecteur_publication_field_selectVecteurs', 'Journal officiel' ], [ 'bordereauForm:nxl_bordereau_parution:nxw_date_precisee_publication_fieldInputCurrentDate', '03/2013' ], [ 'bordereauForm:nxl_bordereau_indexation:nxw_indexation_rubriques_select_index_menu', 'Energie, environnement' ], [ 'bordereauForm:nxl_bordereau_parution:nxw_publication_integrale_ou_extrait_field', '1' ], ['javax.faces.ViewState', extractJsfState(self.ftest.getBody())], [ 'bordereauForm:nxl_bordereau_indexation:' + idNode, 'bordereauForm:nxl_bordereau_indexation:' + idNode ], ['bordereauForm_SUBMIT', '1']], description="AJAX : ajout de la donnée d'indexation du dossier") print "Ajout autres donnees" # ajout données texte + sauvegarde self.ftest.post( self.ftest.server_url + urlCourante, params= [[ 'bordereauForm:nxl_bordereau_donnees_principales:nxw_titre_acte_field', 'titre test funkload ' ], [ 'bordereauForm:nxl_bordereau_donnees_principales:nxw_categorie_acte_bord', '1' ], [ 'bordereauForm:nxl_bordereau_responsable_acte:nxw_nom_resp_dossier_field', 'DUPONT' ], [ 'bordereauForm:nxl_bordereau_responsable_acte:nxw_qualite_resp_dossier_field', 'M' ], [ 'bordereauForm:nxl_bordereau_responsable_acte:nxw_tel_resp_dossier_field', '0102030405' ], [ 'bordereauForm:nxl_bordereau_date_publication:nxw_date_publication_fieldInputCurrentDate', '03/2013' ], [ 'bordereauForm:nxl_bordereau_date_signature:nxw_date_signature_fieldInputCurrentDate', '03/2013' ], [ 'bordereauForm:nxl_bordereau_parution:nxw_pour_fourniture_epreuve_fieldInputCurrentDate', '03/2013' ], [ 'bordereauForm:nxl_bordereau_parution:nxw_vecteur_publication_field_selectVecteurs', 'Journal officiel' ], [ 'bordereauForm:nxl_bordereau_indexation:nxw_indexation_rubriques_select_index_menu', 'Energie, environnement' ], [ 'bordereauForm:nxl_bordereau_parution:nxw_publication_integrale_ou_extrait_field', '1' ], [ 'bordereauForm:nxl_bordereau_parution:nxw_date_precisee_publication_fieldInputCurrentDate', '03/2013' ], ['bordereauForm_SUBMIT', '1'], ['javax.faces.ViewState', extractJsfState(self.ftest.getBody())], [ 'bordereauForm:idSaveBordereauButton', 'bordereauForm:idSaveBordereauButton' ]], description="Ajout et sauvegarde des données du bordereau") return htmlPageOrigine
def ajoutEtapeFDRApresEtapeCourante(self, CommentaireNouvelleEtape, idPoste, deadLine, validationAutomatique, obligatoire, urlCourante): if CommentaireNouvelleEtape == None: CommentaireNouvelleEtape = '' if deadLine == None: deadLine = '' dossierPath = self.__extractDossierPath(self.ftest.getBody()) # recuperation de l'etape courante en utilisant l'image htmlEtapeCourante = extractToken( self.ftest.getBody(), '<li class=\"ctxMenuItemStyle\">', 'img/icons/bullet_ball_glass_yellow_16.png') # recuperation des differents elements de la requete hiddenSourceDocId = extractToken(htmlEtapeCourante, 'hiddenSourceDocId\').value = \'', '\';') #print(hiddenSourceDocId) # ajouter apres self.ftest.post( self.ftest.server_url + urlCourante, params=[ [ 'selectRouteElementsTypeForCreationForm:hiddenSourceDocId', hiddenSourceDocId ], # 865380c5-337d-4aa9-827e-7d5f2ae1875b [ 'selectRouteElementsTypeForCreationForm:hiddenDocOrder', 'after' ], [ 'selectRouteElementsTypeForCreationForm:selectRouteElementsTypePanelOpenedState', '' ], ['selectRouteElementsTypeForCreationForm_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ], [ 'selectRouteElementsTypeForCreationForm:selectRouteElementsTypeForCreationTable:0:selectRouteElementTypeForCreationCategory:0:selectRouteElementsTypeForCreationCategoryTable:0:createRouteElementLink', 'selectRouteElementsTypeForCreationForm:selectRouteElementsTypeForCreationTable:0:selectRouteElementTypeForCreationCategory:0:selectRouteElementsTypeForCreationCategoryTable:0:createRouteElementLink' ] ], description="AJAX : insertion d'une etape apres l'etape courante") # creation de l'etape self.ftest.post( self.ftest.server_url + "/feuilleroute/create_route_element.faces", params=[ [ 'document_create:nxl_routing_task_detail:routing_task_type', '4' ], # Pour attribution : '4', ... [ 'document_create:nxl_routing_task_detail:nxw_routing_task_distribution_mailbox_nodeId', idPoste ], # 'poste-50000656' ou 'poste-bureau-des-cabinets' [ 'document_create:nxl_routing_task_detail:nxw_routing_task_description', CommentaireNouvelleEtape ], # 'Commentaire nouvelle \xc3\xa9tape.' [ 'document_create:nxl_routing_task_detail:nxw_routing_task_deadline:nxw_routing_task_deadline_from', deadLine ], [ 'document_create:nxl_routing_task_detail:nxw_routing_task_automatic_validation', validationAutomatique ], [ 'document_create:nxl_routing_task_detail:nxw_routing_task_obligatoire_ministere', obligatoire ], ['parentDocumentPath', dossierPath], ['document_create:button_create', 'Cr\xc3\xa9er'], # bouton de validation ['document_create_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ] ], description="Creation de l'etape de la feuille de route")
def ajouterFichierParapheur(self, urlCourante, filepath): #, htmlPageOrigine): # verification que le fichier existe if not os.path.exists(filepath): print('File not found : ' + filepath) # Il faut conserver le html de la page d'origine pour recuperer des information a l'interieur. # les futur appels a la methode getBody vont retourner le resultat des requetes AJAX. htmlPageOrigine = self.ftest.getBody() # selection du répertoire Acte Intégral. ''' exemple de requete : self.post(server_url + urlCourante, params=[ ['AJAXREQUEST', 'document_properties:documentViewRegion'], ['document_properties:parapheurTree:1::parapheurFolderVideDocAjoutableNodeExpanded', 'true'], ['document_properties:parapheurTree:2::parapheurFolderVideDocAjoutableNodeExpanded', 'true'], ['document_properties:parapheurTree:3::parapheurFolderVideDocAjoutableNodeExpanded', 'true'], ['document_properties:parapheurTree:input', 'document_properties:parapheurTree:1::parapheurFolderVideDocAjoutable'], ['document_properties_SUBMIT', '1'], ['javax.faces.ViewState', extractJsfState(self.ftest.getBody())], ['document_properties:parapheurTree:selectedNode', 'document_properties:parapheurTree:1::parapheurFolderVideDocAjoutable']], description="Post /solonepg/..._view.faces") ''' idNode = extractToken(self.ftest.getBody(), 'document_properties:parapheurTree:1::', '\"><tbody>') self.ftest.post( self.ftest.server_url + urlCourante, params= [['AJAXREQUEST', 'document_properties:documentViewRegion'], [ 'document_properties:parapheurTree:1::parapheurFolderVideDocAjoutableNodeExpanded', 'true' ], [ 'document_properties:parapheurTree:2::parapheurFolderVideDocAjoutableNodeExpanded', 'true' ], [ 'document_properties:parapheurTree:3::parapheurFolderVideDocAjoutableNodeExpanded', 'true' ], [ 'document_properties:parapheurTree:input', 'document_properties:parapheurTree:1::parapheurFolderVideDocAjoutable' ], ['document_properties_SUBMIT', '1'], ['javax.faces.ViewState', extractJsfState(self.ftest.getBody())], [ 'document_properties:parapheurTree:selectedNode', 'document_properties:parapheurTree:1::parapheurFolderVideDocAjoutable' ]], description="AJAX : Select bouton Acte intégral") # Clic sur 'Ajouter document' ''' exemple de requete : self.post(server_url + urlCourante, params=[ ['AJAXREQUEST', 'document_properties:documentViewRegion'], ['document_properties:parapheurTree:1::parapheurFolderVideDocAjoutableNodeExpanded, 'true'], ['document_properties:parapheurTree:2::parapheurFolderVideDocAjoutableNodeExpanded', 'true'], ['document_properties:parapheurTree:3::parapheurFolderVideDocAjoutableNodeExpanded', 'true'], ['document_properties:parapheurTree:input', 'document_properties:parapheurTree:1::parapheurFolderVideDocAjoutable'], ['document_properties_SUBMIT', '1'], ['javax.faces.ViewState', extractJsfState(self.ftest.getBody())], ['SelectedNodeId', '9881bbf1-7c04-42b8-90e9-9f5f37bdf7be'], ['SelectedNodeType', 'ParapheurFolder'], ['document_properties:j_id1101', 'document_properties:j_id1101'], ['ajaxSingle', 'document_properties:j_id1101']], description="Post /solonepg/..._view.faces") ''' # idNode a la même valeur que dans la requete precedente #idDocumentProperties = extractToken(htmlPageOrigine, 'document_properties:j_id', '\',\'parameters') SelectedNodeId = extractToken(htmlPageOrigine, "'show',{'id': '", "', 'type':") #print(SelectedNodeId) SelectedNodeId = SelectedNodeId.replace('\\x2D', '-') # print(SelectedNodeId) self.ftest.post( self.ftest.server_url + urlCourante, params= [['AJAXREQUEST', 'document_properties:documentViewRegion'], [ 'document_properties:parapheurTree:1::parapheurFolderVideDocAjoutableNodeExpanded', 'true' ], [ 'document_properties:parapheurTree:2::parapheurFolderVideDocAjoutableNodeExpanded', 'true' ], [ 'document_properties:parapheurTree:3::parapheurFolderVideDocAjoutableNodeExpanded', 'true' ], [ 'document_properties:parapheurTree:input', 'document_properties:parapheurTree:1::parapheurFolderVideDocAjoutable' ], ['document_properties_SUBMIT', '1'], ['javax.faces.ViewState', extractJsfState(self.ftest.getBody())], ['SelectedNodeId', SelectedNodeId], ['SelectedNodeType', 'ParapheurFolder'], ['document_properties:j_id1787', 'document_properties:j_id1787'], ['ajaxSingle', 'document_properties:j_id1787']], description="AJAX : Ajouter document'") # ajout du fichier #print("### Upload du fichier : " + filepath) filename = os.path.basename(filepath) # rich face random uid upload_uid = str(random.random()) #Attention, ne pas descendre les parametres passés dans la string dans le tableau self.ftest.post( self.ftest.server_url + urlCourante + "?_richfaces_upload_uid=" + upload_uid + "&editFileForm:uploadParapheurFiles=editFileForm:uploadParapheurFiles&_richfaces_upload_file_indicator=true&AJAXREQUEST=editFileRegion", params=[ ['editFileForm:uploadParapheurFiles:file', Upload(filepath)], # adresse du fichier ['editFileForm_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ] ], description="AJAX : Upload du fichier") self.ftest.post( self.ftest.server_url + urlCourante, params=[['AJAXREQUEST', 'editFileRegion'], ['editFileForm:uploadParapheurFiles:file', ''], ['editFileForm_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ], ['ajaxSingle', 'editFileForm:uploadParapheurFiles'], [ 'editFileForm:uploadParapheurFiles', 'editFileForm:uploadParapheurFiles' ], ['AJAX:EVENTS_COUNT', '1']], description= "AJAX : Requete post-upload : Reaffichage de la boite de telechargement." ) idEditForm = extractToken(htmlPageOrigine, '\"editFileForm:j_id', '\"') self.ftest.post(self.ftest.server_url + urlCourante, params=[['AJAXREQUEST', 'editFileRegion'], ['editFileForm:uploadParapheurFiles:file', ''], ['editFileForm_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ], [ 'editFileForm:j_id' + idEditForm, 'editFileForm:j_id' + idEditForm ], ['AJAX:EVENTS_COUNT', '1']], description="AJAX prévalidation upload") #Validation de l'upload du fichier self.ftest.post( self.ftest.server_url + urlCourante, params=[['AJAXREQUEST', 'editFileRegion'], ['editFileForm:uploadParapheurFiles:file', ''], ['editFileForm_SUBMIT', '1'], [ 'javax.faces.ViewState', extractJsfState(self.ftest.getBody()) ], ['ajaxSingle', 'editFileForm:editFileButtonText'], [ 'editFileForm:editFileButtonText', 'editFileForm:editFileButtonText' ], ['AJAX:EVENTS_COUNT', '1']], description="AJAX : Validation definitive de l'upload") # les reponses AJAX ne permettent pas de savoir si le document a bien ete uploade # Verification que le dossier dispose bien d'un document ayant le nom de celui que l'on vient d'ajouter. # Attention, si on ajoute 2 documents avec le meme nom, un seul d'entre eux est bien uploade. self.ftest.assert_( '\'name\': \'' + filename + '\', \'type\': \'ParapheurFichier\'' in self.ftest.getBody()) return htmlPageOrigine