<commit_before>from se34euca.lib.EucaUITestLib_Base import *


class EucaUITestLib_Snapshot(EucaUITestLib_Base):
    def test_ui_delete_snapshot(self):
        print
        print "Started Test: Delete Snapshot"
        print
        print "Go to Dashboard"
        self.click_element_by_id("resource-menu-dashboard")
        self.verify_element_by_link_text("Launch new instance")
        print
        print "Test: Go to the Page Snapshot"
        self.click_element_by_css_selector("#dashboard-storage-snapshot > span")
        self.verify_element_by_id("table-snapshots-new")
        self.click_element_by_css_selector("td.checkbox-cell.sorting_1 > input[type=\"checkbox\"]")
        self.click_element_by_id("more-actions-snapshots")
        print
        print "Test: Delete Snapshot"
        self.click_element_by_link_text("Delete")
        self.click_element_by_id("button-dialog-deletesnapshot-delete")
        print
        print "Finished: Delete Snapshot"
        print
        return 0

    def test_ui_create_volume_from_snapshot(self):
        print
        print "Started Test: Create Volume From Snapshot"
        print
        print "Go to Dashboard"
        self.click_element_by_id("resource-menu-dashboard")
        self.verify_element_by_link_text("Launch new instance")
        print
        print "Test: Go to the Page Snapshot"
        self.click_element_by_css_selector("#dashboard-storage-snapshot > span")
        self.verify_element_by_id("table-snapshots-new")
        self.click_element_by_css_selector("td.checkbox-cell.sorting_1 > input[type=\"checkbox\"]")
        print
        print "Test: Create Volume From Snapshot"
        self.click_element_by_id("more-actions-snapshots")
        self.click_element_by_link_text("Create volume from snapshot")
        self.click_element_by_id("btn-volumes-delete-delete")
        print
        print "Finished: Create Volume From Snapshot"
        print
        return 0

    def test_ui_delete_all_snapshots(self):
        print
        print "Started Test: Delete All Snapshots"
        print
        self.test_ui_gotopage_dashboard()
        print
        print "Test: Verify that snapshot count is not zero on Dashboard:"

        if self.verify_text_not_present_by_css("#dashboard-storage-snapshot > span", "0"):
            print "Test: Verified number of snapshots on dashboard is non-zero: "
            print
            num_snapshots = self.get_text_by_css_selector("#dashboard-storage-snapshot > span")
            print "Test: Snapshot count on Dashboard: " + num_snapshots
            print "Test: Go to the Page Snapshot"
            self.click_element_by_css_selector("#dashboard-storage-snapshot > span")
            self.verify_element_by_id("table-snapshots-new")
            self.click_element_by_id("snapshots-check-all")
            self.click_element_by_id("more-actions-snapshots")
            print
            print "Test: Delete All Snapshots"
            self.click_element_by_link_text("Delete")
            self.click_element_by_id("button-dialog-deletesnapshot-delete")
        else:
            print "Test: Snapshot count on Dashboard was zero"
            print
        print "Finished: Delete Snapshot"
        print
        return 0

    def test_ui_register_snapshot_as_image(self, image_name):
        print
        print "Started Test: Register Snapshot as image"
        print
        print "Go to Dashboard"
        self.click_element_by_id("resource-menu-dashboard")
        self.verify_element_by_link_text("Launch new instance")
        print "Click Storage button"
        self.click_element_by_id("resource-menu-storage")
        print "Click Snapshots menu item"
        self.click_element_by_id("resource-menuitem-snapshot")
        print "Click the 'ready' status, to check-mark the snapshot"
        self.click_element_by_css_selector("div.table-row-status.status-completed")
        print "Click the More actions button"
        self.click_element_by_id("more-actions-snapshots")
        self.click_element_by_link_text("Register as image")<commit_msg>Fixed the volume create method to select the correct checkbox css<commit_after>from se34euca.lib.EucaUITestLib_Base import *


