def verify_instance_detail_page_loaded(self): if self.instance_name == None: instance_name_full = self.instance_id else: instance_name_full = self.instance_name + " (" + self.instance_id + ")" self.tester.wait_for_text_present_by_id( DetailPage(self)._detail_page_title_id, instance_name_full) self.tester.wait_for_element_present_by_css( DetailPage(self)._actions_menu_css)
def verify_asg_detail_page_loaded(self, asg_name): """ Waits for the asg detail page title to appear; waits for actions menu to become visible. Closes the next step modal. """ self.confirm_scaling_policy_modal() self.tester.wait_for_text_present_by_id( DetailPage(self)._detail_page_title_id, self._asg_detail_page_title.format(asg_name)) self.tester.wait_for_element_present_by_css( DetailPage(self)._actions_menu_css)
def verify_volume_detail_page_loaded(self, volume_id, volume_name): """ Waits for the volume detail page title to appear; waits for actions menu to become visible. """ if volume_name is None: volume_name_full = volume_id else: volume_name_full = volume_name + " (" + volume_id + ")" self.tester.wait_for_text_present_by_id(DetailPage(self)._detail_page_title_id, volume_name_full) self.tester.wait_for_element_present_by_css(DetailPage(self)._actions_menu_css)
def verify_snapshot_detail_page_loaded(self, snapshot_id, snapshot_name): """ Waits for the snapshot detail page title to appear; waits for actions menu to become visible. :param snapshot_id: :param snapshot_name: """ if snapshot_name is None: snapshot_name_full = snapshot_id else: snapshot_name_full = snapshot_name + " (" + snapshot_id + ")" self.tester.wait_for_text_present_by_id( DetailPage(self)._detail_page_title_id, snapshot_name_full) self.tester.wait_for_element_present_by_css( DetailPage(self)._actions_menu_css)
def change_capacity_on_detail_page(self, min_capacity=None, desired_capacity=None, max_capacity=None): if min_capacity is not None: self.tester.send_keys_by_id(self._min_capacity_field_id, min_capacity) self.tester.click_element_by_id( self._min_capacity_field_id) # Validation error workaround if max_capacity is not None: self.tester.send_keys_by_id(self._max_capacity_field_id, max_capacity) self.tester.click_element_by_id( self._max_capacity_field_id) # Validation error workaround if desired_capacity is not None: self.tester.send_keys_by_id(self._desired_capacity_field_id, desired_capacity) self.tester.click_element_by_id( self._desired_capacity_field_id) # Validation error workaround time.sleep(1) try: self.tester.click_element_by_id(self._save_changes_button_id) is_visible = self.tester.check_visibility_by_css( DetailPage(self)._notification_css) if not is_visible: print "Hitting enter on Save Changes button" self.tester.send_keys_by_id(self._save_changes_button_id, "\n", clear_field=False) except Exception, e: print "ERROR: Could not Save Changes" raise
def is_image_detail_page_loaded(self): title = str( self.tester.store_text_by_id( DetailPage(self)._detail_page_title_id)) if title.startswith(self._image_detail_page_title): return True else: return False
def get_snapshot_name_and_id(self, snapshot_name=None): name_and_id = str( self.tester.store_text_by_css( DetailPage(self)._resource_name_and_id_css)) if snapshot_name is None: snapshot_id = name_and_id[-13:] else: snapshot_id = name_and_id[-14:-1] return {'snapshot_name': snapshot_name, 'snapshot_id': snapshot_id}
def get_volume_name_and_id(self): name_and_id = str( self.tester.store_text_by_css( DetailPage(self)._resource_name_and_id_css)) if len(name_and_id) > 12: volume_id = name_and_id[-13:-1] volume_name = name_and_id[1:-15] else: volume_name = None volume_id = name_and_id return {'volume_name': volume_name, 'volume_id': volume_id}
def click_action_disassociate_ip_address(self): self.tester.click_element_by_css(DetailPage(self)._actions_menu_css) self.tester.click_element_by_id( self._disassociate_ip_address_action_menuitem_id)
def click_action_launch_more_like_this(self): self.tester.click_element_by_css(DetailPage(self)._actions_menu_css) self.tester.click_element_by_id( self._launch_more_like_this_action_menuitem_id)
def click_terminate_instance_action_item_from_detail_page(self): self.tester.click_element_by_css(DetailPage(self)._actions_menu_css) self.tester.click_element_by_id( self._terminate_instance_action_item_id)
def verify_action_menu_loaded(self): self.tester.wait_for_element_present_by_css( DetailPage(self)._actions_menu_css)
def get_image_id(self): image_id = self.tester.store_text_by_css( DetailPage(self)._resource_name_and_id_css) return image_id
def verify_image_detail_page_loaded(self): title = str( self.tester.store_text_by_id( DetailPage(self)._detail_page_title_id)) assert title.startswith(self._image_detail_page_title)