Example #1
0
 def delete(self, source_index):
     """
     Delete the item with index source_index (based on vertical placement in page).
     """
     click_css(self, 'a.delete-button', source_index, require_notification=False)
     # Click the confirmation dialog button
     click_css(self, 'a.button.action-primary', 0)
Example #2
0
 def discard_changes(self):
     """
     Discards draft changes (which will then re-render the page).
     """
     click_css(self, 'a.action-discard', 0, require_notification=False)
     confirm_prompt(self)
     self.wait_for_ajax()
Example #3
0
 def discard_changes(self):
     """
     Discards draft changes (which will then re-render the page).
     """
     click_css(self, 'a.action-discard', 0, require_notification=False)
     confirm_prompt(self)
     self.wait_for_ajax()
 def set_select_value_and_save(self, label, value):
     """
     Sets the select with given label (display name) to the specified value, and presses Save.
     """
     elem = self.get_setting_element(label)
     select = Select(elem)
     select.select_by_value(value)
     click_css(self, 'a.action-save')
Example #5
0
    def add_discussion(self, menu_index):
        """
        Add a new instance of the discussion category.

        menu_index specifies which instance of the menus should be used (based on vertical
        placement within the page).
        """
        click_css(self, 'a>span.large-discussion-icon', menu_index)
 def set_content_and_save(self, content):
     """
     Types content into the html component.
     """
     self.q(css='.edit-xblock-modal .editor-modes .editor-button').click()
     editor = self.q(css=self._bounded_selector('.html-editor .mce-edit-area'))[0]
     ActionChains(self.browser).click(editor).\
         send_keys([Keys.CONTROL, 'a']).key_up(Keys.CONTROL).send_keys(content).perform()
     click_css(self, 'a.action-save')
 def set_content_and_save(self, content):
     """
     Types content into the html component.
     """
     self.q(css='.edit-xblock-modal .editor-modes .editor-button').click()
     editor = self.q(
         css=self._bounded_selector('.html-editor .mce-edit-area'))[0]
     ActionChains(self.browser).click(editor).\
         send_keys([Keys.CONTROL, 'a']).key_up(Keys.CONTROL).send_keys(content).perform()
     click_css(self, 'a.action-save')
Example #8
0
 def delete(self, source_index):
     """
     Delete the item with index source_index (based on vertical placement in page).
     Only visible items are counted in the source_index.
     The index of the first item is 0.
     """
     # Click the delete button
     click_css(self, 'a.delete-button', source_index, require_notification=False)
     # Click the confirmation dialog button
     confirm_prompt(self)
Example #9
0
 def delete(self, source_index):
     """
     Delete the item with index source_index (based on vertical placement in page).
     Only visible items are counted in the source_index.
     The index of the first item is 0.
     """
     # Click the delete button
     click_css(self, 'a.delete-button', source_index, require_notification=False)
     # Click the confirmation dialog button
     confirm_prompt(self)
 def set_field_value_and_save(self, label, value):
     """
     Sets the text field with given label (display name) to the specified value, and presses Save.
     """
     elem = self.get_setting_element(label)
     # Click in the field, delete the value there.
     action = ActionChains(self.browser).click(elem)
     for _x in range(0, len(elem.get_attribute('value'))):
         action = action.send_keys(Keys.BACKSPACE)
     # Send the new text, then Tab to move to the next field (so change event is triggered).
     action.send_keys(value).send_keys(Keys.TAB).perform()
     click_css(self, 'a.action-save')
Example #11
0
 def set_field_value_and_save(self, label, value):
     """
     Set the field with given label (display name) to the specified value, and presses Save.
     """
     index = self.get_setting_entry_index(label)
     elem = self.q(css=self._bounded_selector('.metadata_edit div.wrapper-comp-setting input.setting-input'))[index]
     # Click in the field, delete the value there.
     action = ActionChains(self.browser).click(elem)
     for _x in range(0, len(elem.get_attribute('value'))):
         action = action.send_keys(Keys.BACKSPACE)
     # Send the new text, then Tab to move to the next field (so change event is triggered).
     action.send_keys(value).send_keys(Keys.TAB).perform()
     click_css(self, 'a.action-save')
