使用e2e测试确保找到值的最佳方法是什么(例如不是空字符串),我的示例仅匹配文本本身,我想计算字符串长度并确保它不为0。
describe 'Device Details', ->
device = ionic.Platform.device()
details =
'deviceManufacturer': $('#deviceManufacturer'),
'deviceModel': $('#deviceModel')
it 'Device Manufacturer must not be empty', ->
expect(details.deviceModel.getText()).toEqual '10'
最佳答案
有多种方法可以做到,但我更喜欢 toBeNonEmptyString()
中的 jasmine-matchers
package-简单易读:
expect(details.deviceModel.getText()).toBeNonEmptyString();