如何确认 header 包含我想要的关键字?
How to confirm the header contains the keywords that I want?
<h1 class="page-header">Groups<span class="badge grp-cnt-badge" data-toggle="tooltip" data-original-title="Total {{grpCnt}} Groups">{{grpCnt}}</span></h1>
如您所见,页面中的header会显示为字符串Groups,并且在它后面有一个toolip(一个计数)。
我确实想确认 Groups 是否始终存在。所以我写如下:
it('Search the page header contains key words', function() {
var grpTitle = element(by.tagName('h1'));
expect(grpTitle.getText()).toBe('Groups');
//Now report the error, becuase the real return value is like Group136 });
我能做些什么来让 grpTitle
return Groups 只。
谢谢。
请使用 toContain 而不是 toBe
期望(grpTitle.getText()).toContain('Groups');
如果有帮助请告诉我!
<h1 class="page-header">Groups<span class="badge grp-cnt-badge" data-toggle="tooltip" data-original-title="Total {{grpCnt}} Groups">{{grpCnt}}</span></h1>
如您所见,页面中的header会显示为字符串Groups,并且在它后面有一个toolip(一个计数)。
我确实想确认 Groups 是否始终存在。所以我写如下:
it('Search the page header contains key words', function() {
var grpTitle = element(by.tagName('h1'));
expect(grpTitle.getText()).toBe('Groups');
//Now report the error, becuase the real return value is like Group136 });
我能做些什么来让 grpTitle
return Groups 只。
谢谢。
请使用 toContain 而不是 toBe
期望(grpTitle.getText()).toContain('Groups');
如果有帮助请告诉我!