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_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 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)