class MyView(View): the_reference = Select(id='switchabletesting-select') the_switchable_widget = ConditionalSwitchableView( reference='the_reference') the_switchable_widget.register( 'foo', widget=Text('//h3[@id="switchabletesting-1"]')) the_switchable_widget.register( 'bar', widget=Text('//h3[@id="switchabletesting-2"]'))
class ImportTemplates(View): associate = Select(name='associate') branch = TextInput(name='branch') dirname = TextInput(name='dirname') filter = TextInput(name='filter') force_import = Checkbox(name='force') lock = Checkbox(name='lock') negate = Checkbox(name='negate') prefix = TextInput(name='prefix') repo = TextInput(name='repo')
class optional_input_validators(View): expander = Text(".//h2[contains(@data-target, '#optional_input_validators_')]") required = Checkbox(locator=".//input[contains(@name, '[required]') and @type!='hidden']") validator_type = Select(locator=".//select[contains(@name, '[validator_type]')]") validator_rule = TextInput(locator=".//input[contains(@name, '[validator_rule]')]") def __init__(self, parent, logger=None): View.__init__(self, parent, logger=logger) if 'collapsed' in self.browser.classes(self.expander): self.expander.click() self.browser.wait_for_element(self.validator_type, visible=True)
class JobTemplateForeignInputSetItem(GenericRemovableWidgetItem): """Job Template Foreign Input Set Item widget""" remove_button = Text(".//a[@class='remove_nested_fields']") target_template = Select( locator=".//select[contains(@name, '[target_template_id]')]") include_all = Checkbox( locator=".//input[contains(@id, 'include_all')]") include = TextInput( locator=".//input[contains(@name, '[include]')]") exclude = TextInput( locator=".//input[contains(@name, '[exclude]')]")
class CreateYumFilterView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='name') content_type = Select(id='type') inclusion_type = Select(id='inclusion') description = TextInput(id='description') save = Text('.//button[contains(@ng-click, "handleSave()")]') cancel = Text('.//button[@ng-click="handleCancel()"]') @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element( self.breadcrumb, exception=False) return ( breadcrumb_loaded and self.breadcrumb.locations[0] == 'Content Views' and self.breadcrumb.read() == 'Create Yum Filter' )
class ProductCreateView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='name') label = TextInput(id='label') gpg_key = Select(id='gpg_key_id') ssl_ca_cert = Select(id='ssl_ca_cert_id') ssl_client_cert = Select(id='ssl_client_cert_id') ssl_client_key = Select(id='ssl_client_key_id') sync_plan = Select(id='sync_plan_id') create_sync_plan = Text("//a[contains(@ng-click, 'openSyncPlanModal')]") description = TextInput(id='description') submit = Text("//button[contains(@ng-click, 'handleSave')]") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Products' and self.breadcrumb.read() == 'New Product')
class affected_repositories(AffectedRepositoriesTab): filter_toggle = RadioGroup(".//div[@class='col-sm-8']") product_filter = Select(locator=".//select[@ng-model='product']") searchbox = TextInput(locator=".//input[@ng-model='repositorySearch']") update_repositories = Button('Update Repositories') select_all = Checkbox( locator=".//table//th[@class='row-select']/input") table = SatTable( locator='.//table', column_widgets={0: Checkbox(locator=".//input[@type='checkbox']")}, )
class ContentCredentialCreateView(BaseLoggedInView): name = TextInput(id='name') content_type = Select(id='content_type') content = TextInput(name='content') upload_file = FileInput(name='file_path') submit = Text("//button[contains(@ng-click, 'handleSave')]") @property def is_displayed(self): return self.browser.wait_for_element(self.name, exception=False) is not None
class NetworkRouterAddInterfaceView(BaseLoggedInPage): """ Represents Add Interface to Network Router page """ flash = FlashMessages( './/div[@id="flash_msg_div"]/div[@id="flash_text_div" or ' 'contains(@class, "flash_text_div")]') subnet_name = Select(id='cloud_subnet_id') add = Button('Add') @property def is_displayed(self): return False
class options(Tab): # noqa default_text_box = Input(name='default_value') field_required = DialogBootstrapSwitch(label='Required') default_value = DialogBootstrapSwitch(label='Default value') field_required = DialogBootstrapSwitch(label='Required') field_past_dates = DialogBootstrapSwitch(label='Show Past Dates') field_category = Select( locator='.//select[../../../../label[normalize-space(text())="Category"]]') validation = Input(name='validator_rule') visible = DialogBootstrapSwitch(label='Visible')
class SyncPlanCreateView(BaseLoggedInView): name = TextInput(id='name') description = TextInput(id='description') interval = Select(id='interval') date_time = DateTime() submit = Text("//button[contains(@ng-click, 'handleSave')]") @property def is_displayed(self): return self.browser.wait_for_element(self.name, exception=False) is not None
class instance_properties(View): # noqa table = Table('.//div[contains(@class, "container-fluid")]/table') edit_instance_properties = Text( locator='.//button/span[contains(@class, "pficon-edit")]') select_security_group = Select(locator='.//td[5]/select') select_flavor = Select(locator='.//td[6]/select') save_properties = Text( locator='.//div[contains(@class, "inline-edit-buttons")]' '/button[contains(@aria-label, "Save")]') @property def is_displayed(self): return (self.table.is_displayed and (len( self.browser.elements(".//div[contains(@class,'spinner')]")) == 0)) def fill(self, values): """ This is required only for OSP and only if we want to edit osp_security_group or osp_flavor otherwise not needed. If none them is to be edited only next needs to be clicked. Args: values: """ was_change = True osp_security_group = values.get('osp_security_group') osp_flavor = values.get('osp_flavor') if osp_security_group or osp_flavor: self.edit_instance_properties.click() self.select_security_group.wait_displayed() if osp_security_group: self.select_security_group.fill(osp_security_group) if osp_flavor: self.select_flavor.fill(osp_flavor) self.save_properties.click() self.after_fill(was_change) return was_change def after_fill(self, was_change): self.parent.next_btn.click()
class VMwareProviderForm(View): vcenter = TextInput(id='compute_resource_server') user = TextInput(id='compute_resource_user') password = TextInput(id='compute_resource_password') display_type = Select(id='compute_resource_display_type') vnc_console_passwords = Checkbox( id='compute_resource_set_console_password') enable_caching = Checkbox(id='compute_resource_caching_enabled') load_datacenters = Text("//*[contains(@id,'test_connection_button')]") def after_fill(self, was_change): self.load_datacenters.click()
class Navbar(View): """ Navigation bar on top of every page except the login page. usermanagement is only available to admins """ ROOT = ".//nav[contains(@class,'navbar-pf-contextselector tendrl-header-container')]" title = Text(".//a[@class='navbar-brand']") clusters = Select(".//select[contains(@ng-change, 'goToClusterPage')]") modal = NavDropdown(".//button[@id='aboutModalDropdown']/parent::li") usermanagement = NavDropdown(".//a[@id='usermanagement']/parent::li") alerts = NavDropdown(".//a[@id='notifications']/parent::li") usermenu = NavDropdown(".//a[@id='usermenu']/parent::li")
class FlavorAddForm(View): """ Represents Add Flavor page """ provider = Select(name='ems_id') flavor_name = TextInput(name='name') ram_size = TextInput(name='ram') vcpus = TextInput(name='vcpus') disk_size = TextInput(name='disk') swap_size = TextInput(name='swap') rxtx_factor = TextInput(name='rxtx_factor') public = BootstrapSwitch(name='is_public') add = Button('Add') cancel = Button('Cancel')
class FileRepository(View): upstream_url = TextInput(id='url') verify_ssl = Checkbox(id='verify_ssl_on_sync') upstream_username = TextInput(id='upstream_username') upstream_password = TextInput(id='upstream_password') publish_via_http = Checkbox(id='unprotected') http_proxy_policy = Select(id="http_proxy_policy") proxy_policy = ConditionalSwitchableView(reference='http_proxy_policy') @proxy_policy.register('Use specific HTTP Proxy') class SpecificHttpProxy(View): http_proxy = Select(id="http_proxy")
class HostsChangeEnvironment(BaseLoggedInView): title = Text("//h4[text()='Change Environment - The" " following hosts are about to be changed']") table = SatTable("//div[@class='modal-body']//table") keep_selected = Checkbox(id='keep_selected') environment = Select(id='environment_id') submit = Text('//button[@onclick="submit_modal_form()"]') @property def is_displayed(self): return self.browser.wait_for_element(self.title, exception=False) is not None
class ActivationKeyCreateView(BaseLoggedInView): name = TextInput(id='name') hosts_limit = LimitInput() description = TextInput(id='description') lce = LCESelector() content_view = Select(id='content_view_id') submit = Text("//button[contains(@ng-click, 'handleSave')]") @property def is_displayed(self): return self.browser.wait_for_element(self.name, exception=False) is not None
class MyView(View): the_reference = Select(id="switchabletesting-select") the_switchable_view = ConditionalSwitchableView( reference="the_reference") @the_switchable_view.register("foo") class FooView(View): widget = Text('//h3[@id="switchabletesting-1"]') @the_switchable_view.register("bar") class BarView(View): widget = Text('//h3[@id="switchabletesting-2"]')
class MyView(View): the_reference = Select(id="ewaopaopsdkgnjdsopjf") the_switchable_view = ConditionalSwitchableView( reference="the_reference") @the_switchable_view.register("foo") class FooView(View): widget = Text('//h3[@id="switchabletesting-1"]') @the_switchable_view.register("bar", default=True) class BarView(View): widget = Text('//h3[@id="switchabletesting-2"]')
class MyView(View): the_reference = Select(id='switchabletesting-select') the_switchable_view = ConditionalSwitchableView( reference='the_reference') @the_switchable_view.register('foo') class FooView(View): widget = Text('//h3[@id="switchabletesting-1"]') @the_switchable_view.register('bar') class BarView(View): widget = Text('//h3[@id="switchabletesting-2"]')
class MyView(View): the_reference = Select(id='ewaopaopsdkgnjdsopjf') the_switchable_view = ConditionalSwitchableView( reference='the_reference') @the_switchable_view.register('foo') class FooView(View): widget = Text('//h3[@id="switchabletesting-1"]') @the_switchable_view.register('bar', default=True) class BarView(View): widget = Text('//h3[@id="switchabletesting-2"]')
class options(PotentiallyInvisibleTab): # noqa form = ConditionalSwitchableView(reference="type") type = BootstrapSelect("button_type") @form.register("Default") class ButtonFormDefaultView(View): # noqa dialog = BootstrapSelect("dialog_id") @form.register("Ansible Playbook") class ButtonFormAnsibleView(View): # noqa playbook_cat_item = BootstrapSelect("service_template_id") inventory = AutomateRadioGroup(locator=".//input[@name='inventory']/..") hosts = Input(name="hosts") text = Input(name="name") display = Checkbox(name="display") hover = Input(name="description") image = FonticonPicker("button_icon") icon_color = ColourInput(id="button_color") open_url = Checkbox("open_url") display_for = Select(id="display_for") submit = Select(id="submit_how")
class foreign_input(View): ROOT = "//div[contains(@class, 'foreign_input')]" \ "/following-sibling::div[1]" target_template = Select( locator=".//select[contains(@name, '[target_template_id]')]") include_all = Checkbox( locator=".//input[contains(@id, 'include_all')]") include = TextInput( locator=".//input[contains(@name, '[include]')]") exclude = TextInput( locator=".//input[contains(@name, '[exclude]')]") def before_fill(self, values=None): self.parent.add_foreign_input_set.click()
class ActivationKeyDetailsView(BaseLoggedInView): name = TextInput(id='name') description = TextInput(id='description') unlimited_hosts = Checkbox(name='limit') max_hosts = TextInput(id='max_hosts') submit = Text("//button[contains(@ng-click, 'handleSave')]") lce = LCESelector() content_view = Select(id='content_view_id') @property def is_displayed(self): return self.browser.wait_for_element(self.name, exception=False) is not None
class ControlImportExportView(BaseLoggedInPage): upload_button = InputButton("commit") export_button = Button("Export") commit_button = Button("Commit") upload_file = Input("upload[file]") export = BootstrapSelect("dbtype") policy_profiles = Select(id="choices_chosen_") @property def is_displayed(self): return (self.logged_in_as_current_user and self.navigation.currently_selected == ["Control", "Import / Export"])
class ProductManageHttpProxy(BaseLoggedInView): """Represents Http Proxy Management page for Products.""" title = Text("//h4[text()='Http Proxy Management']") http_proxy_policy = Select(id="http_proxy_policy") proxy_policy = ConditionalSwitchableView(reference='http_proxy_policy') update = Text('//button[@ng-click="update()"]') @proxy_policy.register('Use specific HTTP Proxy') class ExistingProductForm(View): http_proxy = Select(id="http_proxy") @property def is_displayed(self): return self.browser.wait_for_element(self.title, exception=False) is not None
class options(WaitTab): # noqa default_text_box = Input(name='default_value') entry_point = EntryPoint(locator="//input[@class='form-control']", tree_id="treeview-tree-selector") field_required = DialogBootstrapSwitch(label='Required') default_value = DialogBootstrapSwitch(label='Default value') field_required = DialogBootstrapSwitch(label='Required') field_past_dates = DialogBootstrapSwitch(label='Show Past Dates') field_category = Select( locator= './/select[../../../../label[normalize-space(text())="Category"]]') validation_switch = DialogBootstrapSwitch(label='Validation') validation = Input(name='validator_rule') visible = DialogBootstrapSwitch(label='Visible')
class ContentCredentialCreateView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(id='name') content_type = Select(id='content_type') content = TextInput(name='content') upload_file = FileInput(name='file_path') submit = Text("//button[contains(@ng-click, 'handleSave')]") @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Content Credential' and self.breadcrumb.read() == 'New Content Credential')
class ImportExportWidgetsView(CloudIntelReportsView): title = Text("#explorer_title_text") subtitle = Text(locator=".//div[@id='main_div']/h2") upload_file = FileInput(id="upload_file") upload_button = InputButton("commit") items_for_export = Select(id="widgets_") export_button = Button(value="Export") @property def is_displayed(self): return (self.in_intel_reports and self.title.text == "Import / Export" and self.subtitle.text == "Widgets" and self.import_export.tree.currently_selected == ["Import / Export", "Widgets"])