def test_verify_notify_msg_250(self):
        """
        Set the Retries to 250 and then click on the Save button.
        Verify that a warning notification appears
        Verify that the input has a red border to show an error.

        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        retriesInputElem = "//div[8]/div[2]/form[2]/p[3]/input"
        ip_addr_ping = "//div[8]/div[2]/form[2]/p[1]/input"
        enableBtn = "//div[8]/div[2]/form[1]/button[2]"
        retries = 250

        for outletBox in outletBoxList:
            time.sleep(5)
            outletBox.click()

            if not self.is_on(enableBtn):
                driver.wait_and_click(enableBtn, XPATH)

            driver.send_input(ip_addr_ping, XPATH, "8.8.8.8")
            driver.send_input(retriesInputElem, XPATH, retries)
            driver.wait_and_click(outlet_save_btn(), XPATH)

            assert self.is_hidden_string(notify_msg()) == False

            driver.element_click("btnOk", ID)
            driver.element_click(outlet_cancel_btn(), XPATH)

            assert self.has_error(retriesInputElem) == True
    def test_frequency_zero_input(self):
        """
        Set the Frequency to zero (0)
        Verify that a warning notification appears letting you know the valid range of cycle delay values
        Verify that the input has a red border to show an error.

        """
        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        freqInputElem = "//div[8]/div[2]/form[2]/p[2]/input"
        enableBtn = "//div[8]/div[2]/form[1]/button[2]"
        ip_addr_ping = "//div[8]/div[2]/form[2]/p[1]/input"
        frequency = 0

        for outletBox in outletBoxList:
            time.sleep(5)
            outletBox.click()

            if not self.is_on(enableBtn):
                driver.wait_and_click(enableBtn, XPATH)

            driver.send_input(ip_addr_ping, XPATH, "8.8.8.8")
            driver.send_input(freqInputElem, XPATH, frequency)
            driver.wait_and_click(outlet_save_btn(), XPATH)

            assert self.is_hidden_string(notify_msg()) == False

            driver.element_click("btnOk", ID)
            driver.element_click(outlet_cancel_btn(), XPATH)

            assert self.has_error(freqInputElem) == True
    def test_device_name(self):
        driver = SeleniumDriver(self.driver)
        deviceName = "//*[@id='deviceSettings']/p[2]/input"

        self.restore_device_settings()
        time.sleep(3)
        self.open_device_settings()

        deviceNameDefault = driver.get_element_attribute(
            deviceName, XPATH, VALUE)

        time.sleep(3)
        driver.send_input(deviceName, XPATH, "Unit Under Test.")

        driver.wait_and_click(save_btn(), XPATH)
        driver.wait_and_click(close_btn_msg(), XPATH)

        time.sleep(3)
        self.open_device_settings()

        driver.get_element(deviceName, XPATH)
        changedDeviceName = driver.get_element_attribute(
            deviceName, XPATH, VALUE)

        assert deviceNameDefault != changedDeviceName
    def test_account_name_number(self):
        driver = SeleniumDriver(self.driver)
        accountNameNum = "//*[@id='deviceSettings']/p[3]/input"

        self.restore_device_settings()
        time.sleep(3)
        self.open_device_settings()

        acctNameNumDefault = driver.get_element_attribute(
            accountNameNum, XPATH, VALUE)

        time.sleep(3)
        driver.send_input(accountNameNum, XPATH, "1234567890")

        driver.wait_and_click(save_btn(), XPATH)
        driver.wait_and_click(close_btn_msg(), XPATH)

        time.sleep(3)
        self.open_device_settings()

        driver.get_element(accountNameNum, XPATH)
        changedAcctNameNum = driver.get_element_attribute(
            accountNameNum, XPATH, VALUE)

        assert acctNameNumDefault != changedAcctNameNum
    def test_cycle_invalid_input(self):
        """
        - Set the Cycle Delay to zero (0) and then click on the Start Cycle button
        - Verify that a warning notification appears letting
        you know the valid range of cycle delay values
        - Verify that the input has a red border to show an error

        """
        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        cycleNum = 0  # cycle number in seconds
        cycleInput = '//div[8]/div[2]/form[1]/p[2]/input'
        startCycleBtn = "//div[8]/div[2]/form[1]/p[2]/button"

        index = 2
        for outletBox in outletBoxList:
            outletCtrlStr = ".//*[@id='outletControl']/div[{0}]/div[1]".format(
                index)
            time.sleep(5)

            if self.is_on(outletCtrlStr) is False:
                index += 1
            else:
                outletBox.click()
                driver.wait_until_clickable(cycleInput, XPATH)
                driver.send_input(cycleInput, XPATH, cycleNum)

                driver.element_click(startCycleBtn, XPATH)

                assert self.is_hidden_string(notify_msg()) == False

                driver.element_click("btnOk", ID)

                assert self.has_error(cycleInput) == True
                driver.wait_and_click(outlet_cancel_btn(), XPATH)
Exemplo n.º 6
0
    def test_sender_email(self):
        driver = SeleniumDriver(self.driver)
        send_email_input = "//*[@id='emailSettings']/div[1]/p[2]/input"
        invalid_emails = [
            'test@@test.com', '*****@*****.**', '@.com', 'test', 'test.com',
            '[email protected]', ''
        ]

        self.open_email_settings()
        time.sleep(3)
        self.default_ip_email_rep()
        time.sleep(3)

        for email in invalid_emails:
            driver.wait_until_clickable(send_email_input, XPATH)
            driver.send_input(send_email_input, XPATH, email)
            driver.wait_and_click(save_btn(), XPATH)

            assert self.has_error(send_email_input) == True
            assert self.is_hidden_string(notify_msg()) == False

            driver.element_click("btnOk", ID)
        driver.wait_and_click(cancel_btn(), XPATH)

        time.sleep(3)
        self.restore_email_settings()
    def test_device_location(self):
        driver = SeleniumDriver(self.driver)
        locationInput = "//*[@id='deviceSettings']/p[5]/input"

        self.restore_device_settings()
        time.sleep(3)
        self.open_device_settings()

        locationDefault = driver.get_element_attribute(locationInput, XPATH,
                                                       VALUE)

        time.sleep(3)
        driver.send_input(locationInput, XPATH, "The UUT is at this location.")

        driver.wait_and_click(save_btn(), XPATH)
        driver.wait_and_click(close_btn_msg(), XPATH)

        time.sleep(3)
        self.open_device_settings()

        driver.get_element(locationInput, XPATH)
        changedLocation = driver.get_element_attribute(locationInput, XPATH,
                                                       VALUE)

        assert locationDefault != changedLocation
Exemplo n.º 8
0
    def seq_up(self):
        """ Tests sequence up
            Asserts a valid delay input
        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        upBtn = ".//*[@id='sequenceControl']/div[2]/div/button[1]"
        initiateBtn = ".//*[@id='seqDelayCtrl']/div/button[2]"
        delayInput = ".//*[@id='seqDelayCtrl']/span/input"
        inputNum = 1

        numOfOutletBox = len(outletBoxList)
        index = 2
        for outlet in outletBoxList:
            if index > numOfOutletBox: break

            outletCtrlStr = ".//*[@id='outletControl']/div[{0}]/div[1]".format(index)

            if self.is_on(outletCtrlStr):
                index += 1
            else:
                driver.wait_and_click(upBtn, XPATH)
                driver.send_input(delayInput, XPATH, inputNum)

                driver.wait_and_click(initiateBtn, XPATH)
                break
    def test_edit_cancel_btn(self):
        """
        Verification of Outlet Edit mode and Cancel Button Functionality
        verify that the outlet has the “guitarSolo” class
        verify that the outlet no longer has the “guitarSolo” class

        """
        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        outletEditMode = "//div[8]"

        index = 2
        for outletBox in outletBoxList:
            expectedOpGood = True
            time.sleep(5)
            outletBox.click()

            outletElemClass = driver.get_element_attribute(outletEditMode, XPATH, ClASS)

            if 'guitarSolo' in outletElemClass:
                assert expectedOpGood == True

            driver.wait_and_click(outlet_cancel_btn(), XPATH)

            time.sleep(1)
            assert driver.is_element_present(outletEditMode, XPATH) == False

            index += 1
