testing - 使用复选框 - 无法检查复选框是否被禁用
问题描述
寻找对此的一些评论,让我知道这是否是检查禁用复选框的正确方法。
我的页面模型的一部分在这里:
class eligibleAccountType {
constructor (text) {
this.label = label.withText(text);
this.checkbox = this.label.find('input[type=checkbox]');
}
}
class ProgramOptionsSubscriptionRulesPage{
constructor(){
this.contractsatAccountLevel = Selector("#program_option_allow_participant_account_contracts")
this.eligibleAccountTypesList = [
new eligibleAccountType("Residential"),
new eligibleAccountType("Commercial"),
new eligibleAccountType("Industrial")
];
我的部分测试在这里
if (userdata.userrole == "Read Only") {
for (const eligibleAccountType of programOptionsSubscriptionRulesPage.eligibleAccountTypeList) {
await t.expect(eligibleAccountType.hasAttribute('disabled')).ok()
}
}
出现错误,例如:
ReferenceError: label is not defined
解决方案
我想我发现了问题,我没有定义
const label = Selector('label');
推荐阅读
- java - 此 lambda 表达式的正确语法
- javascript - 在节点中解码 Jwt 令牌 - 没有库
- javascript - 使用 ReactJS 进行热交换
- java - 两个应用程序如何使用java或spring框架一直交换心跳?
- excel - 如何在浏览器中打开 Blob 对象?
- jenkins - 从 Windows slave 上 Jenkins 管道的 bat 步骤中访问 Groovy 变量
- aws-cli - 将值传递给 xargs 中的多个命令
- spring - spring boot 资源作为链接
- opengl - 在视图协调器中相对于 x 轴的 openGL 旋转
- c# - 无法打开 RSA 密钥容器