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