diff --git a/CHANGELOG.md b/CHANGELOG.md index 58da28c..dabee22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.0] - 2025-03-17 + +### Added + +- Skip cases of type "Boligselskab" where there are inhabitants on the address + +### Fixed + +- Added wait time to from_date element + ## [1.0.1] - 2025-02-07 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index b630272..2e2e7be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "robot_framework" -version = "1.0.1" +version = "1.1.0" authors = [ { name="ITK Development", email="itk-rpa@mkb.aarhus.dk" }, ] diff --git a/robot_framework/process.py b/robot_framework/process.py index e3e7815..3e14657 100644 --- a/robot_framework/process.py +++ b/robot_framework/process.py @@ -5,6 +5,8 @@ from selenium import webdriver from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC from OpenOrchestrator.orchestrator_connection.connection import OrchestratorConnection, QueueStatus from itk_dev_shared_components.eflyt import eflyt_login, eflyt_search, eflyt_case from itk_dev_shared_components.eflyt.eflyt_case import Case @@ -24,7 +26,7 @@ def process(orchestrator_connection: OrchestratorConnection) -> None: for case in cases: queue_element = orchestrator_connection.create_queue_element(config.QUEUE_NAME, reference=case.case_number) eflyt_search.open_case(browser, case.case_number) - if handle_case(browser): + if handle_case(browser, case): orchestrator_connection.log_info(f"Case {case.case_number} approved.") orchestrator_connection.set_queue_element_status(queue_element.id, QueueStatus.DONE) @@ -55,7 +57,7 @@ def filter_cases(cases: list[Case]) -> list[Case]: return filtered_cases -def handle_case(browser: webdriver.Chrome) -> bool: +def handle_case(browser: webdriver.Chrome, case: Case) -> bool: """Check dates on each case, approve all cases where dates match. Args: @@ -64,13 +66,20 @@ def handle_case(browser: webdriver.Chrome) -> bool: Returns: Whether the case was approved or not """ + if "Boligselskab" in case.case_types and len(eflyt_case.get_beboere(browser)) != 0: + return False + + eflyt_case.change_tab(browser, 0) registered_date = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_GridViewMovingPersons_ctl02_lnkDateCPR").text vis_svar_element = browser.find_element(By.LINK_TEXT, "Vis svar") if vis_svar_element: vis_svar_element.click() else: return False - response_date = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_moPersonTab_txtFradato").get_attribute("value") + from_date_element = WebDriverWait(browser, 10).until( + EC.presence_of_element_located((By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_moPersonTab_txtFradato")) + ) + response_date = from_date_element.get_attribute("value") selection_table = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_moPersonTab_rdoEDSLogivartResponseType") request_match = False