Esempio n. 1
0
    def test_public_resources(self):
        # Check admin can make use of the public Test widget
        self.login(username="******", next="/admin/Workspace")
        self.create_widget('Test')

        # Check normuser also can make use of the public Test widget
        self.login(username='******', next="/normuser/Workspace")
        self.create_widget('Test')

        # Also widget details can be accessed
        with self.myresources_view as myresources:
            myresources.wait_catalogue_ready()
            myresources.search('Test')
            with myresources.search_in_results('Test') as resource:

                tab = resource.switch_tab('Change Log')
                self.assertIsNotNone(tab, 'Missing change log tab')
                changelog_contents = WebDriverWait(self.driver, 5).until(WEC.element_be_enabled((By.CSS_SELECTOR, '.se-notebook-tab-content.changelog'), base_element=resource.details))
                headings = changelog_contents.find_elements_by_css_selector('h1')
                self.assertEqual(len(headings), 1)

                tab = resource.switch_tab('Documentation')
                self.assertIsNotNone(tab, 'Missing documentation tab')
                documentation_contents = WebDriverWait(self.driver, 5).until(WEC.element_be_enabled((By.CSS_SELECTOR, '.se-notebook-tab-content.documentation'), base_element=resource.details))
                headings = documentation_contents.find_elements_by_css_selector('h1, h2')
                self.assertEqual(len(headings), 2)

            # But cannot be uninstalled by normal users
            myresources.uninstall_resource('Test', expect_error=True)
Esempio n. 2
0
    def test_basic_resource_details(self):

        self.login()

        with self.myresources_view as myresources:
            myresources.wait_catalogue_ready()
            myresources.search('Test')
            with myresources.search_in_results('Test') as resource:

                tab = resource.switch_tab('Change Log')
                self.assertIsNotNone(tab, 'Missing change log tab')
                changelog_contents = WebDriverWait(self.driver, 5).until(
                    WEC.element_be_enabled(
                        (By.CSS_SELECTOR,
                         '.se-notebook-tab-content.changelog'),
                        base_element=resource.details))
                headings = changelog_contents.find_elements_by_css_selector(
                    'h1')
                self.assertEqual(len(headings), 1)

                tab = resource.switch_tab('Documentation')
                self.assertIsNotNone(tab, 'Missing documentation tab')
                documentation_contents = WebDriverWait(self.driver, 5).until(
                    WEC.element_be_enabled(
                        (By.CSS_SELECTOR,
                         '.se-notebook-tab-content.documentation'),
                        base_element=resource.details))
                headings = documentation_contents.find_elements_by_css_selector(
                    'h1, h2')
                self.assertEqual(len(headings), 2)
Esempio n. 3
0
    def test_basic_resource_details(self):

        self.login()

        with self.myresources_view as myresources:
            myresources.wait_catalogue_ready()
            myresources.search("Test")
            with myresources.search_in_results("Test") as resource:

                tab = resource.switch_tab("Change Log")
                self.assertIsNotNone(tab, "Missing change log tab")
                changelog_contents = WebDriverWait(self.driver, 5).until(
                    WEC.element_be_enabled(
                        (By.CSS_SELECTOR, ".se-notebook-tab-content.changelog"), base_element=resource.details
                    )
                )
                headings = changelog_contents.find_elements_by_css_selector("h1")
                self.assertEqual(len(headings), 1)

                tab = resource.switch_tab("Documentation")
                self.assertIsNotNone(tab, "Missing documentation tab")
                documentation_contents = WebDriverWait(self.driver, 5).until(
                    WEC.element_be_enabled(
                        (By.CSS_SELECTOR, ".se-notebook-tab-content.documentation"), base_element=resource.details
                    )
                )
                headings = documentation_contents.find_elements_by_css_selector("h1, h2")
                self.assertEqual(len(headings), 2)
