Example #1
0
    def test_not_fork_a_component(self):
        """
        test to make sure can't fork a component

        """
        # create a component
        # Click New Node button
        self.driver.find_element_by_link_text("Add Component").click()

        # Get form
        form = self.driver.find_element_by_xpath('//form[contains(@action, "newnode")]')

        # Wait for modal to stop moving
        util.wait_until_stable(self.driver.find_element_by_css_selector('input[name="title"]'))

        # Fill out form
        util.fill_form(form, {'input[name="title"]': config.node_title, "#category": "Procedure"})

        # check the fork option
        self.driver.find_element_by_css_selector("li span a").click()
        discrib = self.get_element('a[data-original-title="Number of times this node has been forked (copied)"]').text
        self.assertEqual(discrib, u" 0")

        # cleanup
        util.delete_project(self.driver)
Example #2
0
    def test_not_fork_a_component(self):
        """
        test to make sure can't fork a component

        """
        #create a component
        # Click New Node button
        self.driver.find_element_by_link_text('Add Component').click()

        # Get form
        form = self.driver.find_element_by_xpath(
            '//form[contains(@action, "newnode")]')

        # Wait for modal to stop moving
        util.wait_until_stable(
            self.driver.find_element_by_css_selector('input[name="title"]'))

        # Fill out form
        util.fill_form(form, {
            'input[name="title"]': config.node_title,
            '#category': 'Procedure',
        })

        #check the fork option
        self.driver.find_element_by_css_selector("li span a").click()
        discrib=self.get_element('a[data-original-title="Number of times this node has been forked (copied)"]')\
            .text
        self.assertEqual(discrib, u' 0')

        #cleanup
        util.delete_project(self.driver)
    def _submit_and_check(self, form_data, alert_text):
        """Submit form data and check for appropriate alert box. Asserts
        that there is exactly one matching alert box.

        Args:
            form_data : Dictionary of field values (see util.fill_form)
            alert_text : Text to search for in alert box

        """
        
        # Submit form
        util.fill_form(self.driver, form_data)
        
        # Get alert boxes
        alerts = util.get_alert_boxes(self.driver, alert_text)

        # Must be exactly one matching alert
        self.assertEqual(len(alerts), 1)