from lib.login import *

class areafuntionDel001:
    name = 'areafuntion_del_001'
    def teststeps(self):
        wd = GSTORE['wd']

        STEP(1, '搜索对应的区域功能')
        areafuntion_search= WebDriverWait(wd, 10).until(
            EC.element_to_be_clickable((By.XPATH, "(//input[contains(@placeholder,'请输入区域功能')])[1]"))
        )
        areafuntion_search.clear()
        areafuntion_search.send_keys("修改-测试功能1")

        STEP(2, '勾选区域功能')
        areafuntion_select = WebDriverWait(wd, 10).until(
            EC.element_to_be_clickable((By.XPATH, "(//span[contains(@class,'el-checkbox__inner')])[2]"))
        )
        areafuntion_select.click()

        STEP(3, '点击删除按钮')
        areafuntion_mod = WebDriverWait(wd, 10).until(
            EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'删除')]"))
        )
        areafuntion_mod.click()
        sleep(2)

        STEP(4, '点击确认')
        commit = WebDriverWait(wd, 10).until(
            EC.element_to_be_clickable((By.XPATH, "//div[@class='dialog-footer']//span[contains(text(),'确 定')]"))
        )
        commit.click()

        STEP(5, '验证是否修改成功')
        get_menu = WebDriverWait(wd, 10).until(
            EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
        )
        get_menu1 = get_menu.text
        CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
        sleep(2)