示例#1
0
    def add_word_cloud_component(self, publish=False):
        """
        Clicks Advanced button in Add New Component then
        Clicks Word Cloud and verifies that it appears on Studio

        """
        add_x_block_button_css = '.add-xblock-component-button' \
                                 '[data-type="advanced"]'
        word_cloud_button_css = '.button-component[data-category="word_cloud"]'

        self.wait_for_element_visibility(
            add_x_block_button_css,
            'Add xblock button is visible.'
        )
        disable_animations(self)
        self.q(css=add_x_block_button_css).click()

        self.wait_for_element_visibility(
            word_cloud_button_css,
            'Word cloud button is visible.'
        )
        self.q(css=word_cloud_button_css).click()
        # Click initiates an ajax call
        self.wait_for_ajax()
        self.wait_for_element_visibility(
            '.xblock-header-word_cloud', 'Word Cloud component displayed'
        )
        if publish:
            self.q(css='.action-publish.action-primary').click()
            # Clicking on the publish button causes an ajax call.
            # We should be waiting for this ajax call to be completed
            # before exiting the function.
            self.wait_for_ajax()
示例#2
0
    def add_word_cloud_component(self, publish=False):
        """
        Clicks Advanced button in Add New Component then
        Clicks Word Cloud and verifies that it appears on Studio

        """
        add_x_block_button_css = '.add-xblock-component-button' \
                                 '[data-type="advanced"]'
        word_cloud_button_css = '.button-component[data-category="word_cloud"]'

        self.wait_for_element_visibility(add_x_block_button_css,
                                         'Add xblock button is visible.')
        disable_animations(self)
        self.q(css=add_x_block_button_css).click()

        self.wait_for_element_visibility(word_cloud_button_css,
                                         'Word cloud button is visible.')
        self.q(css=word_cloud_button_css).click()
        # Click initiates an ajax call
        self.wait_for_ajax()
        self.wait_for_element_visibility('.xblock-header-word_cloud',
                                         'Word Cloud component displayed')
        if publish:
            self.q(css='.action-publish.action-primary').click()
            # Clicking on the publish button causes an ajax call.
            # We should be waiting for this ajax call to be completed
            # before exiting the function.
            self.wait_for_ajax()
示例#3
0
    def register_white_label_user(self, registration_fields, submit=True):
        """
        Registers a whitelabel users for whitelabel tests.
        Arguments:
            registration_fields(dict): A dictionary of all fields to be filled.
            submit(bool): If True then registration form will be submitted.
        """
        disable_animations(self)
        self.wait_for_element_visibility('.form-toggle[data-type="login"]',
                                         'Registration form is visible.')

        elements_and_values = {
            '#register-email': registration_fields['email'],
            '#register-name': registration_fields['name'],
            '#register-username': registration_fields['username'],
            '#register-password': registration_fields['password'],
            '#register-first_name': registration_fields['first_name'],
            '#register-last_name': registration_fields['last_name'],
            '#register-state': registration_fields['state']
        }

        drop_down_names_and_values = {
            "country": registration_fields['country'],
        }
        select_drop_down_values(self, drop_down_names_and_values)
        fill_input_fields(self, elements_and_values)

        # Some tests still don't display the new registration page when running
        # on Jenkins. Once registration page is updated, remove this condition.
        if self.q(css='#register-honor_code').visible:
            click_checkbox(self, '#register-honor_code')
        click_checkbox(self, '#register-terms_of_service')

        if ORG == 'MITxPRO':
            fill_input_fields(
                self, {
                    '#register-company': registration_fields['company'],
                    '#register-title': registration_fields['title']
                })

        if ORG != 'HarvardMedGlobalAcademy':
            select_drop_down_values(
                self, {
                    "year_of_birth": registration_fields['year_of_birth'],
                    "gender": registration_fields['gender'],
                    "level_of_education":
                    registration_fields['level_of_education']
                })
        else:
            select_drop_down_values(
                self, {
                    "profession": registration_fields['profession'],
                    "specialty": registration_fields['specialty']
                })

        if submit:
            self.q(css='.register-button').click()
