]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/e2e/helper.po.ts
import ceph 14.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / e2e / helper.po.ts
CommitLineData
eafe8130 1import { $, $$, browser, ElementFinder } from 'protractor';
11fdf7f2
TL
2
3export class Helper {
4 static EC = browser.ExpectedConditions;
5 static TIMEOUT = 10000;
6
7 /**
8 * Checks if there are any errors on the browser
9 *
10 * @static
11 * @memberof Helper
12 */
13 static checkConsole() {
14 browser
15 .manage()
16 .logs()
17 .get('browser')
18 .then(function(browserLog) {
19 browserLog = browserLog.filter((log) => {
20 return log.level.value > 900; // SEVERE level
21 });
22
23 if (browserLog.length > 0) {
24 console.log('\n log: ' + require('util').inspect(browserLog));
25 }
26
27 expect(browserLog.length).toEqual(0);
28 });
29 }
30
eafe8130
TL
31 static getBreadcrumb() {
32 return $('.breadcrumb-item.active');
11fdf7f2
TL
33 }
34
35 static getTabText(idx) {
36 return $$('.nav.nav-tabs li')
37 .get(idx)
38 .getText();
39 }
40
41 static getTabsCount() {
42 return $$('.nav.nav-tabs li').count();
43 }
eafe8130
TL
44
45 static waitTextToBePresent(elem: ElementFinder, text: string, message?: string) {
46 return browser.wait(Helper.EC.textToBePresentInElement(elem, text), Helper.TIMEOUT, message);
47 }
11fdf7f2 48}