コード例 #1
0
 def setUp(self):
     if not self.config:
         if C2TestSuite.driver_name is not None:
             if C2TestSuite.config is None:
                 self.config = selenium_config.SeleniumConfigManager().get_config(C2TestSuite.driver_name)
             else:
                 self.config = C2TestSuite.config
         else:
             if C2TestSuite.config is None:
                 self.config = selenium_config.default_config()
             else:
                 self.config = C2TestSuite.config
     self.tests = []
     self.loaded_tests = []
コード例 #2
0
sys.path.append('..')
import c2_test_case
import selenium_config
import unittest, time, re, os, subprocess

class BuildWrapper(c2_test_case.C2TestCase):
    def test_device_info(self):
        driver = self.config.driver
        ResetBrowserPath = "//div[@id='mainPanelView']/div[2]/form/div/div/div[2]/div/button[2]"
        ResetWebBrowserClosePath = "//div[@id='resetGuacamoleWindowContent']/div/form/div/div/div[2]/img"
        print "The General Test will now start."
        time.sleep(6)
        driver.find_element_by_link_text("System Settings").click()
        time.sleep(5)
        print "C11553 will now be tested."
        #have test check system settings
        print "C11554 will now be tested."
        driver.find_element_by_xpath(ResetBrowserPath).click()
        time.sleep(3)
        driver.find_element_by_xpath(ResetWebBrowserClosePath).click()
        """
        Test cases to implement:
        -System Information Should Display Correctly
        -Reset Browser Dialog
        -Reboot Dialog
        """

if __name__ == "__main__":
    BuildWrapper.config = selenium_config.default_config()
    unittest.main()
コード例 #3
0
                    Build[number] = BuildStatus
                    print "This is build at this point: " % Build
                    break
        #to create new Excel file for build:
        with open(
                'SiteGateDevices.csv'
        ) as f:  #opens text file and reads and labels/numbers the rows
            reader = csv.DictReader(f)
            for row in reader:
                for (k, v) in row.items():
                    columns[k].append(v)
            RowAmount = len(
                open('SiteGateDevices.csv').readlines())  #counts the rows
            print "This is the row amount: %d" % RowAmount  #row amount
            with open('BuildStatus.csv', 'wb') as w:
                fieldnames = ['Device Type', 'Build']
                writer = csv.DictWriter(w, fieldnames=fieldnames)
                writer.writeheader()
                count1 = 0
                for count1 in range(0, (RowAmount - 1)):
                    writer.writerow({
                        'Device Type': (columns['Device Type'][count1]),
                        'Build': (Build[count1])
                    })
        print "The build devices test is now complete."


if __name__ == "__main__":
    AddDeviceTestDevice.config = selenium_config.default_config()
    unittest.main()
コード例 #4
0
            time.sleep(3)
            driver.find_element_by_xpath(ResetButtonPath).click()
            #time.sleep(1)
            if ("The remote web interface is being reset. You may now close this window."
                ) not in self.config.driver.page_source:
                print "The reset message is not displaying. C117061 fails."
            else:
                print "The reset message is displaying. C117061 passes."
            try:
                driver.find_element_by_xpath(ResetWebBrowserClosePath).click()
            except Exception:
                print "Close button doesn't close the dialog. C117062 fails."
            try:
                driver.find_element_by_xpath(ResetWebBrowserClosePath).click()
                print "Close button didn't close the dialog. C117062 fails."
            except Exception:
                print "Close button closed the dialog. C117062 passes."
        except Exception:
            print "Reset Browser dialog did not open. C11554 fails and C117061 and C117062 cannot be tested."
        time.sleep(3)
        """
        Test cases to implement:
        -Should display message C117061
        -Close Button should close dialog C117062
        """


if __name__ == "__main__":
    ResetSystem.config = selenium_config.default_config()
    unittest.main()
コード例 #5
0
        time.sleep(4)
        if ("Class" and "Type" and "Primary IP Address") not in self.config.driver.page_source:
            print "Default text is not displaying. The Device Info Canvas may be blank."
        else:
            print "The Device Info Canvas is not blank."
        driver.find_element_by_link_text("WAN Settings").click()
        time.sleep(4)
        if ("MAC Address" and "Link Status" and "Config Method" and "IP Address" and "Netmask" and "Gateway" and "DNS Server 1" and "DNS Server 2") not in self.config.driver.page_source:
            print "Default text is not displaying. The WAN Settings Canvas may be blank."
        else:
            print "The WAN Settings Canvas is not blank."
        driver.find_element_by_link_text("LAN Settings").click()
        time.sleep(4)
        if ("LAN Port Settings (Device Ports)" and "Local IP Address" and "Subnet Mask" and "MGMT Port Settings (Management Port)" and "IP Address" and "Subnet Mask") not in self.config.driver.page_source:
            print "Default text is not displaying. The LAN Settings Canvas may be blank."
        else:
            print "The LAN Settings Canvas page is not blank."
        driver.find_element_by_link_text("System Settings").click()
        time.sleep(4)
        if ("System Information" and "Disk Usage" and "Memory Usage" and "CPU Usage" and "SiteGate ID") not in self.config.driver.page_source:
            print "Default text is not displaying. The System Settings Canvas may be blank."
        else:
            print "The System Settings Canvas is not blank."
        print "The Switching Between Canvases Test is now complete."
        "Later implement the loading symbol but since it does not exist yet we cannot."


