def test_03_clickHotCity(self): self.buttonListHome[4].click() time.sleep(1) buttonListCity = self.driver.find_elements_by_xpath("//android.widget.Button") configure.buttonClick(u"上海", buttonListCity) time.sleep(1) buttonListMain = self.driver.find_elements_by_xpath("//android.widget.Button") self.assertEqual(buttonListMain[4].text, u"上海", "The city is not right")
def test_05_hotCitySuggestion(self): self.buttonListHome[4].click() time.sleep(1) searchArea = self.driver.find_element_by_xpath("//android.widget.EditText") searchArea.send_keys("bei") suggestionCityResutlList = self.driver.find_elements_by_xpath("//android.widget.Button") configure.buttonClick(u"北戴河", suggestionCityResutlList) time.sleep(1) buttonListMain = self.driver.find_elements_by_xpath("//android.widget.Button") self.assertEqual(buttonListMain[4].text, u"北戴河", "The city is wrong")
def test_17_chooseCitySerarchHotel(self): self.buttonListHome[4].click() time.sleep(1) buttonListCityAct = self.driver.find_elements_by_xpath("//android.widget.Button") configure.buttonClick(u"上海", buttonListCityAct) time.sleep(1) buttonListMainAct = self.driver.find_elements_by_xpath("//android.widget.Button") cityNameMainAct = buttonListMainAct[4].text # print cityNameMainAct self.buttonListHome[8].click() time.sleep(2) textViewHotelList = self.driver.find_elements_by_xpath("//android.widget.TextView") cityNameHotelList = ( cityNameMainAct if cityNameMainAct in textViewHotelList[4].text else textViewHotelList[4].text ) # print cityNameHotelList self.assertEqual(cityNameHotelList, cityNameMainAct, "The city is not pass by the mainAct")