mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-20 05:27:56 +00:00
e2e
This commit is contained in:
parent
f744c02c44
commit
fce7241bb2
7
e2e/helpers/common.po.ts
Normal file
7
e2e/helpers/common.po.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { browser, by, element } from 'protractor';
|
||||
|
||||
export class TestHelper {
|
||||
sleep(value: number) {
|
||||
browser.sleep(value);
|
||||
}
|
||||
}
|
@ -14,7 +14,12 @@ export class ServersPage {
|
||||
// return element(by.className('mat-card-content')[0]).getText();
|
||||
}
|
||||
|
||||
async clickAddServer() {
|
||||
let buttons = await browser.driver.findElements(by.className('mat-button mat-button-base'));
|
||||
await buttons[3].click();
|
||||
}
|
||||
|
||||
checkServersTable() {
|
||||
return browser.driver.findElement(by.className('mat-cell cdk-column-id mat-column-id ng-star-inserted')).getText();
|
||||
return browser.driver.findElements(by.css('mat-cell'));
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,23 @@
|
||||
import { ServersPage } from './helpers/server.po';
|
||||
import { TestHelper } from './helpers/common.po';
|
||||
import { element } from 'protractor';
|
||||
|
||||
describe('gns3-web-ui App', () => {
|
||||
fdescribe('gns3-web-ui App', () => {
|
||||
let page: ServersPage;
|
||||
let helper: TestHelper;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new ServersPage();
|
||||
helper = new TestHelper();
|
||||
});
|
||||
|
||||
it('should be able to add server', async () => {
|
||||
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 () => {
|
||||
// arrange
|
||||
page.maximizeWindow();
|
||||
await page.navigateToServersPage();
|
||||
@ -17,11 +27,24 @@ describe('gns3-web-ui App', () => {
|
||||
|
||||
// assert
|
||||
expect(text).toBe("We've discovered GNS3 server on 127.0.0.1:3080, would you like to add to the list?");
|
||||
});
|
||||
|
||||
// let firstRowOfServersTable = await page.checkServersTable();
|
||||
it('user should see added server in the list', async () => {
|
||||
// arrange
|
||||
page.maximizeWindow();
|
||||
await page.navigateToServersPage();
|
||||
await page.clickAddServer();
|
||||
helper.sleep(1000);
|
||||
|
||||
// console.log('answer ********************* ', firstRowOfServersTable);
|
||||
// act
|
||||
let firstRowOfServersTable = await page.checkServersTable();
|
||||
let serverData = [];
|
||||
await asyncForEach(firstRowOfServersTable, async element => {
|
||||
serverData.push(await element.getText());
|
||||
});
|
||||
|
||||
// expect(true).toBe(true);
|
||||
// assert
|
||||
expect(serverData).toContain('127.0.0.1');
|
||||
expect(serverData).toContain('3080');
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user