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
|
|
|
|
|
|
|
export class ServersPage {
|
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
|
|
|
|
2021-04-12 11:15:45 +00:00
|
|
|
navigateToServersPage() {
|
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
|
|
|
|
2021-04-12 11:15:45 +00:00
|
|
|
getAddServerNotificationText() {
|
|
|
|
return browser.driver.findElement(by.className('mat-card-content')).getText();
|
|
|
|
}
|
2020-02-07 12:57:32 +00:00
|
|
|
|
2021-04-12 11:15:45 +00:00
|
|
|
async clickAddServer() {
|
|
|
|
let serversTable = await this.checkServersTable();
|
|
|
|
if (serversTable.length === 0) {
|
|
|
|
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
|
|
|
|
2021-04-12 11:15:45 +00:00
|
|
|
checkServersTable() {
|
|
|
|
return browser.driver.findElements(by.css('mat-cell'));
|
|
|
|
}
|
2020-02-26 12:43:30 +00:00
|
|
|
|
2021-04-12 11:15:45 +00:00
|
|
|
async navigateToServerProjects() {
|
|
|
|
this.helper.sleep(2000);
|
|
|
|
let hyperlinks = await browser.driver.findElements(by.css('a.table-link'));
|
|
|
|
let serverLink;
|
|
|
|
await this.helper.asyncForEach(hyperlinks, async (element) => {
|
|
|
|
let text = await element.getText();
|
|
|
|
if (text === '127.0.0.1') serverLink = element;
|
|
|
|
});
|
|
|
|
await serverLink.click();
|
|
|
|
}
|
2020-02-07 12:57:32 +00:00
|
|
|
}
|