class CreateCustomer(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getscreenshotTest = GetScreenshot(self.driver) def test_CreateCustomer(self): Login.test_Login(self) CreateCustomerlink = self.getValue.getElement("XPATH", "CreateCustomerlink") KfName = self.getValue.getElement("XPATH", "KfName") KfBcBtn = self.getValue.getElement("XPATH", "KfBcBtn") IKfName = self.getValue.getInputValue("CreateCustomer", "KfName") time.sleep(20) self.driver.find_element_by_xpath(CreateCustomerlink).click() self.driver.find_element_by_xpath(KfName).send_keys(IKfName) self.driver.find_element_by_xpath(KfBcBtn).click() time.sleep(5) self.getscreenshotTest.screenshot("Createcustomer") def tearDown(self): Login.tearDown(self) if __name__ == "__main__": unittest.main()
class CreateClue(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getscreenshotTest = GetScreenshot(self.driver) def test_CreateClue(self): Login.test_Login(self) CreateClueLink = self.getValue.getElement("XPATH", "CreateClueLink") LxName = self.getValue.getElement("XPATH", "LxName") LxPhone = self.getValue.getElement("XPATH", "LxPhone") LXEmail = self.getValue.getElement("XPATH", "LXEmail") Ilxname = self.getValue.getInputValue("CreateClue", "Ilxname") Ilxphone = self.getValue.getInputValue("CreateClue", "Ilxphone") Ilxemail = self.getValue.getInputValue("CreateClue", "Ilxemail") time.sleep(5) self.driver.find_element_by_xpath(CreateClueLink).click() self.driver.find_element_by_xpath(LxName).send_keys(Ilxname) self.driver.find_element_by_xpath(LxPhone).send_keys(Ilxphone) self.driver.find_element_by_xpath(LXEmail).send_keys(Ilxemail) time.sleep(5) self.getscreenshotTest.screenshot("CreateClue") def tearDown(self): Login.tearDown(self) if __name__ == "__main__": unittest.main()
class OrderTest(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getScreenTest = GetScreenshot(self.driver) def test_OrderTest(self): mydriver = self.driver SearchTest.test_SearchTest(self) FName = self.getValue.getElement("XPATH", "FName") LName = self.getValue.getElement("XPATH", "LName") Number = self.getValue.getElement("XPATH", "Number") SP = self.getValue.getElement("XPATH", "SP") Ifname = self.getValue.getInputValue("Order", "FName") ILname = self.getValue.getInputValue("Order", "LName") Inumber = self.getValue.getInputValue("Order", "Number") mydriver.find_element_by_xpath(FName).send_keys(Ifname) mydriver.find_element_by_xpath(LName).send_keys(ILname) mydriver.find_element_by_xpath(Number).send_keys(Inumber) mydriver.find_element_by_xpath(SP).click() time.sleep(5) self.getScreenTest.screenshot("Order") def tearDown(self): SearchTest.tearDown(self) if __name__ == '__main__': unittest.main()
class Login(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getscreenshotTest = GetScreenshot(self.driver) def test_Login(self): mydriver = self.driver URL = self.getValue.getURL("SystemURL", "URL") mydriver.get(URL) UserName = self.getValue.getElement("XPATH", "Name") UserPassword = self.getValue.getElement("XPATH", "Password") LoginBtn = self.getValue.getElement("XPATH", "Loginbtn") IName = self.getValue.getInputValue("Login", "InputName") Ipassword = self.getValue.getInputValue("Login", "Inputpassword") self.driver.find_element_by_xpath(UserName).send_keys(IName) self.driver.find_element_by_xpath(UserPassword).send_keys(Ipassword) self.driver.find_element_by_xpath(LoginBtn).click() time.sleep(2) self.getscreenshotTest.screenshot("Login") def tearDown(self): self.driver.close() if __name__ == '__main__': unittest.main()
class Createschedule(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getscreenshotTest = GetScreenshot(self.driver) def test_Createschedule(self): Login.test_Login(self) time.sleep(10) Createschedulelink = self.getValue.getElement("XPATH", "Createschedulelink") Subject = self.getValue.getElement("XPATH", "Subject") Description = self.getValue.getElement("XPATH", "Description") Createschedulebtn = self.getValue.getElement("XPATH", "Createschedulebtn") ISubject = self.getValue.getInputValue("Createschedule", "ISubject") IDescription = self.getValue.getInputValue("Createschedule", "IDescription") self.driver.find_element_by_xpath(Createschedulelink).click() time.sleep(10) self.driver.find_element_by_xpath(Subject).send_keys(ISubject) self.driver.find_element_by_xpath(Description).send_keys(IDescription) self.driver.find_element_by_xpath(Createschedulebtn).click() time.sleep(5) self.getscreenshotTest.screenshot("Createschedule") def tearDown(self): Login.tearDown(self) if __name__ == "__main__": unittest.main()
class Createtask(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getscreenshotTest = GetScreenshot(self.driver) def test_Createtask(self): Login.test_Login(self) time.sleep(5) Createtasklink = self.getValue.getElement("XPATH", "Createtasklink") TaskSubject = self.getValue.getElement("XPATH", "TaskSubject") Tasker = self.getValue.getElement("XPATH", "Tasker") TaskDescription = self.getValue.getElement("XPATH", "TaskDescription") ITaskSubject = self.getValue.getInputValue("CreateTask", "ITaskSubject") ITaskDescription = self.getValue.getInputValue("CreateTask", "ITaskDescription") ITasker = self.getValue.getInputValue("CreateTask", "ITasker") Createtaskbtn = self.getValue.getElement("XPATH", "Createtaskbtn") self.driver.find_element_by_xpath(Createtasklink).click() self.driver.find_element_by_xpath(TaskSubject).send_keys(ITaskSubject) self.driver.find_element_by_xpath(Tasker).send_keys(ITasker) self.driver.find_element_by_xpath(TaskDescription).send_keys(ITaskDescription) self.driver.find_element_by_xpath(Createtaskbtn).click() time.sleep(5) self.getscreenshotTest.screenshot("Createtask") def tearDown(self): Login.tearDown(self) if __name__ == "__main__": unittest.main()
class SearchTest(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getScreenTest = GetScreenshot(self.driver) def test_SearchTest(self): mydriver = self.driver LoginTest.test_LoginTest(self) Type1 = self.getValue.getElement("XPATH", "Type1") Passengers = self.getValue.getElement("XPATH", "Passengers") Depart = self.getValue.getElement("XPATH", "Depart") On1 = self.getValue.getElement("XPATH", "On1") On2 = self.getValue.getElement("XPATH", "On2") Arrive = self.getValue.getElement("XPATH", "Arrive") Return1 = self.getValue.getElement("XPATH", "Return1") Return2 = self.getValue.getElement("XPATH", "Return2") Class_economy = self.getValue.getElement("XPATH", "Class_economy") Airline = self.getValue.getElement("XPATH", "Airline") ContinueBtn = self.getValue.getElement("XPATH", "ContinueBtn") Depart2 = self.getValue.getElement("XPATH", "Depart2") Return3 = self.getValue.getElement("XPATH", "Return3") ContinueBtn1 = self.getValue.getElement("XPATH", "ContinueBtn1") IPassenger = self.getValue.getInputValue("Search", "Passenger") IDepart = self.getValue.getInputValue("Search", "Depart") IOn1 = self.getValue.getInputValue("Search", "On1") IOn2 = self.getValue.getInputValue("Search", "On2") IArrive = self.getValue.getInputValue("Search", "Arrive") IReturn1 = self.getValue.getInputValue("Search", "Return1") IReturn2 = self.getValue.getInputValue("Search", "Return2") IAirline = self.getValue.getInputValue("Search", "Airline") mydriver.find_element_by_xpath(Type1).click() mydriver.find_element_by_xpath(Passengers).send_keys(IPassenger) mydriver.find_element_by_xpath(Depart).send_keys(IDepart) mydriver.find_element_by_xpath(On1).send_keys(IOn1) mydriver.find_element_by_xpath(On2).send_keys(IOn2) mydriver.find_element_by_xpath(Arrive).send_keys(IArrive) mydriver.find_element_by_xpath(Return1).send_keys(IReturn1) mydriver.find_element_by_xpath(Return2).send_keys(IReturn2) mydriver.find_element_by_xpath(Class_economy).click() mydriver.find_element_by_xpath(Airline).send_keys(IAirline) time.sleep(5) self.getScreenTest.screenshot("Sraerch") mydriver.find_element_by_xpath(ContinueBtn).click() mydriver.find_element_by_xpath(Depart2).click() mydriver.find_element_by_xpath(Return3).click() mydriver.find_element_by_xpath(ContinueBtn1).click() time.sleep(5) def tearDown(self): LoginTest.tearDown(self) if __name__ == '__main__': unittest.main()
class LookClue(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getscreenshotTest = GetScreenshot(self.driver) def test_LookClue(self): Login.test_Login(self) time.sleep(5) LookClueLink = self.getValue.getElement("XPATH", "LookClueLink") self.driver.find_element_by_xpath(LookClueLink).click() time.sleep(5) self.getscreenshotTest.screenshot("LookClue") def tearDown(self): Login.tearDown(self) if "__name__" == "__main__": unittest.main()
class LoginTest(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getScreenTest = GetScreenshot(self.driver) def test_LoginTest(self): mydriver = self.driver myURL = self.getValue.getURL("newtoursSystem", "SystemURL") mydriver.get(myURL) time.sleep(3) userName = self.getValue.getElement('XPATH', "UsernameInputBox") password = self.getValue.getElement('XPATH', "PasswordInputBox") loginbtn = self.getValue.getElement('XPATH', "LoginBtn") Inputname = self.getValue.getInputValue("Login", "name") Inputpassword = self.getValue.getInputValue("Login", "password") mydriver.find_element_by_xpath(userName).send_keys(Inputname) mydriver.find_element_by_xpath(password).send_keys(Inputpassword) mydriver.find_element_by_xpath(loginbtn).click() time.sleep(25) check1 = self.getValue.getExistElement("CheckPointXpath", "CheckPoint_SIGN") check2 = self.getValue.getExistElement("CheckPointXpath", "CheckPoint_Filght") check1Exist = self.getValue.getExistElement("LoignChenckPoint", "ChenckElement1") check2Exist = self.getValue.getExistElement("LoignChenckPoint", "ChenckElement2") self.assertEqual( mydriver.find_element_by_xpath(check1).text, check1Exist) self.assertEqual( mydriver.find_element_by_xpath(check2).text, check2Exist) self.getScreenTest.screenshot("Login") def tearDown(self): self.driver.close() if __name__ == '__main__': unittest.main()
class Createbusiness(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getscreenshotTest = GetScreenshot(self.driver) def test_Createbusiness(self): Login.test_Login(self) time.sleep(5) Createbusinesslink = self.getValue.getElement("XPATH", "Createbusinesslink") BusinessName = self.getValue.getElement("XPATH", "BusinessName") Estimate_price = self.getValue.getElement("XPATH", "Estimate_price") CreatebusinessBtn = self.getValue.getElement("XPATH", "CreatebusinessBtn") IBusinessName = self.getValue.getInputValue("Createbusiness", "IBusinessName") IEstimate_price = self.getValue.getInputValue("Createbusiness", "IEstimate_price") self.driver.find_element_by_xpath(Createbusinesslink).click() time.sleep(5) self.driver.find_element_by_xpath(BusinessName).send_keys( IBusinessName) self.driver.find_element_by_xpath(Estimate_price).send_keys( IEstimate_price) self.driver.find_element_by_xpath(CreatebusinessBtn).click() time.sleep(5) self.getscreenshotTest.screenshot("Createbusiness") def tearDown(self): Login.tearDown(self) if __name__ == "__main__": unittest.main()
def setUp(self): self.driver = webdriver.Firefox() self.getValue = ReadFile() self.getscreenshotTest = GetScreenshot(self.driver)