我正在玩Siesta和一些内置的断言。
我遇到了elementIsNotEmpty()
断言的问题。
我想检查在登录字段中输入空字符串后,该字段是否为空,并且其中没有显示任何内容。
所以测试链看起来像这样:
t.it("Login with non valid Data", function(t) {
t.diag("Failing the Login"),
t.chain(
// Login
t.loginFunction("", "alsoWrong"),
{
waitFor: 10000
},
t.elementIsNotEmpty(">>textfield[itemId=fldPassword]")
);
});
在我的LoginFunction中,我使用Same componentquery元素,如下所示:
{
action: 'type',
target: ">>textfield[itemId=fldName]",
text: user,
desc: "Type in username"
},
我在使用elementIsNotEmpty
的行中收到警告,其中显示:
警告:您的组件查询:" textfield [itemId = fldPassword]"没有返回组件
这里有问题吗?
答案 0 :(得分:0)
在我的LoginFunction中,我使用Same componentquery元素,如下所示:
不,我们不能。
抱怨的人会查找包含itemId:"fIdPassword"
的文本字段,而工作示例会查找包含itemId:"fIdName"
的文本字段
如果这不是问题所在(即只是一个错字),请向我们展示您正在测试的代码。 只有测试本身,就无法判断测试代码是否正常工作。