gpt4 book ai didi

angularjs - getText() 的返回不能与字符串进行比较

转载 作者:行者123 更新时间:2023-11-28 20:23:18 26 4
gpt4 key购买 nike

我正在使用以下代码比较 Protractor/ Jasmine 测试用例之一中的 2 个字符串。

emailnotsentmessage.getText().then(function(text) {
expect(text).toBe('has not received notification about recent changes to the meeting.');
});

emailnotsentmessage 包含以下文本

[ 'has not received notification about recent changes to the meeting.' ]

由于某种原因,字符串比较失败。这两个字符串包含完全相同的内容。我检查了好几次。我在这里错过了什么吗? emailnotsentmessage<span> 的内容.

错误跟踪

1) Get to the existing meeting by navigating to the edit meeting page should display the same value which was entered du
ring create meeting when go into edit meeting
Message:
Expected [ 'has not received notification about recent changes to the meeting.' ] to equal 'has not received notific
ation about recent changes to the meeting.'.
Stack:
Error: Failed expectation

最佳答案

看起来您的emailnotsentmessage数组 而不是字符串。如果您尝试 expect(text).toBe(['has not received notification about recent changes to the meeting.']); 或者 emailnotsentmessage[0]

关于angularjs - getText() 的返回不能与字符串进行比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30497629/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com