if __name__ == "__main__":
    SwitchCanvases.config = selenium_config.default_config()
    unittest.main()
コード例 #6
0
                    PropScan[number] = PropScanStatus
                    break
        with open(
                'SiteGateDevices.csv'
        ) as f:  #opens text file and reads and labels/numbers the rows
            reader = csv.DictReader(f)
            for row in reader:
                for (k, v) in row.items():
                    columns[k].append(v)
            RowAmount = len(
                open('SiteGateDevices.csv').readlines())  #counts the rows
            print "This is the row amount: %d" % RowAmount  #row amount
            print "These are the Device Types: %s" % columns['Device Type']
            with open('ScanStatus.csv', 'wb') as w:
                fieldnames = ['Device Type', 'Alarm Scan', 'Property Scan']
                writer = csv.DictWriter(w, fieldnames=fieldnames)
                writer.writeheader()
                count1 = 0
                for count1 in range(0, (RowAmount - 1)):
                    writer.writerow({
                        'Device Type': (columns['Device Type'][count1]),
                        'Alarm Scan': (Scan[count1]),
                        'Property Scan': (PropScan[count1])
                    })
        print "The scan devices test is now complete."


if __name__ == "__main__":
    ScanDevice.config = selenium_config.default_config()
    unittest.main()
コード例 #7
0
 def setUp(self):
     if not self.config:
         self.config = selenium_config.default_config()
     self.verificationErrors = []
     self.accept_next_alert = True
コード例 #8
0
                time.sleep(6)
                Element = driver.find_element_by_xpath(FirstDevicePath)
                time.sleep(7)
                ElementText = Element.text
                print ElementText
                if ElementText == "1":
                    driver.find_element_by_xpath(RemoveDevice).click()
                    time.sleep(1)
                    driver.find_element_by_id("remove-device-yes").click()
                    time.sleep(10)
                    count2 = 25
            except Exception:
                print "Did not delete"
        else:
            print "No device was built therefore we cannot know which device to delete."
        Element2 = driver.find_element_by_xpath(FirstDevicePath)
        if Element2.text == "1":
            print "The device was not removed. This test failed."

        print "The Remove Wrapper Test is now complete."
        """
        Test cases to be implemented w/ this test:
        -Remove Device Button should remove device from Network Tree *** How...? :: Put in a few trap devs
        -Remove Device button should not be available for SiteGate Node
        """


if __name__ == "__main__":
    RemoveWrapper.config = selenium_config.default_config()
    unittest.main()
コード例 #9
0
                        driver.find_element_by_xpath(SubDevicePath).click() #link to first subdevice
                        #INSERT SUBDEVICESTUFF HERE
                        count = 10
                        time.sleep(5)
                except Exception:
                    print "This device does not have any sub-devices. The test will keep running until it finds a device with subdevices."
            except Exception:
                print "There are no devices built therefore this test can only test the root node BreadCrumb."
                break
            try:
                driver = self.config.driver
                driver.find_element_by_xpath(DeviceInfo).click()
                time.sleep(5)
                DeviceTypeElement = driver.find_element_by_xpath(DeviceType) #G
                DeviceTypeText = DeviceTypeElement.text
                driver.find_element_by_css_selector(BreadCrumbCSS).click()
                time.sleep(5)
                BreadCrumbDeviceTypeElement = driver.find_element_by_xpath(DeviceType)
                BreadCrumbDeviceText = BreadCrumbDeviceTypeElement.text
                if DeviceTypeText != BreadCrumbDeviceText:
                    print "The breadcrumb did not go to the correct location."
                else:
                    print "The breadcrumb is working as expected."
            except Exception:
                print "The breadcrumb test did not complete."
        print "The Bread Crumb Test is now complete."

if __name__ == "__main__":
    BreadCrumb.config = selenium_config.default_config()
    unittest.main()