def test_fields_length_when_adding_portrait(sb, login, setup_portrait_name): PortraitPage.click_add_portrait_button(sb) PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="姓名"]/parent::*//input', 'maxlength', '40') PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="别名"]/parent::*//input', 'maxlength', '40') PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="No."]/parent::*//input', 'maxlength', '32') PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="年龄"]/parent::*//input', 'maxlength', '3') PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="公司"]/parent::*//input', 'maxlength', '40') PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="部门"]/parent::*//input', 'maxlength', '40') PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="联系方式"]/parent::*//input', 'maxlength', '40') PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="车牌号"]/parent::*//input', 'maxlength', '40') PortraitPage.assert_element_attribute_value( sb, '//div[@aria-label="添加人像"]//label[text()="住址"]/parent::*//input', 'maxlength', '30')
def test_required_fields_when_adding_portrait(sb, login, setup_portrait_name): PortraitPage.click_add_portrait_button(sb) Dialog.click_dialog_footer_button_by_text(sb, '添加人像', '确定') sb.is_element_visible( '//div[@class="el-form-item__error" and contains(text(), "请上传本地人像照片")]' ) sb.is_element_visible( '//div[@class="el-form-item__error" and contains(text(), "请输入姓名")]') sb.is_element_visible( '//div[@class="el-form-item__error" and contains(text(), "请输入No.")]') sb.is_element_visible( '//div[@class="el-form-item__error" and contains(text(), "请选择人像库")]') sb.is_element_visible( '//div[@class="el-form-item__error" and contains(text(), "请选择时间")]')
def test_add_invalid_portrait_image(sb, login, setup_portrait_name, image_path, alert_message): PortraitPage.click_add_portrait_button(sb) PortraitPage.upload_portrait_image(sb, '添加人像', os.getcwd() + image_path) PortraitPage.assert_alert_message(sb, alert_message)