class TestDisplay: def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) def test_mobile_display_input(self): # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.input_search_text("1") # 点击返回 self.display_page.click_back() # # 输入文字 # self.display_page.input_text("2") # # 点击返回 # self.display_page.click_back() def test_mobile_display_input6(self): # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.input_search_text("1") # 点击返回 self.display_page.click_back()
class TestSettings: def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) def test_mobile_display_input(self): self.display_page.click_display() self.display_page.click_search() self.display_page.input_search_text("12345") self.display_page.click_back()
class TestDisplay: def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) def test_display(self): self.display_page.click_display() self.display_page.click_search() self.display_page.input_search_text('hello') self.display_page.click_back() def teardown(self): self.driver.quit()
class TestDisplay: def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) @allure.step(title='显示脚本') def test_mobile_display_input(self): # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.input_search_text("1") # 点击返回 self.display_page.click_back()
class TestDisplay: def setup(self): # 这里面的self.driver就相当于接收了来自另外一个文件(base_driver)的前置代码 self.driver = init_driver() # 这里面的self.display_page就相当于新建了一个来自DisplayPage的对象 self.display_page = DisplayPage(self.driver) def test_mobile_display_input(self): # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.input_search_text("1") # 点击返回 self.display_page.click_back()
class TestDisplay(): def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) def test_display_input(self): # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.input_search_text("xxx") # 点击返回 self.display_page.click_back()
class TestDisplay(): def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) def teardown(self): self.driver.close_app() self.driver.quit() def test_display_search(self): # self.driver.find_element_by_class_name("android.widget.ImageButton").click() # self.driver.find_element_by_class_name("android.widget.EditText").send_keys("hello") self.display_page.click_image() self.display_page.input_search_text("hello") self.display_page.click_back()
class TestDisplay: def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) def test_mobile_display_input(self): self.display_page.click_search() self.display_page.input_search_text('hello') self.display_page.click_back() # self.driver.find_element_by_xpath("//*[contains(@text,'显示')]").click() # self.driver.find_element_by_id("com.android.settings:id/search").click() # self.driver.find_element_by_id("android:id/search_src_text").send_keys("hello") # self.driver.find_element_by_class_name("android.widget.ImageButton").click() def teardown(self): self.driver.quit()
class TestDisplay: def setup(self): self.display_page = DisplayPage(android_driver()) def teardown(self): self.display_page.driver.quit() del self.display_page @allure.MASTER_HELPER.testcase('测试显示功能') @allure.MASTER_HELPER.feature('测试用例:显示') @pytest.mark.parametrize('a', ['网络']) def test_mobile_search(self, a): allure.MASTER_HELPER.attach('描述', '点击放大镜') self.display_page.click_search() allure.MASTER_HELPER.attach('描述', '输入数据:网络') self.display_page.input_search_text(a) self.display_page.screen_shot() self.display_page.clear_search_text() allure.MASTER_HELPER.attach('描述', '点击返回') self.display_page.click_back()
class TestDisplay: def setup(self): # 连接手机 self.driver = init_driver() # 创建page对象 把driver传给page对象 self.display_page = DisplayPage(self.driver) def test_display_input(self): # 点击显示 # self.display_page.click_display() # 点击放大镜 self.display_page.click_search() # 输入文字(传什么由脚本决定) self.display_page.input_search_text("1") # 点击返回 self.display_page.click_back() # self.driver.find_element_by_xpath("//*[contains(@text,'显示')]").click() # self.driver.find_element_by_id("com.android.settings:id/search").click() # self.driver.find_element_by_id("android:id/search_src_text").send_keys("hello") # self.driver.find_element_by_class_name("android.widget.ImageButton").click() def teardown(self): self.driver.quit()