class TimeSelector: hours_field = element(by.xpath('//input[@aria-label="Hour"]')) minute_field = element(by.xpath('//input[@aria-label="Minute"]')) second_field = element(by.xpath('//input[contains(@class,"flatpickr-second")]')) part_button = element(by.xpath('//span[@class="flatpickr-am-pm"]'))
class ResetPasswordPage(BasePage): password_field = element(by.id('password')) confirm_password_field = element(by.id('confirmPassword')) reset_password_button = element( by.xpath('//button[text()="Reset Password"]')) set_password_button = element(by.xpath('//button[text()="Save"]'))
class BasePage: url = '/' path = '' page_title = element(by.class_name('page-title')) loader = element(by.class_name('loader active')) def navigate(self): factory.get_shared_driver().get(f'{self.path}{self.url}') return self alert = element(by.xpath('//div[@role="alert"]'))
class Navbar(BasePage): dashboard_button = element( by.xpath('//a[child::span[text()="Dashboard"]]')) platform_management_button = element( by.xpath('//a[child::span[text()="Platform Management"]]')) virtual_workforce_button = element( by.xpath('//a[child::span[text()="Virtual Workforce"]]')) design_studio_button = element( by.xpath('//a[child::span[text()="Design Studio"]]')) automation_lifecycle_button = element( by.xpath('//a[child::span[text()="Automation Lifecycle"]]')) queue_management_button = element( by.xpath('//a[child::span[text()="Queue Management"]]')) self_serve_button = element( by.xpath('//a[child::span[text()="Self-Serve"]]')) cognitive_services_button = element( by.xpath('//a[child::span[text()="Cognitive Services"]]')) platform_builder_button = element( by.xpath('//a[child::span[text()="Platform Builder"]]')) class PlatformManagement(BaseEnum): VIRTUAL_WORKER_SETTINGS = 'Virtual Worker Settings' LICENSE_MANAGER = 'License Manager' @property def get_option(self): Navbar.platform_management_button.click() return self._get() class VirtualWorkforce(BaseEnum): UTILIZATION = 'Utilization' LIVE_SESSIONS = 'Live Sessions' PERFORMANCE = 'Performance' LIVE_ACCESS = 'Live Access' @property def get_option(self): Navbar.virtual_workforce_button.click() return self._get() class DesignStudio(BaseEnum): WIREFRAMER = 'Wireframer' PROCESS_OBJECT_EXPLORER = 'Process/Object Explorer' ENVIRONMENT_DATA_ITEMS = 'Environment Data Items' ENVIRONMENT_LOCKS = 'Environment Locks' @property def get_option(self): Navbar.design_studio_button.click() return self._get() class AutomationLifecycle(BaseEnum): BUSINESS_PROCESSES = 'Business Processes' APPLICATIONS = 'Applications' PROCESS_DEFINITIONS = 'Process Definitions' EXCEPTIONS = 'Exceptions' @property def get_option(self): Navbar.automation_lifecycle_button.click() return self._get() class QueueManagement(BaseEnum): QUEUES_OVERVIEW = 'Queues Overview' QUEUES_MANAGER = 'Queues Manager' QUEUES_ANALYZER = 'Queues Analyzer' @property def get_option(self): Navbar.queue_management_button.click() return self._get() class SelfServe(BaseEnum): FORMS = 'Forms' @property def get_option(self): Navbar.self_serve_button.click() return self._get() class CognitiveServices(BaseEnum): NLU = 'NLU' @property def get_option(self): Navbar.cognitive_services_button.click() return self._get() class PlatformBuilder(BaseEnum): PLATFORM_BUILDER = 'Platform Builder' @property def get_option(self): Navbar.platform_builder_button.click() return element( by.xpath( f'//li/a[@href]/span[contains(text(), "{self.value}")]'))
def get_option(self): Navbar.platform_builder_button.click() return element( by.xpath( f'//li/a[@href]/span[contains(text(), "{self.value}")]'))
def get_date(date): return element(by.xpath(f'//div[@class="rc-calendar-date" and text()="{date}"]'))
class Calendar: @staticmethod def get_date(date): return element(by.xpath(f'//div[@class="rc-calendar-date" and text()="{date}"]')) ok_button = element(by.xpath('//a[contains(@class, "rc-calendar-ok-btn")]'))
class ForgotPasswordPage(BasePage): email_address_field = element(by.id('email')) send_email_button = element(by.xpath('//button[text()="Send Email"]'))
class SelectAppPage(BasePage, Header, Navbar): connect_icon = element(by.xpath('//div[text()="Connect"]')) ss_icon = element(by.xpath('//div[text()="Self-Serve"]'))
def _get(self): _element = element(by.xpath(f'//li/a/span[text()="{self.value}"]')) return scroll_into_view(_element)
def get_option(self): Header.gear_button.click() return scroll_into_view( element( by.xpath(f'//li/a/span[contains(text(),"{self.value}")]')))