class fields(ParametrizedView): # noqa PARAMETERS = ('name', ) ROOT = ParametrizedLocator( './/tr[./td[contains(normalize-space(.), {name|quote})]]') @cached_property def row_id(self): attr = self.browser.get_attribute( 'id', './td/select[starts-with(@id, "per_time_")]', parent=self) return int(attr.rsplit('_', 1)[-1]) @cached_property def sub_row_id(self): attr = self.browser.get_attribute( 'id', './td/input[starts-with(@id, "fixed_rate_")]', parent=self) return int(attr.rsplit('_', 1)[-1]) per_time = Select(id=ParametrizedString('per_time_{@row_id}')) per_unit = Select(id=ParametrizedString('per_unit_{@row_id}')) start = Input(id=ParametrizedString('start_{@row_id}_{@sub_row_id}')) finish = Input(id=ParametrizedString('finish_{@row_id}_{@sub_row_id}')) fixed_rate = Input( id=ParametrizedString('fixed_rate_{@row_id}_{@sub_row_id}')) variable_rate = Input( id=ParametrizedString('variable_rate_{@row_id}_{@sub_row_id}')) action_add = Button(title='Add a new tier') action_delete = Button(title='Remove the tier')
class AddComputeChargebackView(RatesView): EXPECTED_TITLE = 'Compute Chargeback Rates' title = Text('#explorer_title_text') description = Input(id='description') currency = VersionPicker({ LOWEST: Select(id='currency'), '5.10': BootstrapSelect(id='currency') }) @ParametrizedView.nested class fields(ParametrizedView): # noqa PARAMETERS = ('name', ) ROOT = ParametrizedLocator( './/tr[./td[contains(normalize-space(.), {name|quote})]]') @cached_property def row_id(self): dom_attr = self.browser.get_attribute( 'id', './td/select[starts-with(@id, "per_time_")]', parent=self) return int(dom_attr.rsplit('_', 1)[-1]) @cached_property def sub_row_id(self): dom_attr = self.browser.get_attribute( 'id', './td/input[starts-with(@id, "fixed_rate_")]', parent=self) return int(dom_attr.rsplit('_', 1)[-1]) per_time = Select(id=ParametrizedString('per_time_{@row_id}')) per_unit = Select(id=ParametrizedString('per_unit_{@row_id}')) start = Input(id=ParametrizedString('start_{@row_id}_{@sub_row_id}')) finish = Input(id=ParametrizedString('finish_{@row_id}_{@sub_row_id}')) fixed_rate = Input( id=ParametrizedString('fixed_rate_{@row_id}_{@sub_row_id}')) variable_rate = Input( id=ParametrizedString('variable_rate_{@row_id}_{@sub_row_id}')) action_add = Button(title='Add a new tier') action_delete = Button(title='Remove the tier') add_button = Button(title='Add') cancel_button = Button(title='Cancel') @property def is_displayed(self): result = (self.title.text == self.EXPECTED_TITLE and self.cancel_button.is_displayed and self.description.is_displayed and self.currency.is_displayed) return result
class AddComputeChargebackView(RatesView): title = Text('#explorer_title_text') description = Input(id='description') currency = Select(id='currency') @ParametrizedView.nested class fields(ParametrizedView): # noqa PARAMETERS = ('name', ) ROOT = ParametrizedLocator( './/tr[./td[contains(normalize-space(.), {name|quote})]]') @cached_property def row_id(self): attr = self.browser.get_attribute( 'id', './td/select[starts-with(@id, "per_time_")]', parent=self) return int(attr.rsplit('_', 1)[-1]) @cached_property def sub_row_id(self): attr = self.browser.get_attribute( 'id', './td/input[starts-with(@id, "fixed_rate_")]', parent=self) return int(attr.rsplit('_', 1)[-1]) per_time = Select(id=ParametrizedString('per_time_{@row_id}')) per_unit = Select(id=ParametrizedString('per_unit_{@row_id}')) start = Input(id=ParametrizedString('start_{@row_id}_{@sub_row_id}')) finish = Input(id=ParametrizedString('finish_{@row_id}_{@sub_row_id}')) fixed_rate = Input( id=ParametrizedString('fixed_rate_{@row_id}_{@sub_row_id}')) variable_rate = Input( id=ParametrizedString('variable_rate_{@row_id}_{@sub_row_id}')) action_add = Button(title='Add a new tier') action_delete = Button(title='Remove the tier') add_button = Button(title='Add') cancel_button = Button(title='Cancel') is_displayed = displayed_not_implemented
class form(View): # noqa ip = Select(name='floating_ip') submit_button = Button('Submit') cancel_button = Button('Cancel')
class form(View): # noqa flavor = Select(name='flavor_id') submit_button = Button('Submit') cancel_button = Button('Cancel')