class EucaUITestLib_Snapshot(EucaUITestLib_Base):
    def test_ui_delete_snapshot(self):
        print
        print "Started Test: Delete Snapshot"
        print
        print "Go to Dashboard"
        self.click_element_by_id("resource-menu-dashboard")
        self.verify_element_by_link_text("Launch new instance")
        print
        print "Test: Go to the Page Snapshot"
        self.click_element_by_css_selector("#dashboard-storage-snapshot > span")
        self.verify_element_by_id("table-snapshots-new")
        self.click_element_by_css_selector("td.checkbox-cell.sorting_1 > input[type=\"checkbox\"]")
        self.click_element_by_id("more-actions-snapshots")
        print
        print "Test: Delete Snapshot"
        self.click_element_by_link_text("Delete")
        self.click_element_by_id("button-dialog-deletesnapshot-delete")
        print
        print "Finished: Delete Snapshot"
        print
        return 0

    def test_ui_create_volume_from_snapshot(self):
        print
        print "Started Test: Create Volume From Snapshot"
        print
        print "Go to Dashboard"
 	self.click_element_by_link_text("Dashboard")
        self.verify_element_by_link_text("Launch new instance")
        print
        print "Test: Go to the Page Snapshot"
        self.click_element_by_css_selector("#dashboard-storage-snapshot > span")
        self.verify_element_by_id("table-snapshots-new")
        self.click_element_by_css_selector("td.checkbox-cell > input[type=\"checkbox\"]")
        print
        print "Test: Create Volume From Snapshot"
        self.click_element_by_id("more-actions-snapshots")
        self.click_element_by_link_text("Create volume from snapshot")
        self.click_element_by_id("button-dialog-createvolume-save")
        print
        print "Finished: Create Volume From Snapshot"
        print
        return 0

    def test_ui_delete_all_snapshots(self):
        print
        print "Started Test: Delete All Snapshots"
        print
        self.test_ui_gotopage_dashboard()
        print
        print "Test: Verify that snapshot count is not zero on Dashboard:"

        if self.verify_text_not_present_by_css("#dashboard-storage-snapshot > span", "0"):
            print "Test: Verified number of snapshots on dashboard is non-zero: "
            print
            num_snapshots = self.get_text_by_css_selector("#dashboard-storage-snapshot > span")
            print "Test: Snapshot count on Dashboard: " + num_snapshots
            print "Test: Go to the Page Snapshot"
            self.click_element_by_css_selector("#dashboard-storage-snapshot > span")
            self.verify_element_by_id("table-snapshots-new")
            self.click_element_by_id("snapshots-check-all")
            self.click_element_by_id("more-actions-snapshots")
            print
            print "Test: Delete All Snapshots"
            self.click_element_by_link_text("Delete")
            self.click_element_by_id("button-dialog-deletesnapshot-delete")
        else:
            print "Test: Snapshot count on Dashboard was zero"
            print
        print "Finished: Delete Snapshot"
        print
        return 0

    def test_ui_register_snapshot_as_image(self, image_name):
        print
        print "Started Test: Register Snapshot as image"
        print
        print "Go to Dashboard"
	self.click_element_by_link_text("Dashboard")
        self.verify_element_by_link_text("Launch new instance")
	print "Test: Go to the Page Snapshot"
        self.click_element_by_css_selector("#dashboard-storage-snapshot > span")
	self.verify_element_by_id("table-snapshots-new")
        print "Click the 'ready' status, to check-mark the snapshot"
        self.click_element_by_css_selector("div.table-row-status.status-completed")
        print "Click the More actions button"
        self.click_element_by_id("more-actions-snapshots")
        self.click_element_by_link_text("Register as image")
{'fraction_non_alphanumeric': 0.08346630661593224, 'fraction_numerical': 0.001841168528292623, 'mean_word_length': 2.8271488961953968, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '3297470', 'n_tokens_mistral': 2358, 'n_tokens_neox': 2352, 'n_words': 492}