def _environment(self): os = self.configure.host_os device_info = ( self._driver.desired_capabilities.get("deviceName", "") if self.driver.is_mobile_platform else "Desktop" ) # If no host OS was set, check for mobile OS if os is None: logger.info("No OS set, checking for mobile OS...") if self._driver.is_mobile_app: os = self.driver.user_agent.os_name_with_major_version logger.info("Setting OS: " + os) else: logger.info("No mobile app detected. Using inferred environment") app_env = AppEnvironment( os, hosting_app=self.configure.host_app, display_size=self.configure.viewport_size, inferred=self._inferred_environment, device_info=device_info, ) return app_env
def _environment(self): os = self.configure.host_os # If no host OS was set, check for mobile OS. device_info = "Desktop" if os is None: logger.info("No OS set, checking for mobile OS...") # Since in Python Appium driver is the same for Android and iOS, # we need to use the desired capabilities to figure this out. if eyes_selenium_utils.is_mobile_app(self._driver): platform_name = self._driver.platform_name logger.info(platform_name + " detected") device_info = self._driver.desired_capabilities.get( "deviceModel", "") platform_version = self._driver.platform_version if platform_version is not None: # Notice that Python's "split" function's +limit+ is the the # maximum splits performed whereas in Ruby it is the maximum # number of elements in the result (which is why they are set # differently). major_version = platform_version.split(".", 1)[0] os = platform_name + " " + major_version else: os = platform_name logger.info("Setting OS: " + os) else: logger.info("No mobile OS detected.") app_env = AppEnvironment( os, hosting_app=self.configure.host_app, display_size=self.configure.viewport_size, inferred=self._inferred_environment, device_info=device_info, ) return app_env
def _environment(self): # type: () -> AppEnvironment app_env = AppEnvironment( display_size=self.render_status.device_size, inferred="useragent: {}".format(self.render_status.user_agent), device_info=self.device_name, ) return app_env
def _environment(self): # type: () -> AppEnvironment status = list(self._render_statuses.values())[0] app_env = AppEnvironment( os=self.configuration.host_os, hosting_app=self.configuration.host_app, display_size=status.device_size, inferred="useragent: {}".format(status.user_agent), device_info=self.device, ) return app_env
def _environment(self): # type: () -> Union[AppEnvironment, Text] try: app_env = AppEnvironment( display_size=self.render_status.device_size, inferred="useragent: {}".format(self.render_status.user_agent), device_info=self.device_name, ) except EyesError: logger.debug("RenderStatus is empty. Using JobInfo instead") return self.job_info.eyes_environment return app_env
def session_start_info(): return SessionStartInfo( agent_id="eyes.core.python/3.15.4", session_type=SessionType.SEQUENTIAL, app_id_or_name="TestApp", ver_id=None, scenario_id_or_name="TestName", batch_info=BatchInfo(), baseline_env_name="Baseline env name", environment_name="Env name", environment=AppEnvironment(), default_match_settings=ImageMatchSettings( match_level=MatchLevel.STRICT), branch_name="branch Name", parent_branch_name="parentBranchName", baseline_branch_name="baselineBranchName", save_diffs=True, render=False, properties=[], )
"defaultMatchSettings": {"matchLevel": "STRICT", "exact": null}, "verId": null, "branchName": null, "parentBranchName": null, "properties": [] }""" SESSION_START_INFO_OBJ = SessionStartInfo( agent_id="eyes.core.python/3.15.4", session_type=SessionType.SEQUENTIAL, app_id_or_name="TestApp", ver_id=None, scenario_id_or_name="TestName", batch_info=BatchInfo(), baseline_env_name="Baseline env name", environment_name="Env name", environment=AppEnvironment(), default_match_settings=ImageMatchSettings(match_level=MatchLevel.STRICT), branch_name="branch Name", parent_branch_name="parentBranchName", baseline_branch_name="baselineBranchName", save_diffs=True, render=False, properties=[], ) RUNNING_SESSION_DATA_RESPONSE_ID = "some id" RUNNING_SESSION_DATA_RESPONSE_URL = "http://some-session-url.com" RUNNING_SESSION_DATA_RESPONSE_SESSION_ID = "some session id" RUNNING_SESSION_DATA_RESPONSE_BATCH_ID = "other url" RUNNING_SESSION_DATA_RESPONSE_BASELINE_ID = "other url" RUNNING_SESSION_DATA_RESPONSE = """ {