Exemplo n.º 10
0
    def open_network_settings(self):
        network_settings = "//nav/ul/li[7]"

        driver = SeleniumDriver(self.driver)
        driver.get_element(menu(), XPATH)
        driver.wait_and_click(menu(), XPATH)

        time.sleep(3)
        driver.force_click(network_settings, XPATH)
    def open_device_settings(self):
        menuIcon = ".//*[@id='wrapper']/header/i"
        deviceSettings = "//nav/ul/li[3]"

        driver = SeleniumDriver(self.driver)
        driver.get_element(menuIcon, XPATH)
        driver.wait_and_click(menuIcon, XPATH)
        time.sleep(3)
        driver.force_click(deviceSettings, XPATH)
Exemplo n.º 12
0
    def test_ip_host_name(self):
        driver = SeleniumDriver(self.driver)
        emailIpHost = "//*[@id='emailSettings']/div[1]/p[1]/input"
        inputBox = "//*[@id='emailSettings']/div[1]/p[1]/input"
        invalidIpHostNames = [
            '0.8.8.8', '8.8.8.0', '255.8.8.8', '20.255.90', '8.8.8',
            '8.8.8.8.8', 'exchange.map'
        ]

        self.open_email_settings()
        time.sleep(3)
        self.default_ip_email_rep()
        time.sleep(3)

        for name in invalidIpHostNames:
            driver.wait_until_clickable(emailIpHost, XPATH)
            driver.send_input(emailIpHost, XPATH, name)
            driver.wait_and_click(save_btn(), XPATH)

            ipHostVal = driver.get_element_attribute(emailIpHost, XPATH, VALUE)
            ipNodes = ip_nodes(ipHostVal)
            hostNodes = host_nodes(ipHostVal)

            assert self.is_hidden_string(notify_msg()) == False

            driver.element_click("btnOk", ID)

            assert self.has_error(inputBox) == True

            ipInputClass = driver.get_element_attribute(
                emailIpHost, XPATH, ClASS)

            expectedOpGood = True

            if name.startswith("0"):
                assert starts_with_zero(ipHostVal,
                                        ipInputClass) == expectedOpGood
            elif name.endswith("0"):
                assert ends_with_zero(ipHostVal,
                                      ipInputClass) == expectedOpGood
            elif "255" in name:
                assert node_255(ipHostVal, ipInputClass) == expectedOpGood
            elif len(ipNodes) < 4:
                assert short_ip_node_length(ipHostVal,
                                            ipInputClass) == expectedOpGood
            elif len(hostNodes) < 3:
                assert short_host_node_length(ipHostVal,
                                              ipInputClass) == expectedOpGood
            else:
                assert long_ip_node_length(ipHostVal,
                                           ipInputClass) == expectedOpGood

        driver.wait_and_click(cancel_btn(), XPATH)

        time.sleep(3)
        self.restore_email_settings()
    def test_initial_outlet_state(self):
        driver = SeleniumDriver(self.driver)
        iniOutletStateSelect = "//*[@id='deviceSettings']/p[6]/select"
        rememberPriorState = "//*[@id='deviceSettings']/p[6]/select/option[1]"

        self.restore_device_settings()
        time.sleep(3)
        self.open_device_settings()

        time.sleep(3)
        driver.wait_and_click(iniOutletStateSelect, XPATH)

        time.sleep(3)
        driver.wait_and_click(rememberPriorState, XPATH)

        driver.wait_and_click(save_btn(), XPATH)
        driver.wait_and_click(close_btn_msg(), XPATH)

        time.sleep(3)
        self.open_device_settings()

        select = Select(
            self.driver.find_element_by_xpath(iniOutletStateSelect))
        selected_option = select.first_selected_option

        if selected_option.text == 'Remember prior state':
            correctSelect = True
        else:
            correctSelect = False

        assert correctSelect == True
