class TestIndex: def setup(self): self.index = Index() def test_register(self): self.index.goto_register().register("测试学员") def test_login(self): register_page = self.index.goto_login().goto_register().register( "ceshi") assert "请选择" in "|".join(register_page.get_error_message()) def teardown(self): self.index.close()
class TestIndex(): def setup(self): self.index = Index(reuse=True) def test_register(self): self.index.goto_register().register("霍格沃兹测试学院") def test_login(self): register_page = self.index.goto_login().goto_register().register( "tester11") print(register_page.get_error_message()) assert "请选择所属行业" in "|".join(register_page.get_error_message()) def teardown(self): self.index.close()
class TestIndex: def setup(self): self.index = Index() def test_register(self): self.index.goto_register().register("测试刘小红") def test_login(self): register_page = self.index.goto_login().goto_regitstry().register( "测试哈哈") error = register_page.get_error_message() print(error) assert "请选择" in "|".join(error) def teardown(self): self.index.close()
class TestIndex: def setup(self): self.index = Index() def test_register(self): self.index.goto_register().register("天道有轮回") def test_login(self): register_message = self.index.goto_login().goto_registry().register("河北家里蹲公司") print(register_message.get_error_message()) print("|".join(register_message.get_error_message())) assert "请选择" in "|".join(register_message.get_error_message()) def teardown(self): self.index.close()
class TestIndex: def setup(self): self.index = Index() # 对注册功能的测试 def test_register(self): self.index.goto_register().register("测试学院") # 对login功能进行测试 def test_login(self): # 从首页进入到注册页 register_page = self.index.goto_login().goto_registry().register("测试") assert "请选择" in "|".join(register_page.get_error_message()) # 关闭driver def teardown(self): self.index.close()
class TestIndex: def setup(self): self.index = Index() def test_register(self): self.index.goto_register().register_error("采菇凉的小蘑菇") def test_login_register(self): error_msg = self.index.goto_login().register().register_error( "haha").get_error_msg() str_error_msg = "|".join(error_msg) print(str_error_msg) assert "请选择" in str_error_msg def teardown(self): sleep(10) self.index.close()
class TestIndex: def setup(self): self.index = Index() def test_register(self): # self.driver.find_element(By.LINK_TEXT, "立即注册").click() self.index.goto_register().register("霍格沃兹学院") # self.driver.find_element(By.ID, "corp_name").send_keys("霍格沃兹学院") # self.driver.find_element(By.ID, "submit_btn").click() def test_login(self): register_page = self.index.goto_login().goto_registry().register( "霍格沃兹学院") print(register_page.get_error_message()) assert "请选择" in "|".join(register_page.get_error_message()) def teardown(self): self.index.close()
class TestIndex(): def setup(self): self.index = Index() def teardown(self): self.index.close() def test_register(self): # self.driver.find_element(By.PARTIAL_LINK_TEXT, '立即注册').click() # 点击立即注册 # self.driver.find_element(By.ID, 'corp_name').send_keys('小游戏测试') # self.driver.find_element(By.ID, 'iagree').click() # self.driver.find_element(By.ID, 'submit_btn').click() self.index.goto_register().register('小游戏测试组') def test_login(self): register_page = self.index.goto_login().goto_register().register( '引擎测试组') result = register_page.get_error_message() assert '请选择' in '|'.join(result)
class TestIndex: def setup(self): self.index = Index() # self.driver = webdriver.Chrome() # 设置浏览器 # self.driver.implicitly_wait(3) # 设置隐式等待 # self.driver.get("https://work.weixin.qq.com/") def test_register(self): # index = Index(self.driver) self.index.goto_register().register("testlixi") # self.driver.find_element(By.LINK_TEST,"立即注册").click() # self.driver.find_element(By.ID,"corp_name").send_keys("testlixi") # self.driver.find_element(By.ID,"submit_btn").click() def test_login(self): register_page = self.index.goto_login().goto_registry().register("测试吧") print(register_page.get_error_message()) assert "请选择" in "|".join(register_page.get_error_message()) def teardown(self): self.index.close()
class TestIndex(): def setup(self): self.index = Index() # 初始化 def test_register(self): self.index.goto_register().register("霍格沃兹测试学院") # 执行步骤 def test_login(self): register_page = self.index.goto_login().goto_register().register( "测吧(北京)科技有限公司") print(register_page.get_error_message()) # 打印register_page.get_error_message()内容 print("|".join(register_page.get_error_message())) # 打印"|".join( register_page.get_error_message()输出内容 assert "请选择" in "|".join(register_page.get_error_message()) # 断言,判断“请选择”是否在register_page.get_error_message()中 ;“|”连接符号 def teardown(self): self.index.close()
class TestIndex: def setup(self): self.index = Index() def test_register(self): # self.driver = webdriver.Chrome() # self.driver.implicitly_wait(3) # self.driver.get("https://work.weixin.qq.com/") # self.driver.find_element(By.LINK_TEXT, '立即注册').click() # self.driver.find_element(By.ID, 'corp_name').send_keys("科大讯飞") # self.driver.find_element(By.ID, 'submit_btn').click() self.index.goto_register().register("科大讯飞") def test_login(self): register_page = self.index.goto_login().goto_register().register( "科技有限公司") print(register_page.get_error_message()) assert "请选择" in "|".join(register_page.get_error_message()) def teardown(self): self.index.close()
class TestIndex(): # 所有步骤前的初始化 def setup(self): self.index = Index() # 对注册功能进行测试 def test_register(self): # 进入index, 然后进入注册页填写信息 self.index.goto_register().register("霍格沃兹测试学院") # 对login功能进行测试 def test_login(self): # 从首页进入到注册页 register_page = self.index.goto_login().goto_registry().register( "测吧(北京)科技有限公司") # 对填写结果进行断言, 是否填写成功或者填写失败 assert "请选择" in "|".join(register_page.get_error_message()) # 关闭driver def teardown(self): self.index.close()