gns3-web-ui/e2e/helpers/server.po.ts

42 lines
1.2 KiB
TypeScript
Raw Normal View History

2020-02-07 12:57:32 +00:00
import { browser, by, element } 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 {
2020-02-26 12:43:30 +00:00
helper = new TestHelper;
2020-02-07 12:57:32 +00:00
maximizeWindow() {
browser.driver.manage().window().maximize();
}
navigateToServersPage() {
return browser.get('/servers');
}
getAddServerNotificationText() {
return browser.driver.findElement(by.className('mat-card-content')).getText();
}
2020-02-07 15:52:12 +00:00
async clickAddServer() {
2020-02-27 12:11:35 +00:00
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
}
2020-02-07 12:57:32 +00:00
checkServersTable() {
2020-02-07 15:52:12 +00:00
return browser.driver.findElements(by.css('mat-cell'));
2020-02-07 12:57:32 +00:00
}
2020-02-26 12:43:30 +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
}