Esempio n. 4
0
    def test_public_resources(self):
        # Check admin can make use of the public Test widget
        self.login(username="******", next="/admin/Workspace")
        self.create_widget('Test')

        # Check normuser also can make use of the public Test widget
        self.login(username='******', next="/normuser/Workspace")
        self.create_widget('Test')

        # Also widget details can be accessed
        with self.myresources_view as myresources:
            myresources.wait_catalogue_ready()
            myresources.search('Test')
            with myresources.search_in_results('Test') as resource:

                tab = resource.switch_tab('Change Log')
                self.assertIsNotNone(tab, 'Missing change log tab')
                changelog_contents = WebDriverWait(self.driver, 5).until(
                    WEC.element_be_enabled(
                        (By.CSS_SELECTOR,
                         '.se-notebook-tab-content.changelog'),
                        base_element=resource.details))
                headings = changelog_contents.find_elements_by_css_selector(
                    'h1')
                self.assertEqual(len(headings), 1)

                tab = resource.switch_tab('Documentation')
                self.assertIsNotNone(tab, 'Missing documentation tab')
                documentation_contents = WebDriverWait(self.driver, 5).until(
                    WEC.element_be_enabled(
                        (By.CSS_SELECTOR,
                         '.se-notebook-tab-content.documentation'),
                        base_element=resource.details))
                headings = documentation_contents.find_elements_by_css_selector(
                    'h1, h2')
                self.assertEqual(len(headings), 2)

            # But cannot be uninstalled by normal users
            myresources.uninstall_resource('Test', expect_error=True)
Esempio n. 5
0
    def test_myresources_navigation(self):

        self.login(username="******")

        # Fill navigation history
        with self.myresources_view as myresources:
            with myresources.search_in_results('Test') as resource:
                resource.switch_to('1.0')
                resource.switch_tab('Documentation')
            with myresources.search_in_results('Test Mashup'):
                pass

        catalogue_base_element = self.myresources_view.get_current_catalogue_base_element(
        )

        # Check navigation history has been filled correctly
        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.get_current_view() == 'myresources')
        self.assertEqual(self.myresources_view.get_subview(), 'search')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.myresources_view.get_subview() == 'details')
        WebDriverWait(self.driver, timeout=5).until(
            WEC.element_be_enabled((By.CSS_SELECTOR, '.details_interface'),
                                   base_element=catalogue_base_element))
        self.assertEqual(self.myresources_view.get_current_resource(),
                         'Test Mashup')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.myresources_view.get_subview() == 'search')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.myresources_view.get_subview() == 'details')
        WebDriverWait(self.driver, timeout=5).until(
            WEC.element_be_enabled((By.CSS_SELECTOR, '.details_interface'),
                                   base_element=catalogue_base_element))
        self.assertEqual(self.myresources_view.get_current_resource(), 'Test')
        current_tab = self.driver.find_element_by_css_selector(
            '.details_interface .se-notebook-tab.selected').text
        self.assertEqual(current_tab, 'Documentation')
        self.assertEqual(
            self.driver.find_element_by_css_selector(
                '.details_interface .se-select.versions .se-select-text').text,
            'v1.0')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: driver.find_element_by_css_selector(
                '.details_interface .se-notebook-tab.selected').text ==
            'Main Info')
        self.assertEqual(
            self.driver.find_element_by_css_selector(
                '.details_interface .se-select.versions .se-select-text').text,
            'v1.0')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: driver.find_element_by_css_selector(
                '.details_interface .se-select.versions .se-select-text').text
            == 'v2.0')
        current_tab = self.driver.find_element_by_css_selector(
            '.details_interface .se-notebook-tab.selected').text
        self.assertEqual(current_tab, 'Main Info')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.myresources_view.get_subview() == 'search')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.get_current_view() == 'workspace')

        # Replay navigation history
        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.get_current_view() == 'myresources')
        self.assertEqual(self.myresources_view.get_subview(), 'search')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.myresources_view.get_subview() == 'details')
        WebDriverWait(self.driver, timeout=5).until(
            WEC.element_be_enabled((By.CSS_SELECTOR, '.details_interface'),
                                   base_element=catalogue_base_element))
        self.assertEqual(self.myresources_view.get_current_resource(), 'Test')
        current_tab = self.driver.find_element_by_css_selector(
            '.details_interface .se-notebook-tab.selected').text
        self.assertEqual(current_tab, 'Main Info')
        self.assertEqual(
            self.driver.find_element_by_css_selector(
                '.details_interface .se-select.versions .se-select-text').text,
            'v2.0')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: driver.find_element_by_css_selector(
                '.details_interface .se-select.versions .se-select-text').text
            == 'v1.0')
        self.assertEqual(current_tab, 'Main Info')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: driver.find_element_by_css_selector(
                '.details_interface .se-notebook-tab.selected').text ==
            'Documentation')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.myresources_view.get_subview() == 'search')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: self.myresources_view.get_subview() == 'details')
        WebDriverWait(self.driver, timeout=5).until(
            WEC.element_be_enabled((By.CSS_SELECTOR, '.details_interface'),
                                   base_element=catalogue_base_element))
        WebDriverWait(self.driver, timeout=1).until(
            lambda driver: self.myresources_view.get_current_resource(),
            'Test Mashup')