Exemplo n.º 14
0
    def test_power_state_btn_notify_msg(self):
        """
        Verifies that a popup comes up with an Are you sure… message.
        Look for the DOM element “notify”

        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        powerStateBtn = '//div[8]/div[2]/form[1]/button[1]'

        i=2
        for outletBox in outletBoxList:
            outletCtrlStr = "//*[@id='outletControl']/div[{0}]".format(i)
            time.sleep(5)
            driver.wait_and_click(outletCtrlStr, XPATH)

            if self.is_on(powerStateBtn):
                driver.wait_and_click(powerStateBtn, XPATH)

                assert self.is_hidden_string(notify_msg()) == False
                driver.wait_and_click("btnOk", ID)

                time.sleep(1)
                if driver.is_element_present(success_msg(), XPATH):
                    assert self.is_hidden_string(success_msg()) == False
                    time.sleep(3)
            else:
                driver.wait_and_click(outlet_cancel_btn(), XPATH)

            i += 1

        time.sleep(3)
        self.seq_up()
Exemplo n.º 15
0
    def test_power_state_verify_changed(self):
        """
        Verify that the switch and outlet face change state
        Verify that a success message appears
        Verify that the outlet shrinks out of edit mode

        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        powerStateBtn = '//div[8]/div[2]/form[1]/button[1]'
        outletEditMode = "//div[8]"

        index = 2
        for outletBox in outletBoxList:
            outletCtrlStr = ".//*[@id='outletControl']/div[{0}]/div[1]".format(index)
            time.sleep(5)
            driver.wait_and_click(outletCtrlStr, XPATH)

            if self.is_on(powerStateBtn):
                powerState = True
            else:
                powerState = False

            driver.wait_and_click(powerStateBtn, XPATH)
            driver.wait_and_click("btnOk", ID)

            time.sleep(1)
            if driver.is_element_present(close_btn_msg(), XPATH):
                driver.wait_and_click(close_btn_msg(), XPATH)
                assert self.is_hidden_string(success_msg()) == False

            time.sleep(1)
            assert driver.is_element_present(outletEditMode, XPATH) == False

            driver.element_click(outletCtrlStr, XPATH)

            if powerState:
                if self.is_on(powerStateBtn):
                    assert powerState == True
            else:
                assert powerState == False

            driver.wait_and_click(outlet_cancel_btn(), XPATH)

            index += 1

        time.sleep(3)
        self.seq_up()
    def turn_outlets_off(self):
        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        numOfOutletBox = len(outletBoxList)

        downBtn = ".//*[@id='sequenceControl']/div[2]/div/button[2]"
        initiateBtn = ".//*[@id='seqDelayCtrl']/div/button[2]"
        delayInput = ".//*[@id='seqDelayCtrl']/span/input"
        inputNum = 1

        driver.wait_and_click(downBtn, XPATH)
        driver.send_input(delayInput, XPATH, inputNum)

        driver.wait_and_click(initiateBtn, XPATH)

        time.sleep(inputNum * numOfOutletBox)
