def fill_oid_field(self, i, oid): oid_field = Input(self, "oid__{}".format(i)) return oid_field.fill(oid)
class BoxForm(AddTabView): box_label = Input(id='label') box_desc = Input(name="description") save_button = DialogButton('Save') cancel_button = DialogButton('Cancel')
class ntp_servers(View): # noqa """ Class represents Server VWware Console Support Form """ ntp_server_1 = Input(name="ntp_server_1") ntp_server_2 = Input(name="ntp_server_2") ntp_server_3 = Input(name="ntp_server_3")
class ButtonFormAnsibleView(View): # noqa playbook_cat_item = BootstrapSelect('service_template_id') inventory = AutomateRadioGroup( locator=".//input[@name='inventory']/..") hosts = Input(name='hosts')
class CredentialFormView(CredentialsBaseView): name = Input(name="name") credential_form = ConditionalSwitchableView(reference="credential_type") @credential_form.register("<Choose>", default=True) class CredentialFormDefaultView(View): pass @credential_form.register("Machine") class CredentialFormMachineView(View): username = Input( locator='.//input[@title="Username for this credential"]') password = Input( locator= './/input[@title="Password for this credential" and "not @disabled"]' ) private_key = TextInput( locator= './/textarea[@title="RSA or DSA private key to be used instead of password"' 'and "not @disabled"]') private_key_phrase = Input( locator= './/input[@title="Passphrase to unlock SSH private key if encrypted"' 'and "not @disabled"]') privilage_escalation = BootstrapSelect("{{name}}") privilage_escalation_username = Input( locator='.//input[@title="Privilege escalation username"]') privilage_escalation_password = Input( locator='.//input[@title="Password for privilege escalation method"' 'and "not @disabled"]') @credential_form.register("Scm") class CredentialFormScmView(View): username = Input( locator='.//input[@title="Username for this credential"]') password = Input( locator= './/input[@title="Password for this credential" and "not @disabled"]' ) private_key = TextInput( locator= './/textarea[@title="RSA or DSA private key to be used instead of password"' 'and "not @disabled"]') private_key_phrase = Input( locator= './/input[@title="Passphrase to unlock SSH private key if encrypted"' 'and "not @disabled"]') @credential_form.register("Vault") class CredentialFormVaultView(View): vault_password = Input( locator='.//input[@title="Vault password" and "not @disabled"]') @credential_form.register("Amazon") class CredentialFormAmazonView(View): access_key = Input( locator='.//input[@title="AWS Access Key for this credential"]') secret_key = Input( locator= './/input[@title="AWS Secret Key for this credential" and "not @disabled"]' ) sts_token = Input( locator= './/input[@title="Security Token Service(STS) Token for this credential"' 'and "not @disabled"]') @credential_form.register("VMware") class CredentialFormVMwareView(View): username = Input( locator='.//input[@title="Username for this credential"]') password = Input( locator= './/input[@title="Password for this credential" and "not @disabled"]' ) vcenter_host = Input( locator= './/input[@title="The hostname or IP address of the vCenter Host"]' ) @credential_form.register("OpenStack") class CredentialFormOpenStackView(View): username = Input( locator= './/input[@title="The username to use to connect to OpenStack"]') password = Input( locator='.//input[@title="The password or API' ' key to use to connect to OpenStack" and "not @disabled"]') authentication_url = Input( locator='.//input[@title="The host to authenticate with. ' 'For example, https://openstack.business.com/v2.0"]') project = Input( locator='.//input[@title="This is the tenant name. This value ' 'is usually the same as the username"]') domain = Input( locator='.//input[@title="OpenStack domains define administrative ' 'boundaries. It is only needed for Keystone v3 authentication URLs"]' ) @credential_form.register("Red Hat Virtualization") class CredentialFormRHVView(View): username = Input( locator='.//input[@title="Username for this credential"]') password = Input( locator= './/input[@title="Password for this credential" and "not @disabled"]' ) host = Input( locator='.//input[@title="The host to authenticate with"]') @credential_form.register("Google Compute Engine") class CredentialFormGCEView(View): service_account = Input( locator='.//input[@title="The email address assigned to ' 'the Google Compute Engine service account"]') priv_key = TextInput( locator= './/textarea[@title="Contents of the PEM file associated with ' 'the service account email"]') project = Input( locator='.//input[@title="The GCE assigned identification. It is ' "constructed as two words followed by a three digit number, such as: " 'squeamish-ossifrage-123"]') @credential_form.register("Azure") class CredentialFormAzureView(View): username = Input( locator='.//input[@title="The username to use to connect to the ' 'Microsoft Azure account"]') password = Input( locator='.//input[@title="The password to use to connect to the ' 'Microsoft Azure account"]') subscription_id = Input( locator= './/input[@title="The Subscription UUID for the Microsoft Azure account"]' ) tenant_id = Input( locator= './/input[@title="The Tenant ID for the Microsoft Azure account"]') client_secret = Input( locator= './/input[@title="The Client Secret for the Microsoft Azure account"]' ) client_id = Input( locator= './/input[@title="The Client ID for the Microsoft Azure account"]') @credential_form.register("Network") class CredentialFormNetworkView(View): username = Input( locator='.//input[@title="Username for this credential"]') password = Input( locator='.//input[@title="Password for this credential"]') authorize = Input( locator='.//input[@title="Whether to use the authorize mechanism"]' ) authorize_password = Input( locator= './/input[@title="Password used by the authorize mechanism"]') ssh_key = TextInput( locator= './/textarea[@title="RSA or DSA private key to be used instead of password"' 'and "not @disabled"]') private_key_phrase = Input( locator= './/input[@title="Passphrase to unlock SSH private key if encrypted"' 'and "not @disabled"]') cancel_button = Button("Cancel")
class enablement(View): # noqa title = Text('//*[@id="ab_form"]/div[1]/h3') define_exp = Text( locator='//*[@id="form_enablement_expression_div"]//a/button') expression = ExpressionEditor() disabled_text = Input(id="disabled_text")
class ButtonParameterForm(ParametersForm): type_class = Input(locator='.//input[contains(@class, "ng-empty") and contains(@id, "Value")]') add = Button('Add Attribute/Value Pair')
class default(Tab, DefaultEndpointForm, BeforeFillMixin): # NOQA TAB_NAME = 'Default' api_port = Input('default_api_port') verify_tls = BootstrapSwitch(id='default_tls_verify') ca_certs = Input('default_tls_ca_certs')
class TenantEditForm(View): """The form on the Edit page""" name = Input('name') save_button = Button('Save') reset_button = Button('Reset') cancel_button = Button('Cancel')
class SCVMMEndpointForm(DefaultEndpointForm): security_protocol = BootstrapSelect(id='default_security_protocol') realm = Input( 'realm') # appears when Kerberos is chosen in security_protocol
class inventory(View): # noqa localhost = Checkbox(id="inventory_localhost") target_machine = Checkbox(id="inventory_event_target") specific_hosts = Checkbox(id="inventory_manual") hosts = Input(name="hosts")
class CredentialFormVaultView(View): vault_password = Input(locator='.//input[@title="Vault password"][2]')
class ServiceEditForm(MyServicesView): title = Text('#explorer_title_text') name = Input(name='name') description = Input(name='description')
class tag_form_view(View): # noqa type = BootstrapSelect("chosen_typ") tag = BootstrapSelect("chosen_tag") value = BootstrapSelect("chosen_value") user_input = Input(name="user_input")
class count_form_view(View): # noqa type = BootstrapSelect("chosen_typ") count = BootstrapSelect("chosen_count") key = BootstrapSelect("chosen_key") value = Input(name="chosen_value") user_input = Input(name="user_input")
class advanced(Tab): # noqa TAB_NAME = 'Advanced' system_process = BootstrapSelect('instance_name') request = Input(name='object_request')
class CustomReportFormCommon(CloudIntelReportsView): report_title = Text("#explorer_title_text") menu_name = Input("name") title = Input("title") base_report_on = BootstrapSelect("chosen_model") report_fields = ReportsMultiBoxSelect( move_into="Move selected fields down", move_from="Move selected fields up", available_items="available_fields", chosen_items="selected_fields") cancel_after = BootstrapSelect("chosen_queue_timeout") @View.nested class consolidation(WaitTab): # noqa column1 = BootstrapSelect("chosen_pivot1") column2 = BootstrapSelect("chosen_pivot2") column3 = BootstrapSelect("chosen_pivot3") @View.nested class formatting(WaitTab): # noqa page_size = BootstrapSelect("pdf_page_size") @View.nested class styling(WaitTab): # noqa pass @View.nested class filter(WaitTab): # noqa filter_show_costs = BootstrapSelect("cb_show_typ") filter_owner = BootstrapSelect("cb_owner_id") filter_provider = BootstrapSelect("cb_provider_id") filter_project = BootstrapSelect("cb_entity_id") filter_tag_cat = BootstrapSelect("cb_tag_cat") filter_tag_value = BootstrapSelect("cb_tag_value") interval = BootstrapSelect("cb_interval") interval_size = BootstrapSelect("cb_interval_size") interval_end = BootstrapSelect("cb_end_interval_offset") primary_filter = ExpressionEditor() secondary_filter = ExpressionEditor() @View.nested class summary(WaitTab): # noqa sort_by = BootstrapSelect("chosen_sort1") sort_order = BootstrapSelect("sort_order") show_breaks = BootstrapSelect("sort_group") sort_by_2 = BootstrapSelect("chosen_sort2") row_limit = BootstrapSelect("row_limit") @View.nested class charts(WaitTab): # noqa chart_type = BootstrapSelect("chosen_graph") chart_mode = BootstrapSelect("chart_mode") values_to_show = BootstrapSelect("chosen_count") sum_other_values = Checkbox("chosen_other") @View.nested class timeline(WaitTab): # noqa based_on = BootstrapSelect("chosen_tl") position = BootstrapSelect("chosen_position") cancel_button = Button("Cancel")
class BoxForm(AddTabView): box_label = Input(name='group_label') box_desc = Input(name="group_description")
class ServiceEditForm(MyServicesView): title = Text(locator='//li[@class="active"]') name = Input(name='name') description = Input(name='description')
class TabForm(AddDialogView): tab_label = Input(name='tab_label') tab_desc = Input(name="tab_description")
class LoginPage(View): flash = FlashMessages('div#flash_text_div') class details(View): # noqa region = Text('.//p[normalize-space(text())="Region:"]/span') zone = Text('.//p[normalize-space(text())="Zone:"]/span') appliance = Text('.//p[normalize-space(text())="Appliance:"]/span') change_password = Text('.//a[normalize-space(.)="Update password"]') back = Text('.//a[normalize-space(.)="Back"]') username = Input(name='user_name') password = Input(name='user_password') new_password = Input(name='user_new_password') verify_password = Input(name='user_verify_password') login = Button('Login') def show_update_password(self): if not self.new_password.is_displayed: self.change_password.click() def hide_update_password(self): if self.new_password.is_displayed: self.back.click() def login_admin(self, **kwargs): username = conf.credentials['default']['username'] password = conf.credentials['default']['password'] cred = Credential(principal=username, secret=password) from cfme.configure.access_control import User user = User(credential=cred, name='Administrator') return self.log_in(user, **kwargs) def submit_login(self, method='click_on_login'): if method == 'click_on_login': self.login.click() elif method == 'press_enter_after_password': self.browser.send_keys(Keys.ENTER, self.password) elif method == '_js_auth_fn': self.browser.execute_script('miqAjaxAuth();') else: raise ValueError('Unknown method {}'.format(method)) if self.flash.is_displayed: self.flash.assert_no_error() def log_in(self, user, method='click_on_login'): self.fill({ 'username': user.credential.principal, 'password': user.credential.secret, }) self.submit_login(method) logged_in_view = self.browser.create_view(BaseLoggedInPage) if logged_in_view.logged_in and user.name is None: name = logged_in_view.current_fullname self.logger.info( 'setting the appliance.user.name to %r because it was not specified', name) user.name = name self.extra.appliance.user = user def update_password(self, username, password, new_password, verify_password=None, method='click_on_login'): self.show_update_password() self.fill({ 'username': username, 'password': password, 'new_password': new_password, 'verify_password': verify_password if verify_password is not None else new_password }) self.submit_login(method) def logged_in_as_user(self, user): return False @property def logged_in_as_current_user(self): return False @property def current_username(self): return None @property def current_fullname(self): return None @property def logged_in(self): return not self.logged_out @property def logged_out(self): return self.username.is_displayed and self.password.is_displayed and self.login.is_displayed @property def is_displayed(self): return self.logged_out
class default(Tab, DefaultEndpointForm, BeforeFillMixin): # NOQA TAB_NAME = 'Default' sec_protocol = BootstrapSelect('default_security_protocol') trusted_ca_certificates = TextInput('default_tls_ca_certs') api_port = Input('default_api_port')
class CredentialFormVaultView(View): vault_password = Input( locator='.//input[@title="Vault password" and "not @disabled"]')
class virtualization(Tab, BeforeFillMixin): # NOQA TAB_NAME = 'Virtualization' kubevirt_token = Input('kubevirt_password') validate = Button('Validate')
class TabForm(AddDialogView): tab_label = Input(id='label') tab_desc = Input(name="description") save_button = DialogButton('Save') cancel_button = DialogButton('Cancel')
class DialogForm(ServicesCatalogView): title = Text('#explorer_title_text') name = VersionPicker({ "5.11": Input(name='label'), LOWEST: Input(name='dialog_name') })
class custom_support_url(View): # noqa """ Class represents Server Custom Support URL Form """ url = Input(name='custom_support_url') description = Input(name='custom_support_url_description')
class registry_form_view(View): # noqa type = BootstrapSelect("chosen_typ") key = Input(name="chosen_regkey") value = Input(name="chosen_regval") operation = BootstrapSelect("chosen_key") contents = Input(name="chosen_value")
class default(WaitTab, DefaultEndpointForm, BeforeFillMixin): # NOQA TAB_NAME = 'Default' security_protocol = BootstrapSelect('default_security_protocol') api_port = Input('default_api_port')
class field_form_view(View): # noqa type = BootstrapSelect("chosen_typ") field = BootstrapSelect("chosen_field") key = BootstrapSelect("chosen_key") value = Input(name="chosen_value") user_input = Checkbox(name="user_input")
def fill_value_field(self, i, value): value_field = Input(self, "value__{}".format(i)) return value_field.fill(value)
class rsa_keypair(WaitTab, BeforeFillMixin): # NOQA TAB_NAME = 'RSA key pair' username = Input('ssh_keypair_userid') private_key = FileInput(locator='.//input[@id="ssh_keypair_password"]') change_key = Text(locator='.//a[normalize-space(.)="Change stored private key"]')