def test_e2e_delivery_dominos(self,driver): navigate_to_payment(driver) deliveryInstructions="//*[@id='Delivery_Instructions']" instruction="Call" Keywords.enterText(driver,instruction,deliveryInstructions) Keywords.WebElement(driver,deliveryInstructions).send_keys(Keys.TAB) #Value not populated in the HTML page and not able to Assert if the text has been entered #assert (Keywords.getAttributeValue(driver,deliveryInstructions)==instruction),"Assert Delivery Instructions not entered correctly" fill_form(driver)
def fill_form(driver): firstName="//*[@id='First_Name']" fName="Anvesh" Keywords.enterText(driver,fName,firstName) #Value not populated in the HTML page and not able to Assert if the text has been entered #assert (Keywords.getAttributeValue(driver,firstName)==fName),"First Name Not entered correctly" lastName="//*[@id='Last_Name']" lName="Malhotra" Keywords.enterText(driver,lName,lastName) Keywords.WebElement(driver,lastName).send_keys(Keys.TAB) #Value not populated in the HTML page and not able to Assert if the text has been entered #assert (Keywords.getAttributeValue(driver,lastName)==lName),"Last Name not entered correctly" email="//*[@id='Email']" emailAddress="*****@*****.**" Keywords.enterText(driver,emailAddress,email) Keywords.WebElement(driver,email).send_keys(Keys.TAB) #Value not populated in the HTML page and not able to Assert if the text has been entered #assert (Keywords.getAttributeValue(driver,email)==emailAddress),"Email Addres not entered correctly" callbackPhone="//*[@id='Callback_Phone']" phone="1234567890" Keywords.enterText(driver,phone,callbackPhone) Keywords.WebElement(driver,callbackPhone).send_keys(Keys.TAB) #Value not populated in the HTML page and not able to Assert if the text has been entered #assert (Keywords.getAttributeValue(driver,callbackPhone)==phone),"Phone not entered correctly" payAtStore="//*[contains(@class,'c-order-payment-cash')]" Keywords.ClickElement(driver,payAtStore) assert (Keywords.isElementSelected(driver,payAtStore)==True),"payment not selected correctly"
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"
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)
def navigate_to_select_pizza(driver): #Get to the pizza select page navigate_to_dominos(driver) carryout_button = "//*[contains(@class,'js-carryout')]" Keywords.ClickElement(driver, carryout_button) carryoutRadio = "//*[@name='Service_Type'][contains(@value,'Carryout')]" Keywords.isElementVisible(driver, carryoutRadio) zip_code = "//*[@name='Postal_Code']" zip_codeValue = "85281" Keywords.enterText(driver, "85281", zip_code) 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']" cityValue = "TEMPE" Keywords.enterText(driver, cityValue, city) state = "//*[@name='Region']" Keywords.ClickElement(driver, state) state_AZ = "//*[@name='Region']/option[contains(text(),'AZ')]" stateValue = "AZ" Keywords.ClickElement(driver, state_AZ) submit = "//*[@type='submit']" Keywords.ClickElement(driver, submit) Keywords.isElementVisible(driver, "//*[@class='based-on']") orderCarryOutLocation = "//*[contains(@class,'search-results-list')]/div/div[1]/div/a" Keywords.ClickElement(driver, orderCarryOutLocation) changeOrderTimingOverlay = "//*[@id='changeOrderTimingOverlay']/div/form//div/select" if (len(driver.find_elements_by_xpath(changeOrderTimingOverlay)) > 0): Keywords.ClickElement(changeOrderTimingOverlay) selectTime = changeOrderTimingOverlay + "/option[3]" Keywords.ClickElement(selectTime) awaitingOrder = "//*[contains(@class,'js-emptyMessage')]" Keywords.isElementVisible(driver, awaitingOrder)
def navigate_to_select_pizza(driver): #Get to the pizza select page navigate_to_dominos(driver) delivery_button = "//*[contains(@class,'js-delivery')]" Keywords.ClickElement(driver, delivery_button) deliveryRadio = "//*[@name='Service_Type'][contains(@value,'Delivery')]" Keywords.isElementVisible(driver, deliveryRadio) zip_code = "//*[@name='Postal_Code']" zip_codeValue = "85281" Keywords.enterText(driver, "85281", zip_code) # 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']" cityValue = "TEMPE" Keywords.enterText(driver, cityValue, city) state = "//*[@name='Region']" Keywords.ClickElement(driver, state) state_AZ = "//*[@name='Region']/option[contains(text(),'AZ')]" stateValue = "AZ" Keywords.ClickElement(driver, state_AZ) addressPath = "//*[@id='Address_Type_Select']/option[contains(text(),'House')]" Keywords.ClickElement(driver, addressPath) street_address = "//*[@name='Street']" randomStreet = "1215 E Vista Del Cerro Drive" Keywords.enterText(driver, randomStreet, street_address) address_line2 = "//*[@name='Address_Line_2']" randomAddressLine2 = "Apartment 1016S" Keywords.enterText(driver, randomAddressLine2, address_line2) submit = "//*[@type='submit']" Keywords.ClickElement(driver, submit) if (len(driver.find_elements_by_xpath("//*[@class='based-on']")) > 0): orderCarryOutLocation = "//*[contains(@class,'search-results-list')]/div/div[1]/div/a" Keywords.ClickElement(driver, orderCarryOutLocation) changeOrderTimingOverlay = "//*[@id='changeOrderTimingOverlay']/div/form//div/select" if (len(driver.find_elements_by_xpath(changeOrderTimingOverlay)) > 0): Keywords.ClickElement(changeOrderTimingOverlay) selectTime = changeOrderTimingOverlay + "/option[3]" Keywords.ClickElement(selectTime) awaitingOrder = "//*[contains(@class,'js-emptyMessage')]" Keywords.isElementVisible(driver, awaitingOrder)