コード例 #1
0
    def test_logged_in_search(self):

        new_user = RegisterUser()
        new_user.register()

        # navigate back to home page by clicking on NHS England logo
        self.browser.find_element_by_class_name("logo").click()

        # Retain tag name for manual search input
        search_text = self.browser.find_element_by_xpath("/html/body/div[3]/div[2]/div/div/div/div/div/a[2]").text

        # Search by tag
        self.browser.find_element_by_xpath("/html/body/div[3]/div[2]/div/div/div/div/div/a[1]").click()
        self.browser.find_element_by_xpath("/html/body/div[3]/div/div/div/section[1]/div/ul/li[1]/div/h3/a").click()

        # navigate back to home page by clicking on NHS England logo
        self.browser.find_element_by_class_name("logo").click()

        # Use search bar to search for dataset
        self.browser.find_element_by_class_name('search').send_keys(search_text)
        self.browser.find_element_by_class_name("icon-search").click()
        self.assertIn('Datasets - CKAN', self.browser.title)

        # Click on dataset
        self.browser.find_element_by_xpath("/html/body/div[3]/div/div/div/section[1]/div/ul/li[1]/div/h3/a").click()

        #Logout user
        self.browser.find_element_by_xpath("/html/body/header[2]/div/nav/ul[2]/li[4]/a").click()
コード例 #2
0
    def test_logged_in_search(self):

        new_user = RegisterUser()
        new_user.register()

        # navigate back to home page by clicking on NHS England logo
        self.browser.find_element_by_class_name("logo").click()

        # Retain tag name for manual search input
        search_text = self.browser.find_element_by_xpath("/html/body/div[3]/div[2]/div/div/div/div/div/a[2]").text

        # Search by tag
        self.browser.find_element_by_xpath("/html/body/div[3]/div[2]/div/div/div/div/div/a[1]").click()
        self.browser.find_element_by_xpath("/html/body/div[3]/div/div/div/section[1]/div/ul/li[1]/div/h3/a").click()

        # navigate back to home page by clicking on NHS England logo
        self.browser.find_element_by_class_name("logo").click()

        # Use search bar to search for dataset
        self.browser.find_element_by_class_name('search').send_keys(search_text)
        self.browser.find_element_by_class_name("icon-search").click()
        self.assertIn('Datasets - CKAN', self.browser.title)

        # Click on dataset
        self.browser.find_element_by_xpath("/html/body/div[3]/div/div/div/section[1]/div/ul/li[1]/div/h3/a").click()

        # Logout user
        self.browser.find_element_by_xpath("/html/body/header[2]/div/nav/ul[2]/li[4]/a").click()
コード例 #3
0
    def test_dataset_download(self):

        new_user = RegisterUser()
        new_user.register()

        # navigate back to home page by clicking on NHS England logo
        self.browser.find_element_by_class_name("logo").click()

        # navigate to Dataset page and click on a dataset
        self.browser.find_element_by_link_text("Datasets").click()

        # select first dataset
        self.browser.find_element_by_xpath("/html/body/div[3]/div/div/div/section[1]/div/ul/li[1]/div/h3/a").click()

        # Retrieve file format
        file_format = self.browser.find_element_by_xpath("/html/body/div[3]/div/div/div/article/div/section[1]/ul/li"
                                                         "[1]/a/span").get_attribute("data-format")

        # Click on explore dropdown and select "More information"
        self.browser.find_element_by_class_name("icon-share-alt").click()
        self.browser.find_element_by_class_name("icon-info-sign").click()

        # If file format is pdf, file will open in current tab
        if file_format == u'pdf':
            self.browser.find_element_by_class_name("icon-external-link").click()
            self.assertIn("pdf", self.browser.current_url)
            #navigate back to CKAN and logout
            self.browser.back()
            self.browser.find_element_by_class_name("logo").click()
            self.browser.find_element_by_xpath("/html/body/header[2]/div/nav/ul[2]/li[4]/a/i").click()

        else:
            self.browser.find_element_by_class_name("icon-external-link").click()
            self.browser.find_element_by_class_name("logo").click()
            self.browser.find_element_by_xpath("/html/body/header[2]/div/nav/ul[2]/li[4]/a/i").click()
コード例 #4
0
    def test_dataset_download(self):

        new_user = RegisterUser()
        new_user.register()

        # navigate back to home page by clicking on NHS England logo
        self.browser.find_element_by_class_name("logo").click()

        # navigate to Dataset page and click on a dataset
        self.browser.find_element_by_link_text("Datasets").click()
        self.browser.find_element_by_link_text(".xlsx").click()

        # Click on explore dropdown and select "More information"
        self.browser.find_element_by_class_name("icon-share-alt").click()
        self.browser.find_element_by_class_name("icon-info-sign").click()

        # Click Go to Resource
        self.browser.find_element_by_class_name("icon-external-link").click()

        #Logout user
        self.browser.find_element_by_xpath("/html/body/header[2]/div/nav/ul[2]/li[4]/a").click()