Esempio n. 1
0
    def test_presentation_preferences(self):
        driver = self.driver

        # Select presentation check box
        self.wait_until(
            30, EC.presence_of_element_located((By.ID, 'presentation')))
        conftest.element_click_by_id(driver, 'presentation')

        # Save conference settings
        conf_id = conftest.element_get_attribute_by_id(driver, 'short',
                                                       'value')
        conftest.element_click_by_class_name(driver, 'btn-success')

        url_submission = "http://%s:9000/conference/%s/submission" % (
            Cookies.get_host_ip(), conf_id)
        url_conf_settings = "http://%s:9000/dashboard/conference/%s" % (
            Cookies.get_host_ip(), conf_id)

        # Switch to the conference abstract submission page
        driver.get(url_submission)

        # Check that the presentation type option is available
        assert len(driver.find_elements_by_class_name('poster-or-talk')) == 1

        # Switch back to the conference settings page
        driver.get("http://%s:9000/dashboard/conference/%s" %
                   (Cookies.get_host_ip(), conf_id))
Esempio n. 2
0
    def test_active(self):
        driver = self.driver

        # Select 'active' checkbox
        self.wait_until(30, EC.presence_of_element_located((By.ID, 'active')))
        conftest.element_click_by_id(driver, 'active')

        # Save conference
        conf_id = conftest.element_get_attribute_by_id(driver, 'short',
                                                       'value')
        conftest.element_click_by_class_name(driver, 'btn-success')

        # Switch to start page
        driver.get("http://" + Cookies.get_host_ip() + ":9000/")

        # Find conference via conference id and check its in the jumbotron (active conference) section
        xpath_div_conf = '//div[@class="jumbotron"]/h3/a[contains(@href,"%s")]' % conf_id
        assert len(driver.find_elements_by_xpath(xpath_div_conf)) == 1

        conf_div = driver.find_element_by_xpath('%s/../..' % xpath_div_conf)
        # Check admin manage abstracts link is available
        assert len(
            conf_div.find_elements_by_xpath(
                './/a[contains(text(),"Manage")]')) == 1
        # Check admin conference settings link is available
        assert len(
            conf_div.find_elements_by_xpath(
                './/a[contains(text(),"Conference Settings")]')) == 1

        # Switch back to the conference settings page
        driver.get("http://%s:9000/dashboard/conference/%s" %
                   (Cookies.get_host_ip(), conf_id))
Esempio n. 3
0
    def test_start_date(self):
        driver = self.driver

        # Select start date via date picker to the 14. of the next month
        self.wait_until(30, EC.presence_of_element_located((By.ID, 'start')))
        test_val = "14"
        conftest.element_click_by_id(driver, 'start')

        driver.find_element_by_xpath(
            '//a[contains(@class,"ui-datepicker-next")]').click()
        driver.find_element_by_xpath(
            '//div[@id="ui-datepicker-div"]//a[contains(text(), "%s")]' %
            test_val).click()
        driver.find_element_by_xpath(
            '//button[contains(@class, "datepicker-close")]').click()

        # Save conference
        conftest.element_click_by_class_name(driver, 'btn-success')

        # Check that the date has been set
        self.wait_until(30, EC.presence_of_element_located((By.ID, 'start')))
        assert test_val in conftest.element_get_attribute_by_xpath(
            driver, '//*[@id="start"]', 'value')

        # Check start date cannot be set to invalid values
        old_date = conftest.element_get_attribute_by_id(
            driver, 'start', 'value')
        # Check invalid date
        conftest.element_send_keys_by_id(driver, 'start', '99/99/9999')
        # Switch focus
        conftest.element_click_by_id(driver, 'mFigs')

        # Check date value has not been changed
        assert old_date in conftest.element_get_attribute_by_id(
            driver, 'start', 'value')

        # Check date cannot be set to invalid string
        driver.find_element_by_id('start').send_keys('hello')
        assert old_date in conftest.element_get_attribute_by_id(
            driver, 'start', 'value')

        # Switch to start page
        conf_id = conftest.element_get_attribute_by_id(driver, 'short',
                                                       'value')
        driver.get("http://" + Cookies.get_host_ip() + ":9000/")

        # Select conference by conference id
        div_conf = '//div[@class="jumbotron"]/h3/a[contains(@href,"%s")]/../..' % conf_id
        conf_div = driver.find_element_by_xpath(div_conf)

        # Check conference contains changed start date
        assert len(
            conf_div.find_elements_by_xpath('./p[contains(text(),"%s")]' %
                                            test_val)) == 1

        # Switch back to the conference settings page
        driver.get("http://%s:9000/dashboard/conference/%s" %
                   (Cookies.get_host_ip(), conf_id))
