testcase005_superadministrator_deletecompany.py 2.99 KB
Newer Older
libin's avatar
libin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#coding:utf-8

import time
from src.datalib import test_data
from src.elementlib import administrator
from src.module import login_swp
import unittest
from src.common import web_client
from selenium.webdriver.common.by import By



class EditCompany(unittest.TestCase):
    COMPANY_NAME = "qweqweqwe"
    COMPANY_URL = "eqweqweqwe.com"

    def setUp(self):
        self.object = web_client.WebClient(test_data.MANAGE_URL)
        login_swp.login01(self.object, test_data.SUPERADMIN_NAME, test_data.SUPERADMIN_PW,test_data.HOME_PAGE_SUPERADMIN_NAME)
        time.sleep(2)
        #创建企业域
        self.object.click_element(administrator.ADMINISTRATOR_CREATECOMPANY)
        self.object.sendkeys_to_element(administrator.ADMINISTRATOR_CREATECOMPANY_COMPANYNAME, self.COMPANY_NAME,By.CSS_SELECTOR)
        self.object.sendkeys_to_element(administrator.ADMINISTRATOR_CREATECOMPANY_COMPANYURL, self.COMPANY_URL,By.CSS_SELECTOR)
        self.object.click_element(administrator.ADMINISTRATOR_CREATECOMPANY_DETERMINE, By.CSS_SELECTOR)
libin's avatar
libin committed
26
27
        self.object.scroll_to_bottom()
        self.object.click_element(administrator.ADMINISTRATOR_PAGE_BTN)
libin's avatar
libin committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
        
        #点击删除 -- 取消删除  -- 确认删除

    '''先取消删除企业再确认删除企业'''
    def test_delete_001(self):
        self.object.click_element(administrator.ADMINSTRATOR_DELETE_BUTTON, By.CSS_SELECTOR)  # 点击删除按钮
        self.object.assert_mark_msg(administrator.ASSERT_DELETE_TEXT,test_data.ASSERT_DELETE_TEXT, By.CSS_SELECTOR)  # 判断弹窗标题
        self.object.click_element(administrator.CHANCLE_DELETE_BUTTON, By.CSS_SELECTOR)  # 点击取消按钮
        self.object.assert_mark_msg(administrator.TEXT_NAME_LINE_ONE, self.COMPANY_NAME)  # 断言第一行企业名称没有被修改
        self.object.assert_mark_msg(administrator.TEXT_URL_LINE_ONE, self.COMPANY_URL)  # 断言第一行企业域名没有被修改
        self.object.click_element(administrator.ADMINSTRATOR_DELETE_BUTTON, By.CSS_SELECTOR)  # 再次点击删除按钮
        self.object.assert_mark_msg(administrator.ASSERT_DELETE_TEXT, test_data.ASSERT_DELETE_TEXT, By.CSS_SELECTOR)  # 再次断言弹窗标题
        self.object.click_element(administrator.ENSURE_DELETE_BUTTON, By.CSS_SELECTOR)  # 点击确认按钮
        self.object.assert_mark_msg(administrator.ASSERT_DELETE_SUCCESS,test_data.ASSERT_DELETE_SUCCESS, By.CSS_SELECTOR)  # 断言提示信息‘删除成功’
        self.object.click_element(administrator.ADMINSTRATOR_DELETE_BUTTON, By.CSS_SELECTOR)  # 点击包含用户的企业域后的删除按钮
        self.object.click_element(administrator.ENSURE_DELETE_BUTTON, By.CSS_SELECTOR)  # 点击确认按钮
        self.object.assert_mark_msg(administrator.ASSERT_DELETE_ERROR, test_data.ASSERT_DELETE_ERROR,By.CSS_SELECTOR)  # 断言提示信息删除失败

    def tearDown(self):
        self.object.exit_all_browsers()
if __name__ == '__main__':

    suite = unittest.main()