Example #12
0
    def toggle_staff_lock(self):
        """
        Toggles "hide from students" which enables or disables a staff-only lock.

        Returns True if the lock is now enabled, else False.
        """
        was_locked_initially = self.is_staff_locked
        if not was_locked_initially:
            self.q(css='a.action-staff-lock').first.click()
        else:
            click_css(self, 'a.action-staff-lock', 0, require_notification=False)
            confirm_prompt(self)
        self.wait_for_ajax()
        return not was_locked_initially
Example #13
0
    def toggle_staff_lock(self, inherits_staff_lock=False):
        """
        Toggles "hide from students" which enables or disables a staff-only lock.

        Returns True if the lock is now enabled, else False.
        """
        was_locked_initially = self.is_staff_locked
        if not was_locked_initially:
            self.q(css='a.action-staff-lock').first.click()
        else:
            click_css(self, 'a.action-staff-lock', 0, require_notification=False)
            if not inherits_staff_lock:
                confirm_prompt(self)
        self.wait_for_ajax()
        return not was_locked_initially
Example #14
0
 def set_field_value_and_save(self, label, value):
     """
     Set the field with given label (display name) to the specified value, and presses Save.
     """
     index = self.get_setting_entry_index(label)
     elem = self.q(css=self._bounded_selector(
         '.metadata_edit div.wrapper-comp-setting input.setting-input')
                   )[index]
     # Click in the field, delete the value there.
     action = ActionChains(self.browser).click(elem)
     for _x in range(0, len(elem.get_attribute('value'))):
         action = action.send_keys(Keys.BACKSPACE)
     # Send the new text, then Tab to move to the next field (so change event is triggered).
     action.send_keys(value).send_keys(Keys.TAB).perform()
     click_css(self, 'a.action-save')
Example #15
0
    def delete(self, source_index):
        """
        Delete the item with index source_index (based on vertical placement in page).
        Only visible items are counted in the source_index.
        The index of the first item is 0.
        """
        # Click the delete button
        click_css(self, 'a.delete-button', source_index, require_notification=False)

        # Wait for the warning prompt to appear
        self.wait_for_element_visibility('#prompt-warning', 'Deletion warning prompt is visible')

        # Make sure the delete button is there
        confirmation_button_css = '#prompt-warning a.button.action-primary'
        self.wait_for_element_visibility(confirmation_button_css, 'Confirmation dialog button is visible')

        # Click the confirmation dialog button
        click_css(self, confirmation_button_css, 0)
 def cancel(self):
     """
     Clicks cancel button.
     """
     click_css(self, 'a.action-cancel', require_notification=False)
 def save(self):
     """
     Clicks save button.
     """
     click_css(self, 'a.action-save')
Example #18
0
 def add_missing_groups(self):
     """
     Click the "add missing groups" link.
     """
     click_css(self, '.add-missing-groups-button')
Example #19
0
 def duplicate(self, source_index):
     """
     Duplicate the item with index source_index (based on vertical placement in page).
     """
     click_css(self, 'a.duplicate-button', source_index)
Example #20
0
 def cancel(self):
     """
     Clicks cancel button.
     """
     click_css(self, 'a.action-cancel', require_notification=False)
Example #21
0
 def click_export_button(self):
     """
     Clicks export button.
     """
     click_css(self, "a.action-export")
Example #22
0
 def add_missing_groups(self):
     """
     Click the "add missing groups" link.
     """
     click_css(self, '.add-missing-groups-button')
Example #23
0
 def save(self):
     """
     Clicks save button.
     """
     click_css(self, 'a.action-save')
Example #24
0
 def duplicate(self, source_index):
     """
     Duplicate the item with index source_index (based on vertical placement in page).
     """
     click_css(self, 'a.duplicate-button', source_index)