6d48a50c2a
Co-authored-by: spalger <spalger@users.noreply.github.com>
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
/*
|
|
* 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');
|
|
}
|
|
}
|