예제 #1
0
    def test_delivery_address_ui_component(self,driver):
        navigate_to_dominos(driver)
        delivery_button="//*[contains(@class,'js-delivery')]"
        Keywords.ClickElement(driver, delivery_button)
        deliveryRadio="//*[@name='Service_Type'][contains(@value,'Delivery')]"
        Keywords.isElementSelected(driver, deliveryRadio)
        
        addressPath="//*[@id='Address_Type_Select']/option[contains(text(),'House')]"
        Keywords.ClickElement(driver, addressPath)
         
        street_address="//*[@name='Street']"
        randomStreet=Keywords.generateRandom('letter','digits','punctuation',20)
        Keywords.enterText(driver,randomStreet,street_address)
        Keywords.WebElement(driver,street_address).send_keys(Keys.TAB)
        assert (Keywords.getAttributeValue(driver,street_address)==randomStreet),"Street address not entered correctly"
         
        address_line2="//*[@name='Address_Line_2']"
        randomAddressLine2=Keywords.generateRandom('letter','digits','punctuation',10)
        Keywords.enterText(driver,randomAddressLine2,address_line2)
        Keywords.WebElement(driver,address_line2).send_keys(Keys.TAB)
        assert (Keywords.getAttributeValue(driver,address_line2)==randomAddressLine2),"Street address 2 not entered correctly"
         
        city="//*[@name='City']" 
        randomCity=Keywords.generateRandom('letter','digits','punctuation',20)
        Keywords.enterText(driver,randomCity,city)
        Keywords.WebElement(driver,city).send_keys(Keys.TAB)
        assert (Keywords.getAttributeValue(driver,city)==randomCity),"City is not entered correctly"
 
        state="//*[@name='Region']"
        Keywords.ClickElement(driver,state)
        state_AZ="//*[@name='Region']/option[contains(text(),'AZ')]"
        Keywords.ClickElement(driver,state_AZ)
         
        zip_code="//*[@name='Postal_Code']"
        randomZip=Keywords.generateRandom('letter','digits','punctuation',20)
        Keywords.enterText(driver,randomZip,zip_code)
        Keywords.WebElement(driver,zip_code).send_keys(Keys.TAB)
        assert (Keywords.getAttributeValue(driver,zip_code)!=randomZip),"Zip Code entered with Alphabets and Punctuation"
         
         
         
         
         
         
         
         
         
         
예제 #2
0
 def test_carryout_address_ui_component(self,driver):
     navigate_to_dominos(driver)
     carryout_button="//*[contains(@class,'js-carryout')]"
     Keywords.ClickElement(driver, carryout_button)
     carryoutRadio="//*[@name='Service_Type'][contains(@value,'Carryout')]"
     Keywords.isElementSelected(driver, carryoutRadio)
     
     zip_code="//*[@name='Postal_Code']"
     randomZip=Keywords.generateRandom('letter','digits','punctuation',20)
     Keywords.enterText(driver,randomZip,zip_code)
     Keywords.WebElement(driver,zip_code).send_keys(Keys.TAB)
     assert (Keywords.getAttributeValue(driver,zip_code)!=randomZip),"Zip Code entered with Alphabets and Punctuation"
     
     toggleZip="//*[contains(@class,'toggle-zip')]/a"
     if(len(driver.find_elements_by_xpath((toggleZip)))>0):
         driver.find_element_by_xpath(toggleZip).click()
     
     city="//*[@name='City']" 
     randomCity=Keywords.generateRandom('letter','digits','punctuation',20)
     Keywords.enterText(driver,randomCity,city)
     Keywords.WebElement(driver,city).send_keys(Keys.TAB)
     assert (Keywords.getAttributeValue(driver,city)==randomCity),"City is not entered correctly"
      
     state="//*[@name='Region']"
     Keywords.ClickElement(driver,state)
     state_AZ="//*[@name='Region']/option[contains(text(),'AZ')]"
     Keywords.ClickElement(driver,state_AZ)