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

42 lines
1.2 KiB
TypeScript
Raw Normal View History

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 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
navigateToControllersPage() {
return browser.get('/controllers');
2021-04-12 11:15:45 +00:00
}
2020-02-07 12:57:32 +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
async clickAddController() {
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
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
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'));
let controllerLink;
2021-04-12 11:15:45 +00:00
await this.helper.asyncForEach(hyperlinks, async (element) => {
let text = await element.getText();
if (text === '127.0.0.1') controllerLink = element;
2021-04-12 11:15:45 +00:00
});
await controllerLink.click();
2021-04-12 11:15:45 +00:00
}
2020-02-07 12:57:32 +00:00
}