Esempio n. 4
0
    def test_submission(self):
        driver = self.driver

        # Fetch conference id from conference settings page
        self.wait_until(30, EC.presence_of_element_located((By.ID, 'short')))
        conf_id = conftest.element_get_attribute_by_id(driver, 'short',
                                                       'value')

        # Switch to conference start page
        driver.get("http://" + Cookies.get_host_ip() + ":9000/conference/" +
                   conf_id)

        # Check that there is no submission text
        xpath_submission = '//ul[contains(@class,"nav")]//li/a[contains(text(),"Submission")]'
        assert len(driver.find_elements_by_xpath(xpath_submission)) == 0
        # Check that there is no submission submit abstract link
        xpath_submit = '//div[@class="jumbotron"]//a[contains(text(),"Submit")]'
        assert len(driver.find_elements_by_xpath(xpath_submit)) == 0

        # Switch back to the conference settings page via the conference settings link
        xpath_conf_setting = '//div[@class="jumbotron"]//a[contains(text(),"Conference Settings")]'
        conftest.element_click_by_xpath(driver, xpath_conf_setting)

        # Select 'submission' checkbox
        self.wait_until(30,
                        EC.presence_of_element_located((By.ID, 'submission')))
        conftest.element_click_by_id(driver, 'submission')

        # Save conference
        conftest.element_click_by_class_name(driver, 'btn-success')

        # Switch to conference start page
        driver.get("http://" + Cookies.get_host_ip() + ":9000/conference/" +
                   conf_id)

        # Check that there is a submission text
        assert len(driver.find_elements_by_xpath(xpath_submission)) == 1
        # Check that there is a submission submit abstract link
        assert len(driver.find_elements_by_xpath(xpath_submit)) == 1

        # Switch back to the conference settings page
        driver.get("http://%s:9000/dashboard/conference/%s" %
                   (Cookies.get_host_ip(), conf_id))
Esempio n. 5
0
    def test_published(self):
        driver = self.driver

        # Select published checkbox
        self.wait_until(30, EC.presence_of_element_located(
            (By.ID, 'published')))
        conftest.element_click_by_id(driver, 'published')

        # Save conference
        conf_id = conftest.element_get_attribute_by_id(driver, 'short',
                                                       'value')
        conftest.element_click_by_class_name(driver, 'btn-success')

        # Switch to start page
        driver.get("http://" + Cookies.get_host_ip() + ":9000/")

        # Check that the conference is present by conference id
        xpath_div_conf = '//div[@class="media-body"]/a[contains(@href,"%s")]' % conf_id
        assert len(driver.find_elements_by_xpath(xpath_div_conf)) == 1

        conf_div = driver.find_element_by_xpath(xpath_div_conf + '/..')

        # Check the conference is not in the unpublished section
        assert 'unpublished' not in conf_div.find_element_by_xpath(
            '..').get_attribute('class')
        # Check admin manage abstracts link is available
        assert len(
            conf_div.find_elements_by_xpath(
                './/a[contains(text(),"Manage abstracts")]')) == 1
        # Check admin conference settings link is available
        assert len(
            conf_div.find_elements_by_xpath(
                './/a[contains(text(),"Conference Settings")]')) == 1

        # Switch back to the conference settings page
        driver.get("http://%s:9000/dashboard/conference/%s" %
                   (Cookies.get_host_ip(), conf_id))
Esempio n. 6
0
    def test_deadline(self):
        driver = self.driver

        # Select deadline date via date picker to the 10. of the next month
        self.wait_until(30, EC.presence_of_element_located(
            (By.ID, 'deadline')))
        test_val = "10"
        conftest.element_click_by_id(driver, 'deadline')
        driver.find_element_by_id('deadline').click()

        driver.find_element_by_xpath(
            '//a[contains(@class,"ui-datepicker-next")]').click()
        driver.find_element_by_xpath(
            '//div[@id="ui-datepicker-div"]//a[contains(text(), "%s")]' %
            test_val).click()
        driver.find_element_by_xpath(
            '//button[contains(@class, "datepicker-close")]').click()

        # Save conference
        conftest.element_click_by_class_name(driver, 'btn-success')

        self.wait_until(30, EC.presence_of_element_located(
            (By.ID, 'deadline')))
        assert test_val in conftest.element_get_attribute_by_xpath(
            driver, '//*[@id="deadline"]', 'value')

        old_date = conftest.element_get_attribute_by_id(
            driver, 'deadline', 'value')
        conftest.element_send_keys_by_id(driver, 'deadline', '99/99/9999')
        conftest.element_click_by_id(driver, "mFigs")

        assert old_date in conftest.element_get_attribute_by_id(
            driver, 'deadline', 'value')
        driver.find_element_by_id('deadline').send_keys('hello')
        conftest.element_click_by_id(driver, "mFigs")
        assert old_date in conftest.element_get_attribute_by_id(
            driver, 'deadline', 'value')
        conftest.element_click_by_id(driver, "mFigs")