2021-04-12 13:46:28 +02:00
|
|
|
import { browser, by } from 'protractor';
|
2020-02-26 13:43:30 +01:00
|
|
|
import { TestHelper } from './common.po';
|
2020-02-07 13:57:32 +01:00
|
|
|
|
2022-07-21 13:57:09 +05:30
|
|
|
export class ControllersPage {
|
2021-04-12 13:15:45 +02:00
|
|
|
helper = new TestHelper();
|
2020-02-26 13:43:30 +01:00
|
|
|
|
2021-04-12 13:15:45 +02:00
|
|
|
maximizeWindow() {
|
|
|
|
browser.driver.manage().window().maximize();
|
|
|
|
}
|
2020-02-07 13:57:32 +01:00
|
|
|
|
2022-07-21 13:57:09 +05:30
|
|
|
navigateToControllersPage() {
|
2022-07-18 14:01:09 +05:30
|
|
|
return browser.get('/controllers');
|
2021-04-12 13:15:45 +02:00
|
|
|
}
|
2020-02-07 13:57:32 +01:00
|
|
|
|
2022-07-21 13:57:09 +05:30
|
|
|
getAddControllerNotificationText() {
|
2021-04-12 13:15:45 +02:00
|
|
|
return browser.driver.findElement(by.className('mat-card-content')).getText();
|
|
|
|
}
|
2020-02-07 13:57:32 +01:00
|
|
|
|
2022-07-21 13:57:09 +05:30
|
|
|
async clickAddController() {
|
2022-07-20 14:28:13 +05:30
|
|
|
let controllerTable = await this.checkControllersTable();
|
|
|
|
if (controllerTable.length === 0) {
|
2021-04-12 13:15:45 +02:00
|
|
|
let buttons = await browser.driver.findElements(by.className('mat-button mat-button-base'));
|
|
|
|
await buttons[3].click();
|
2020-02-07 16:52:12 +01:00
|
|
|
}
|
2021-04-12 13:15:45 +02:00
|
|
|
}
|
2020-02-07 16:52:12 +01:00
|
|
|
|
2022-07-20 14:28:13 +05:30
|
|
|
checkControllersTable() {
|
2021-04-12 13:15:45 +02:00
|
|
|
return browser.driver.findElements(by.css('mat-cell'));
|
|
|
|
}
|
2020-02-26 13:43:30 +01:00
|
|
|
|
2022-07-21 16:32:09 +05:30
|
|
|
async navigateToControllerProjects() {
|
2021-04-12 13:15:45 +02:00
|
|
|
this.helper.sleep(2000);
|
|
|
|
let hyperlinks = await browser.driver.findElements(by.css('a.table-link'));
|
2022-07-20 14:28:13 +05:30
|
|
|
let controllerLink;
|
2021-04-12 13:15:45 +02:00
|
|
|
await this.helper.asyncForEach(hyperlinks, async (element) => {
|
|
|
|
let text = await element.getText();
|
2022-07-20 14:28:13 +05:30
|
|
|
if (text === '127.0.0.1') controllerLink = element;
|
2021-04-12 13:15:45 +02:00
|
|
|
});
|
2022-07-20 14:28:13 +05:30
|
|
|
await controllerLink.click();
|
2021-04-12 13:15:45 +02:00
|
|
|
}
|
2020-02-07 13:57:32 +01:00
|
|
|
}
|