import pytest from selenium.webdriver.support.ui import WebDriverWait from tests.regression.auth import login_to_mco_application from tests.regression.config_reader import load_regression_config, should_run_flow from tests.step_actions import StepActions @pytest.mark.regression @pytest.mark.exchange @pytest.mark.matching @pytest.mark.mco def test_idas_mco_login(driver, test_context): config = load_regression_config() matching_config = config["exchange_matching"] mco_config = matching_config.get("portals", {}).get("mco", {}) if not should_run_flow("matching"): pytest.skip( f"Skipping MCO login because flow_scope is '{config['selected_flow']}'." ) if not mco_config.get("enabled", False): pytest.skip("MCO matching portal is disabled in config/runtime.json.") step = StepActions(driver, WebDriverWait(driver, 20), test_context) driver.get(config["portal_urls"]["mco"]) step.capture("open_mco_application") login_to_mco_application( driver, config["mco_login"].get("username"), config["mco_login"].get("password"), config["timing"], ) step.capture("mco_dashboard_loaded") print( "IDAS MCO login completed for " f"environment={config['portal_urls']['environment']}, " f"dashboard_url={driver.current_url}" )