/
global_nav.ts
55 lines (45 loc) · 1.8 KB
/
global_nav.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import expect from '@kbn/expect';
import { FtrService } from '../ftr_provider_context';
export class GlobalNavService extends FtrService {
private readonly testSubjects = this.ctx.getService('testSubjects');
public async moveMouseToLogo(): Promise<void> {
await this.testSubjects.moveMouseTo('headerGlobalNav > logo');
}
public async clickLogo(): Promise<void> {
return await this.testSubjects.click('headerGlobalNav > logo');
}
public async clickNewsfeed(): Promise<void> {
return await this.testSubjects.click('headerGlobalNav > newsfeed');
}
public async exists(): Promise<boolean> {
return await this.testSubjects.exists('headerGlobalNav');
}
public async getFirstBreadcrumb(): Promise<string> {
return await this.testSubjects.getVisibleText(
'headerGlobalNav > breadcrumbs > ~breadcrumb & ~first'
);
}
public async getLastBreadcrumb(): Promise<string> {
return await this.testSubjects.getVisibleText(
'headerGlobalNav > breadcrumbs > ~breadcrumb & ~last'
);
}
public async badgeExistsOrFail(expectedLabel: string): Promise<void> {
await this.testSubjects.existOrFail('headerBadge');
const actualLabel = await this.testSubjects.getAttribute(
'headerBadge',
'data-test-badge-label'
);
expect(actualLabel.toUpperCase()).to.equal(expectedLabel.toUpperCase());
}
public async badgeMissingOrFail(): Promise<void> {
await this.testSubjects.missingOrFail('headerBadge');
}
}