from lib.login import *

class AreagroupDel001:
    name = 'Areagroup_delete_001'
    def teststeps(self):
        wd = GSTORE['wd']

        STEP(1, '勾选分组')
        checkbox  = WebDriverWait(wd, 10).until(
                EC.presence_of_element_located((By.XPATH, "//span[contains(text(), '测试区域1')]//span[@class='el-checkbox__inner']"))
            )
        areagroup_select = checkbox.find_element(By.XPATH, "./ancestor::span[contains(@class, 'el-checkbox__input')]//input")
        areagroup_select.click()
        sleep(2)

        STEP(2, '点击“删除”按钮')
        areagroup_modify = WebDriverWait(wd, 10).until(
                EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'删除')]"))
            )
        areagroup_modify.click()
        sleep(2)

        STEP(3, '点击确认')
        commit = WebDriverWait(wd, 10).until(
            EC.element_to_be_clickable((By.XPATH, "(//span[contains(text(),'确 定')])[3]"))
        )
        commit.click()

        STEP(6, '验证是否修改成功')
        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)