示例#4
0
def click_confirmation_prompt_primary_button(self):
    """
    Clicks the main action presented by the prompt (such as 'Delete')
    """
    disable_animations(self)
    self.q(css='.prompt button.action-primary').first.click()
    self.wait_for_element_invisibility(
        '.prompt', 'wait for pop up to disappear')
    self.wait_for_ajax()
示例#5
0
def click_confirmation_prompt_primary_button(self):
    """
    Clicks the main action presented by the prompt (such as 'Delete')
    """
    disable_animations(self)
    self.q(css='.prompt button.action-primary').first.click()
    self.wait_for_element_invisibility(
        '.prompt', 'wait for pop up to disappear')
    self.wait_for_ajax()
 def click_view_live_button(self):
     """
     Clicks view live button
     """
     disable_animations(self)
     self.browser.execute_script(
         "document.querySelectorAll('[data-course-key = \"course-v1:"
         "ArbiRaees+AR-1000+fall\"] .view-button')[0].click();")
     self.browser.switch_to_window(self.browser.window_handles[-1])
示例#7
0
 def click_view_live_button(self):
     """
     Clicks view live button
     """
     disable_animations(self)
     course_info = get_course_info()
     course_key = get_course_key({
         'course_org': course_info['org'],
         'course_num': course_info['number'],
         'course_run': course_info['run']
     })
     self.browser.execute_script(
         "document.querySelectorAll('[data-course-key = \""
         "{}\"] .view-button')[0].click();".format(str(course_key)))
     self.browser.switch_to_window(self.browser.window_handles[-1])
示例#8
0
 def click_view_live_button(self):
     """
     Clicks view live button
     """
     disable_animations(self)
     course_info = get_course_info()
     course_key = get_course_key({
         'course_org': course_info['org'],
         'course_num': course_info['number'],
         'course_run': course_info['run']
     })
     self.browser.execute_script(
         "document.querySelectorAll('[data-course-key = \""
         "{}\"] .view-button')[0].click();".format(str(course_key)))
     self.browser.switch_to_window(self.browser.window_handles[-1])
示例#9
0
    def register_white_label_user(self, registration_fields, submit=True):
        """
        Registers a whitelabel users for whitelabel tests.
        Arguments:
            registration_fields(dict): A dictionary of all fields to be filled.
            submit(bool): If True then registration form will be submitted.
        """
        disable_animations(self)
        self.wait_for_element_visibility(
            '.form-toggle[data-type="login"]', 'Registration form is visible.'
        )

        elements_and_values = {
            '#register-email': registration_fields['email'],
            '#register-name': registration_fields['name'],
            '#register-username': registration_fields['username'],
            '#register-password': registration_fields['password'],
            '#register-first_name': registration_fields['first_name'],
            '#register-last_name': registration_fields['last_name'],
            '#register-state': registration_fields['state']
        }

        drop_down_names_and_values = {
            "country": registration_fields['country'],
        }
        select_drop_down_values(self, drop_down_names_and_values)
        fill_input_fields(self, elements_and_values)

        # Some tests still don't display the new registration page when running
        # on Jenkins. Once registration page is updated, remove this condition.
        if self.q(css='#register-honor_code').visible:
            click_checkbox(self, '#register-honor_code')
        click_checkbox(self, '#register-terms_of_service')

        if ORG == 'MITxPRO':
            fill_input_fields(
                self,
                {
                    '#register-company': registration_fields['company'],
                    '#register-title': registration_fields['title']
                }
            )

        if ORG != 'HarvardMedGlobalAcademy':
            select_drop_down_values(
                self,
                {
                    "year_of_birth": registration_fields['year_of_birth'],
                    "gender": registration_fields['gender'],
                    "level_of_education": registration_fields[
                        'level_of_education'
                    ]
                }
            )
        else:
            select_drop_down_values(
                self,
                {
                    "profession": registration_fields['profession'],
                    "specialty": registration_fields['specialty']
                }
            )

        if submit:
            self.q(css='.register-button').click()