class TestDisplay: def data_with_key(key): return yaml_data_with_file("display_data")[key] def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) def teardown(self): self.driver.quit() @pytest.mark.parametrize("content",data_with_key("test_mobile_display_input")) def test_mobile_display_input(self,content): # 点击显示 self.display_page.click_display() # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.click_text(content) # 点击返回 self.display_page.click_back() @pytest.mark.parametrize("content", data_with_key("test_mobile_display_input1")) def test_mobile_display_input1(self,content): # 点击显示 self.display_page.click_display() # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.click_text(content) # 点击返回 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): # 从配置文件里调用具体流程和前置调用这两个函数在可以实现以下的功能 # base和page相当于公共资源,调用才执行 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_text('hello') self.display_page.click_back() def teardown(self): self.driver.quit()
class TestDispaly: def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) @pytest.allure.severity(pytest.allure.severity_level.CRITICAL) @allure.step("测试搜索框") def test_search(self): allure.attach("输入内容", "内容的描述") # 点击显示 self.display_page.click_display() # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.input_text("hello") # 点击返回 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.quit() def test_mobile_display_input(self): # 点击显示 self.display_page.click_display() # 点击放大镜 self.display_page.click_search() # 输入文字 self.display_page.click_text("hello") # 点击返回 self.display_page.click_back()