1 from lib.webui import *
2
3
4 def suite_setup():
5 open_browser()
6
7
8 def suite_teardown():
9 wd = GSTORE['wd']
10 wd.quit()
1 from time import sleep
2 from lib.webui import *
3
4
5 class UI_000x:
6 ddt_cases = [
7 {
8 'name': '登录_UI_0001',
9 'para': {"username": None, "password": "88888888", "info": "请输入用户名"}
10 },
11 {
12 'name': '登录_UI_0002',
13 'para': {"username": 'byhy', "password": None, "info": "请输入密码"}
14 },
15 {
16 'name': '登录_UI_0003',
17 'para': {"username": 'byh', "password": "88888888", "info": "登录失败 : 用户名或者密码错误"}
18 },
19 {
20 'name': '登录_UI_0004',
21 'para': {"username": 'byhy', "password": "8888888", "info": "登录失败 : 用户名或者密码错误"}
22 },
23 {
24 'name': '登录_UI_0005',
25 'para': {"username": 'byhy', "password": "888888888", "info": "登录失败 : 用户名或者密码错误"}
26 }
27 ]
28
29 def teststeps(self):
30 wd = GSTORE['wd']
31
32 wd.get('http://127.0.0.1/mgr/sign.html')
33
34 username, password, info = self.para["username"], self.para["password"], self.para["info"]
35 if username is not None:
36 wd.find_element(By.ID, 'username').send_keys(username)
37 if password is not None:
38 wd.find_element(By.ID, 'password').send_keys(password)
39
40 wd.find_element(By.TAG_NAME, 'button').click()
41 # 提示不会立刻弹出来
42 sleep(1)
43 notify = wd.switch_to.alert.text
44 CHECK_POINT('弹出提示', notify == info)
45 wd.switch_to.alert.accept()
46
47 def teardown(self):
48 wd = GSTORE['wd']
49 wd.find_element(By.ID, 'username').clear()
50 wd.find_element(By.ID, 'password').clear()