Esempio n. 6
0
    def test_myresources_navigation(self):

        self.login(username="******")

        # Fill navigation history
        with self.myresources_view as myresources:
            with myresources.search_in_results('Test') as resource:
                resource.switch_to('1.0')
                resource.switch_tab('Documentation')
            with myresources.search_in_results('Test Mashup'):
                pass

        catalogue_base_element = self.myresources_view.get_current_catalogue_base_element()

        # Check navigation history has been filled correctly
        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.get_current_view() == 'myresources')
        self.assertEqual(self.myresources_view.get_subview(), 'search')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == 'details')
        WebDriverWait(self.driver, timeout=5).until(WEC.element_be_enabled((By.CSS_SELECTOR, '.details_interface'), base_element=catalogue_base_element))
        self.assertEqual(self.myresources_view.get_current_resource(), 'Test Mashup')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == 'search')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == 'details')
        WebDriverWait(self.driver, timeout=5).until(WEC.element_be_enabled((By.CSS_SELECTOR, '.details_interface'), base_element=catalogue_base_element))
        self.assertEqual(self.myresources_view.get_current_resource(), 'Test')
        current_tab = self.driver.find_element_by_css_selector('.details_interface .se-notebook-tab.selected').text
        self.assertEqual(current_tab, 'Documentation')
        self.assertEqual(self.driver.find_element_by_css_selector('.details_interface .se-select.versions .se-select-text').text, 'v1.0')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: driver.find_element_by_css_selector('.details_interface .se-notebook-tab.selected').text == 'Main Info')
        self.assertEqual(self.driver.find_element_by_css_selector('.details_interface .se-select.versions .se-select-text').text, 'v1.0')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: driver.find_element_by_css_selector('.details_interface .se-select.versions .se-select-text').text == 'v2.0')
        current_tab = self.driver.find_element_by_css_selector('.details_interface .se-notebook-tab.selected').text
        self.assertEqual(current_tab, 'Main Info')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == 'search')

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.get_current_view() == 'workspace')

        # Replay navigation history
        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.get_current_view() == 'myresources')
        self.assertEqual(self.myresources_view.get_subview(), 'search')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == 'details')
        WebDriverWait(self.driver, timeout=5).until(WEC.element_be_enabled((By.CSS_SELECTOR, '.details_interface'), base_element=catalogue_base_element))
        self.assertEqual(self.myresources_view.get_current_resource(), 'Test')
        current_tab = self.driver.find_element_by_css_selector('.details_interface .se-notebook-tab.selected').text
        self.assertEqual(current_tab, 'Main Info')
        self.assertEqual(self.driver.find_element_by_css_selector('.details_interface .se-select.versions .se-select-text').text, 'v2.0')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: driver.find_element_by_css_selector('.details_interface .se-select.versions .se-select-text').text == 'v1.0')
        self.assertEqual(current_tab, 'Main Info')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: driver.find_element_by_css_selector('.details_interface .se-notebook-tab.selected').text == 'Documentation')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == 'search')

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == 'details')
        WebDriverWait(self.driver, timeout=5).until(WEC.element_be_enabled((By.CSS_SELECTOR, '.details_interface'), base_element=catalogue_base_element))
        WebDriverWait(self.driver, timeout=1).until(lambda driver: self.myresources_view.get_current_resource(), 'Test Mashup')
