import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *

class AreagroupDel:
    name = 'Areagroup_delete'
    def teststeps(self):
        wd = GSTORE['wd']

        STEP(1, '勾选分组')
        areagroup_select  = WebDriverWait(wd, 10).until(
                EC.presence_of_element_located((By.XPATH, "(//span[@class='el-checkbox__inner'])[2]"))
            )
        areagroup_select.click()
        sleep(1)

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

        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.visibility_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
        )
        get_menu1 = get_menu.text
        CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")

        # 截图并保存
        SELENIUM_LOG_SCREEN(wd, "50%")
        wd.refresh()