Exemplo n.º 17
0
    def restore_email_settings(self):
        driver = SeleniumDriver(self.driver)
        factoryDefaults = "//nav/ul/li[5]"
        restoreEmailSett = "//*[@id='factoryDefaults']/p[7]/input"

        driver.wait_and_click(menu(), XPATH)
        time.sleep(3)
        driver.force_click(factoryDefaults, XPATH)

        time.sleep(3)
        driver.element_click(restoreEmailSett, XPATH)
        driver.wait_and_click(save_btn(), XPATH)

        time.sleep(
            11
        )  # wait for 10 seconds plus another second to click on OK button
        driver.element_click("btnOk", ID)
    def test_seq_down(self):
        """ Tests sequence down
            Asserts a valid delay input
        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        outletsWithStateOff = self.driver.find_elements_by_class_name("state-off")

        downBtn = ".//*[@id='sequenceControl']/div[2]/div/button[2]"
        initiateBtn = ".//*[@id='seqDelayCtrl']/div/button[2]"
        delayInput = ".//*[@id='seqDelayCtrl']/span/input"
        inputNum = 3

        numOfOutletBox = len(outletBoxList)
        numOutletsStateOff = len(outletsWithStateOff)

        self.restore_seq_defaults()

        time.sleep(4)
        if numOutletsStateOff == numOfOutletBox:
            self.turn_outlets_on()

        index = numOfOutletBox
        for outlet in outletBoxList[::-1]:
            outletCtrlStr = ".//*[@id='outletControl']/div[{0}]/div[1]".format(index)

            if self.is_on(outletCtrlStr) is False:
                index -= 1
            else:
                driver.wait_and_click(downBtn, XPATH)
                driver.send_input(delayInput, XPATH, inputNum)

                delayInputVal = driver.get_element_attribute(delayInput, XPATH, VALUE)
                assert 255 >= int(delayInputVal) >= 1

                driver.wait_and_click(initiateBtn, XPATH)
                break
        time.sleep(inputNum * numOfOutletBox)

        outletsWithStateOff = self.driver.find_elements_by_class_name("state-off")
        numOutletsStateOff = len(outletsWithStateOff)
        assert numOutletsStateOff == numOfOutletBox

        self.turn_outlets_on()
Exemplo n.º 19
0
    def restore_network_settings(self):
        driver = SeleniumDriver(self.driver)
        menuIcon = ".//*[@id='wrapper']/header/i"
        factoryDefaults = "//nav/ul/li[5]"
        restore_network_def = "//*[@id='factoryDefaults']/p[10]/input"

        driver.wait_and_click(menuIcon, XPATH)
        time.sleep(3)
        driver.force_click(factoryDefaults, XPATH)

        time.sleep(3)
        driver.element_click(restore_network_def, XPATH)
        driver.wait_and_click(save_btn(), XPATH)

        time.sleep(
            11
        )  # wait for 10 seconds plus another second to click on OK button
        driver.element_click("btnOk", ID)
Exemplo n.º 20
0
    def default_ip_email_rep(self):
        driver = SeleniumDriver(self.driver)
        emailIpHost = "//*[@id='emailSettings']/div[1]/p[1]/input"
        senderEmail = "//*[@id='emailSettings']/div[1]/p[2]/input"
        addRepBtn = "//*[@id='emailSettings']/div[3]/p[2]/button"  # add recipient button
        repName = "//*[@id='emailSettings']/div[3]/div[2]/p[1]/input"
        repEmail = "//*[@id='emailSettings']/div[3]/div[2]/p[2]/input"
        recpEntry = "//*[@id='emailSettings']/div[3]/div[2]"

        if not driver.is_element_present(recpEntry, XPATH):
            driver.wait_and_click(addRepBtn, XPATH)
            time.sleep(3)

        driver.send_input(emailIpHost, XPATH, "12.12.12.12")
        driver.send_input(senderEmail, XPATH, "*****@*****.**")

        driver.send_input(repName, XPATH, "Test Test")
        driver.send_input(repEmail, XPATH, "*****@*****.**")
    def test_outlet_name_length(self):
        """
        function to test outlets' name
        outlet name can only accept up to 50 characters (letters, digits, and special characters)

        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        outletNameElement = '//div[8]/div[2]/input'

        # Random characters with a length of 50 to test outlet's name
        randomChars = 'g#QUfjeTakWbxHCS*6RQ579Wq6sBV3AT?#T!DrZ6#yJpbZzC$@'

        i = 2
        for outletBox in outletBoxList:
            outletCtrlStr = ".//*[@id='outletControl']/div[{0}]/div[1]".format(
                i)
            time.sleep(5)
            driver.wait_and_click(outletCtrlStr, XPATH)
            driver.wait_for_visibility(outletNameElement, XPATH)
            driver.send_input(outletNameElement, XPATH, randomChars)

            driver.wait_and_click(outlet_save_btn(), XPATH)

            time.sleep(2)
            if driver.is_element_present(close_btn_msg(), XPATH):
                assert self.is_hidden_string(success_msg()) == False
                driver.wait_and_click(close_btn_msg(), XPATH)

            time.sleep(5)
            driver.wait_and_click(outletCtrlStr, XPATH)
            inputValue = driver.get_element_attribute(outletNameElement, XPATH,
                                                      VALUE)

            #  assert input
            assert 50 >= len(inputValue) >= 1

            driver.wait_and_click(outlet_cancel_btn(), XPATH)

            i += 1

        time.sleep(3)
        self.restore_outlet_defaults()
    def test_seq_up(self):
        """ Tests sequence up
            Asserts a valid delay input
        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        upBtn = ".//*[@id='sequenceControl']/div[2]/div/button[1]"
        initiateBtn = ".//*[@id='seqDelayCtrl']/div/button[2]"
        delayInput = ".//*[@id='seqDelayCtrl']/span/input"
        inputNum = 3

        numOfOutletBox = len(outletBoxList)

        outletsWithStateOn = self.driver.find_elements_by_class_name("state-on")
        numOutletsStateOn = len(outletsWithStateOn)

        if numOutletsStateOn == numOfOutletBox:
            self.turn_outlets_off()

        index = 2
        for outlet in outletBoxList:
            if index > numOfOutletBox: break

            outletCtrlStr = ".//*[@id='outletControl']/div[{0}]/div[1]".format(index)

            if self.is_on(outletCtrlStr):
                index += 1
            else:
                driver.wait_and_click(upBtn, XPATH)
                driver.send_input(delayInput, XPATH, inputNum)

                delayInputVal = driver.get_element_attribute(delayInput, XPATH, VALUE)
                assert 255 >= int(delayInputVal) >= 1

                driver.wait_and_click(initiateBtn, XPATH)
                break

        time.sleep(inputNum * numOfOutletBox)

        outletsWithStateOn = self.driver.find_elements_by_class_name("state-on")
        numOutletsStateOn = len(outletsWithStateOn)
        assert numOutletsStateOn == numOfOutletBox
    def restore_seq_defaults(self):
        """ This function will set the in sequence checkbox of all of the outlets """

        driver = SeleniumDriver(self.driver)
        menuIcon = ".//*[@id='wrapper']/header/i"
        factoryDefaults = "//nav/ul/li[5]"
        restoreSeqDef = "//*[@id='factoryDefaults']/p[9]/input"

        driver.wait_and_click(menuIcon, XPATH)
        time.sleep(3)
        driver.force_click(factoryDefaults, XPATH)

        time.sleep(3)

        driver.element_click(restoreSeqDef, XPATH)
        driver.wait_and_click(save_btn(), XPATH)

        time.sleep(11)
        driver.element_click("btnOk", ID)
Exemplo n.º 24
0
    def test_network(self):
        driver = SeleniumDriver(self.driver)
        DHCPCheckBox = "//*[@id='networkSettings']/div[3]/input"
        HTTPPort = "//*[@id='networkHttpPort']"
        network_ip_address = "//*[@id='networkIPAddress']"
        subnet_mask = "//*[@id='networkSettings']/p[2]/input"
        gateway = "//*[@id='networkSettings']/p[3]/input"
        dns_1 = ".//*[@id='networkSettings']/p[4]/input"
        dns_2 = "//*[@id='networkSettings']/p[5]/input"
        invalid_ips = [
            '0.8.8.8', '8.8.8.0', '255.8.8.8', '20.255.80', '8.8.8',
            '8.8.8.8.8'
        ]

        self.open_network_settings()
        time.sleep(3)

        driver.send_input(HTTPPort, XPATH, "---")
        driver.wait_and_click(save_btn(), XPATH)

        assert self.is_hidden_string(notify_msg()) == False

        driver.wait_and_click("btnOk", ID)

        driver.wait_and_click(DHCPCheckBox, XPATH)

        for ip in invalid_ips:
            driver.wait_until_clickable(network_ip_address, XPATH)
            driver.send_input(network_ip_address, XPATH, ip)
            driver.send_input(subnet_mask, XPATH, ip)
            driver.send_input(gateway, XPATH, ip)
            driver.send_input(dns_1, XPATH, ip)
            driver.send_input(dns_2, XPATH, ip)
            driver.wait_and_click(save_btn(), XPATH)

            assert self.has_error(network_ip_address) == True
            assert self.is_hidden_string(notify_msg()) == False

            driver.element_click("btnOk", ID)
        driver.wait_and_click(cancel_btn(), XPATH)

        time.sleep(3)
        self.restore_network_settings()
    def test_inSeq_selected(self):
        """
        Asserts each outlet is in-sequence
        This function clicks on each outlet and make sure the check
        box is checked. If it is already checked, then it continues to the next
        outlet
        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        inSeqInput = "//div[8]/div[2]/form[1]/p[1]/input"
        outletsWithStateOff = self.driver.find_elements_by_class_name("state-off")

        numOfOutletBox = len(outletBoxList)
        numOutletsStateOff = len(outletsWithStateOff)

        if numOutletsStateOff == numOfOutletBox:
            assert numOutletsStateOff == numOfOutletBox
            print "\nAll outlets are already off"
            return

        index = 2
        for outletBox in outletBoxList:
            outletCtrlStr = ".//*[@id='outletControl']/div[{0}]/div[1]".format(index)
            time.sleep(5)
            driver.wait_and_click(outletCtrlStr, XPATH)
            time.sleep(3)

            if not driver.is_element_selected(inSeqInput, XPATH):
                driver.wait_for_visibility(inSeqInput, XPATH)
                driver.element_click(inSeqInput, XPATH)
                assert driver.is_element_selected(inSeqInput, XPATH) == True
                driver.wait_and_click(outlet_save_btn(), XPATH)
                driver.wait_and_click(close_btn_msg(), XPATH)
            else:
                driver.wait_and_click(outlet_save_btn(), XPATH)
                driver.wait_and_click(close_btn_msg(), XPATH)

            if 'in-sequence' in outletBox.get_attribute(ClASS):
                assert 'in-sequence' in outletBox.get_attribute(ClASS)

            index += 1
    def test_seq_power_up(self):
        driver = SeleniumDriver(self.driver)
        sequenceState = "sequenceState"

        self.restore_device_settings()
        time.sleep(3)
        self.open_device_settings()

        sequenceStateDefault = driver.get_element_attribute(
            sequenceState, ID, ClASS)

        time.sleep(3)
        driver.wait_and_click(sequenceState, ID)

        driver.wait_and_click(save_btn(), XPATH)
        driver.wait_and_click(close_btn_msg(), XPATH)

        time.sleep(3)
        self.open_device_settings()

        driver.get_element(sequenceState, ID)
        changedSequenceState = driver.get_element_attribute(
            sequenceState, ID, ClASS)

        assert sequenceStateDefault != changedSequenceState
    def ctrl_device_power(self):
        """
        This function opens the control device url to turn on/off the
         third outlet (RLNK-915R) to test UUT auto ping response

        """
        outlet3 = "//*[@id='outletControl']/div[4]"
        stateBtn = "html/body/div[8]/div[2]/form[1]/button[1]"

        self.ctrlDriver = webdriver.Firefox()
        self.ctrlDriver.implicitly_wait(10)

        ipAddress = get_ip_addresses()
        self.ctrlUrl = ipAddress[1]  # control device url
        try:
            self.ctrlDriver.get(self.ctrlUrl)
        except:
            print "Invalid IP Address"

        ctrlDriver = SeleniumDriver(self.ctrlDriver)
        ctrlDriver.element_click(outlet3, XPATH)

        # turn outlet off and close success message alert
        time.sleep(3)
        ctrlDriver.wait_and_click(stateBtn, XPATH)
        ctrlDriver.wait_and_click("btnOk", ID)
        ctrlDriver.wait_and_click(close_btn_msg(), XPATH)

        time.sleep(3)
        self.ctrlDriver.quit()
    def test_outlet_name_blank(self):
        """
        Verify that the name input box has a red border
        after changing the name to blank/empty

        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        outletNameElement = '//div[8]/div[2]/input'

        for outletBox in outletBoxList:
            time.sleep(5)
            outletBox.click()
            driver.wait_until_clickable(outletNameElement, XPATH)
            driver.get_element(outletNameElement, XPATH).clear()

            driver.wait_and_click(outlet_save_btn(), XPATH)

            assert self.is_hidden_string(notify_msg()) == False

            driver.wait_and_click("btnOk", ID)
            driver.wait_and_click(outlet_cancel_btn(), XPATH)

            assert self.has_error(outletNameElement) == True
    def test_verify_success_msg(self):
        """
        Verify that the Success message appears
        Verify that the outlet shrinks out edit mode and return to original location

        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        retriesInputElem = "//div[8]/div[2]/form[2]/p[3]/input"
        ip_addr_ping = "//div[8]/div[2]/form[2]/p[1]/input"
        enableBtn = "//div[8]/div[2]/form[1]/button[2]"
        outlet_div = "//div[8]"
        retries = 5

        for outletBox in outletBoxList:
            time.sleep(5)
            outletBox.click()

            if not self.is_on(enableBtn):
                driver.wait_and_click(enableBtn, XPATH)

            driver.send_input(ip_addr_ping, XPATH, "8.8.8.8")
            driver.send_input(retriesInputElem, XPATH, retries)
            driver.wait_and_click(outlet_save_btn(), XPATH)

            driver.wait_for_visibility(success_msg(), XPATH)
            assert self.is_hidden_string(success_msg()) == False

            driver.wait_and_click(close_btn_msg(), XPATH)

            driver.wait_for_invisibility(outlet_div, XPATH)
            assert driver.is_element_present(outlet_div, XPATH) == False
Exemplo n.º 30
0
    def test_power_state_verify_not_changed(self):
        """
        Verify that the power state has not changed
        after clicking the cancel button

        """

        driver = SeleniumDriver(self.driver)
        outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())
        powerStateBtn = '//div[8]/div[2]/form[1]/button[1]'

        for outletBox in outletBoxList:
            time.sleep(5)
            outletBox.click()

            if self.is_on(powerStateBtn):
                powerState = True
            else:
                powerState = False

            driver.wait_and_click(powerStateBtn, XPATH)
            driver.wait_and_click("btnCancel", ID)
            driver.wait_and_click(outlet_cancel_btn(), XPATH)

            if powerState:
                assert powerState == True

            if self.is_on(powerStateBtn) is False:
                assert powerState == False