2020-02-07 12:57:32 +00:00
|
|
|
import { ServersPage } from './helpers/server.po';
|
2020-02-07 15:52:12 +00:00
|
|
|
import { TestHelper } from './helpers/common.po';
|
|
|
|
import { element } from 'protractor';
|
2020-02-07 12:57:32 +00:00
|
|
|
|
2020-02-07 15:52:12 +00:00
|
|
|
fdescribe('gns3-web-ui App', () => {
|
2020-02-07 12:57:32 +00:00
|
|
|
let page: ServersPage;
|
2020-02-07 15:52:12 +00:00
|
|
|
let helper: TestHelper;
|
2020-02-07 12:57:32 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
page = new ServersPage();
|
2020-02-07 15:52:12 +00:00
|
|
|
helper = new TestHelper();
|
2020-02-07 12:57:32 +00:00
|
|
|
});
|
|
|
|
|
2020-02-07 15:52:12 +00:00
|
|
|
async function asyncForEach(array, callback) {
|
|
|
|
for (let index = 0; index < array.length; index++) {
|
|
|
|
await callback(array[index], index, array);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
it('user should have possibility to add server', async () => {
|
2020-02-07 12:57:32 +00:00
|
|
|
// arrange
|
|
|
|
page.maximizeWindow();
|
|
|
|
await page.navigateToServersPage();
|
|
|
|
|
|
|
|
// act
|
|
|
|
let text = await page.getAddServerNotificationText();
|
|
|
|
|
|
|
|
// assert
|
|
|
|
expect(text).toBe("We've discovered GNS3 server on 127.0.0.1:3080, would you like to add to the list?");
|
2020-02-07 15:52:12 +00:00
|
|
|
});
|
2020-02-07 12:57:32 +00:00
|
|
|
|
2020-02-07 15:52:12 +00:00
|
|
|
it('user should see added server in the list', async () => {
|
|
|
|
// arrange
|
|
|
|
page.maximizeWindow();
|
|
|
|
await page.navigateToServersPage();
|
|
|
|
await page.clickAddServer();
|
|
|
|
helper.sleep(1000);
|
2020-02-07 12:57:32 +00:00
|
|
|
|
2020-02-07 15:52:12 +00:00
|
|
|
// act
|
|
|
|
let firstRowOfServersTable = await page.checkServersTable();
|
|
|
|
let serverData = [];
|
|
|
|
await asyncForEach(firstRowOfServersTable, async element => {
|
|
|
|
serverData.push(await element.getText());
|
|
|
|
});
|
2020-02-07 12:57:32 +00:00
|
|
|
|
2020-02-07 15:52:12 +00:00
|
|
|
// assert
|
|
|
|
expect(serverData).toContain('127.0.0.1');
|
|
|
|
expect(serverData).toContain('3080');
|
2020-02-07 12:57:32 +00:00
|
|
|
});
|
|
|
|
});
|