<commit_before>import time

from se34euca.lib.EucaUITestLib_Base import *


class EucaUITestLib_Instance(EucaUITestLib_Base):
    def test_ui_gotopage_running(self):
        print
        print "Started Test: GotoPage Running"
        print
        self.click_element_by_id("euca-logo")
        print
        print "Test: Received the Page Title -> " + self.driver.title
        self.click_element_by_css_selector("div.status-readout")
        print
        print "Test: Clicked the GoToPage Button"
        self.verify_element_by_id("table-instances-new")
        print
        print "Finished Test: GotoPage Running"
        print
        return 0

    def test_ui_launch_instance_basic(self):
        print
        print "Started Test: Launch Instance Basic"
        print
        print "Click: LINK_TEXT -> Dashboard"
        self.click_element_by_link_text("Dashboard")
        print "Click: LINK_TEXT -> Launch new instance"
        self.click_element_by_link_text("Launch new instance")
        print "Click: CSS_SELECTOR -> div.image-name"
        self.click_element_by_css_selector("div.image-name")
        print "Click: ID -> nextButton"
        self.click_element_by_id("nextButton")
        print "Wait: ID -> launch-instance-type-num-instance"
        self.verify_element_by_id("launch-instance-type-num-instance")
        print "Click: ID -> nextButton"
        self.click_element_by_id("nextButton")
        print "Select: ID -> launch-wizard-security-keypair-selector, TEXT -> None (advanced option)"
        self.select_text_by_id("launch-wizard-security-keypair-selector", "None (advanced option)")
        print "Click: ID -> finishButton"
        self.click_element_by_id("finishButton")
        print
        print "Test: Verifying there is a Running Instance"
        print
        self.click_element_by_link_text("Dashboard")
        self.verify_element_by_link_text("Launch new instance")
        print "Verifying that Running Instances Count on Dashboard is non-zero"
        self.verify_text_not_present_by_css("div.status-readout > span", "0")
        print
        print "Finished Test: Launch Instance Basic"
        return 0


    def test_ui_launch_instance_given_name_security_group_keypair(self, instance_name, security_group, keypair):
        print
        print "Started Test: Launch Instance Given Instance Name: " + str(
            instance_name) + ", security group: " + security_group + ", keypair: " + keypair
        print
        print "Click the Dashboard link"
        self.click_element_by_link_text("Dashboard")
        print "Click on the 'Launch new instance' button"
        self.click_element_by_link_text("Launch new instance")
        print "Click on the first image 'link'"
        self.click_element_by_css_selector("div.image-name")
        print "Click the 'Next' Button"
        self.click_element_by_id("nextButton")
        print "Wait: ID -> launch-instance-type-num-instance"
        self.verify_element_by_id("launch-instance-type-num-instance")
        print "Enter instance name into Name field"
        self.set_keys_by_id("launch-instance-names", str(instance_name))
        time.sleep(5)
        self.click_element_by_css_selector("div.icon_add.enabled")
        time.sleep(5)
        print "Click the 'Next: select security' button"
        self.click_element_by_id("nextButton")
        print "Select: ID -> launch-wizard-security-keypair-selector, 'TEXT -> None (advanced option)'"
        self.select_text_by_id("launch-wizard-security-keypair-selector", str(keypair))
        self.select_text_by_id("launch-wizard-security-sg-selector", str(security_group))
        print "Click: ID -> finishButton"
        self.click_element_by_id("finishButton")
        print
        print "Verifying instance named " + instance_name + " visible on Instances Landing Page"
        self.click_element_by_link_text("Dashboard")<commit_msg>Added click away from instance name field in Launch instance wizard of 'launch instance with name, keypair, security group' test.<commit_after>import time

from se34euca.lib.EucaUITestLib_Base import *


class EucaUITestLib_Instance(EucaUITestLib_Base):
    def test_ui_gotopage_running(self):
        print
        print "Started Test: GotoPage Running"
        print
        self.click_element_by_id("euca-logo")
        print
        print "Test: Received the Page Title -> " + self.driver.title
        self.click_element_by_css_selector("div.status-readout")
        print
        print "Test: Clicked the GoToPage Button"
        self.verify_element_by_id("table-instances-new")
        print
        print "Finished Test: GotoPage Running"
        print
        return 0

    def test_ui_launch_instance_basic(self):
        print
        print "Started Test: Launch Instance Basic"
        print
        print "Click: LINK_TEXT -> Dashboard"
        self.click_element_by_link_text("Dashboard")
        print "Click: LINK_TEXT -> Launch new instance"
        self.click_element_by_link_text("Launch new instance")
        print "Click: CSS_SELECTOR -> div.image-name"
        self.click_element_by_css_selector("div.image-name")
        print "Click: ID -> nextButton"
        self.click_element_by_id("nextButton")
        print "Wait: ID -> launch-instance-type-num-instance"
        self.verify_element_by_id("launch-instance-type-num-instance")
        print "Click: ID -> nextButton"
        self.click_element_by_id("nextButton")
        print "Select: ID -> launch-wizard-security-keypair-selector, TEXT -> None (advanced option)"
        self.select_text_by_id("launch-wizard-security-keypair-selector", "None (advanced option)")
        print "Click: ID -> finishButton"
        self.click_element_by_id("finishButton")
        print
        print "Test: Verifying there is a Running Instance"
        print
        self.click_element_by_link_text("Dashboard")
        self.verify_element_by_link_text("Launch new instance")
        print "Verifying that Running Instances Count on Dashboard is non-zero"
        self.verify_text_not_present_by_css("div.status-readout > span", "0")
        print
        print "Finished Test: Launch Instance Basic"
        return 0


    def test_ui_launch_instance_given_name_security_group_keypair(self, instance_name, security_group, keypair):
        print
        print "Started Test: Launch Instance Given Instance Name: " + str(
            instance_name) + ", security group: " + security_group + ", keypair: " + keypair
        print
        print "Click the Dashboard link"
        self.click_element_by_link_text("Dashboard")
        print "Click on the 'Launch new instance' button"
        self.click_element_by_link_text("Launch new instance")
        print "Click on the first image 'link'"
        self.click_element_by_css_selector("div.image-name")
        print "Click the 'Next' Button"
        self.click_element_by_id("nextButton")
        print "Wait: ID -> launch-instance-type-num-instance"
        self.verify_element_by_id("launch-instance-type-num-instance")
        print "Enter instance name into Name field"
        self.set_keys_by_id("launch-instance-names", str(instance_name))
        print "Click away from input field on launch instance wizard"
        time.sleep(5)
        #self.click_element_by_css_selector("div.icon_add.enabled")
        self.click_element_by_id("wizard")
        time.sleep(5)
        print "Click the 'Next: select security' button"
        self.click_element_by_id("nextButton")
        print "Select: ID -> launch-wizard-security-keypair-selector, 'TEXT -> None (advanced option)'"
        self.select_text_by_id("launch-wizard-security-keypair-selector", str(keypair))
        self.select_text_by_id("launch-wizard-security-sg-selector", str(security_group))
        print "Click: ID -> finishButton"
        self.click_element_by_id("finishButton")
        print
        print "Verifying instance named " + instance_name + " visible on Instances Landing Page"
        self.click_element_by_link_text("Dashboard")
{'fraction_non_alphanumeric': 0.093796711509716, 'fraction_numerical': 0.0017438963627304435, 'mean_word_length': 3.0124937531234384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2123840', 'n_tokens_mistral': 2402, 'n_tokens_neox': 2334, 'n_words': 523}