mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-24 15:16:38 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { browser, by } from 'protractor';
|
|
import { TestHelper } from './common.po';
|
|
|
|
export class ServersPage {
|
|
helper = new TestHelper();
|
|
|
|
maximizeWindow() {
|
|
browser.driver.manage().window().maximize();
|
|
}
|
|
|
|
navigateToServersPage() {
|
|
return browser.get('/servers');
|
|
}
|
|
|
|
getAddServerNotificationText() {
|
|
return browser.driver.findElement(by.className('mat-card-content')).getText();
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|
|
|
|
checkServersTable() {
|
|
return browser.driver.findElements(by.css('mat-cell'));
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|