Esempio n. 7
0
    def test_myresources_navigation(self):

        self.login(username="******")

        # Fill navigation history
        with self.myresources_view as myresources:
            with myresources.search_in_results("Test") as resource:
                resource.switch_to("1.0")
                resource.switch_tab("Documentation")
            with myresources.search_in_results("Test Mashup"):
                pass

        catalogue_base_element = self.myresources_view.get_current_catalogue_base_element()

        # Check navigation history has been filled correctly
        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.get_current_view() == "myresources")
        self.assertEqual(self.myresources_view.get_subview(), "search")

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == "details")
        WebDriverWait(self.driver, timeout=5).until(
            WEC.element_be_enabled((By.CSS_SELECTOR, ".details_interface"), base_element=catalogue_base_element)
        )
        self.assertEqual(self.myresources_view.get_current_resource(), "Test Mashup")

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == "search")

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == "details")
        WebDriverWait(self.driver, timeout=5).until(
            WEC.element_be_enabled((By.CSS_SELECTOR, ".details_interface"), base_element=catalogue_base_element)
        )
        self.assertEqual(self.myresources_view.get_current_resource(), "Test")
        current_tab = self.driver.find_element_by_css_selector(".details_interface .se-notebook-tab.selected").text
        self.assertEqual(current_tab, "Documentation")
        self.assertEqual(
            self.driver.find_element_by_css_selector(".details_interface .se-select.versions .se-select-text").text,
            "v1.0",
        )

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: driver.find_element_by_css_selector(".details_interface .se-notebook-tab.selected").text
            == "Main Info"
        )
        self.assertEqual(
            self.driver.find_element_by_css_selector(".details_interface .se-select.versions .se-select-text").text,
            "v1.0",
        )

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: driver.find_element_by_css_selector(
                ".details_interface .se-select.versions .se-select-text"
            ).text
            == "v2.0"
        )
        current_tab = self.driver.find_element_by_css_selector(".details_interface .se-notebook-tab.selected").text
        self.assertEqual(current_tab, "Main Info")

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == "search")

        self.driver.back()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.get_current_view() == "workspace")

        # Replay navigation history
        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.get_current_view() == "myresources")
        self.assertEqual(self.myresources_view.get_subview(), "search")

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == "details")
        WebDriverWait(self.driver, timeout=5).until(
            WEC.element_be_enabled((By.CSS_SELECTOR, ".details_interface"), base_element=catalogue_base_element)
        )
        self.assertEqual(self.myresources_view.get_current_resource(), "Test")
        current_tab = self.driver.find_element_by_css_selector(".details_interface .se-notebook-tab.selected").text
        self.assertEqual(current_tab, "Main Info")
        self.assertEqual(
            self.driver.find_element_by_css_selector(".details_interface .se-select.versions .se-select-text").text,
            "v2.0",
        )

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: driver.find_element_by_css_selector(
                ".details_interface .se-select.versions .se-select-text"
            ).text
            == "v1.0"
        )
        self.assertEqual(current_tab, "Main Info")

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(
            lambda driver: driver.find_element_by_css_selector(".details_interface .se-notebook-tab.selected").text
            == "Documentation"
        )

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == "search")

        self.driver.forward()
        WebDriverWait(self.driver, timeout=5).until(lambda driver: self.myresources_view.get_subview() == "details")
        WebDriverWait(self.driver, timeout=5).until(
            WEC.element_be_enabled((By.CSS_SELECTOR, ".details_interface"), base_element=catalogue_base_element)
        )
        self.assertEqual(self.myresources_view.get_current_resource(), "Test Mashup")