This commit is contained in:
piotrpekala7 2020-02-07 13:57:32 +01:00
parent e11281ddf6
commit f744c02c44
5 changed files with 60 additions and 5 deletions

View File

@ -1,14 +1,20 @@
import { Gns3WebUiPage } from './app.po'; import { Gns3WebUiPage } from './app.po';
describe('gns3-web-ui App', () => { describe('GNS3 Web UI Application', () => {
let page: Gns3WebUiPage; let page: Gns3WebUiPage;
beforeEach(() => { beforeEach(() => {
page = new Gns3WebUiPage(); page = new Gns3WebUiPage();
}); });
it('should display title', () => { it('should have correct page title', async () => {
page.navigateTo(); // arrange
expect(page.getTitleText()).toEqual('GNS3 Web UI'); await page.navigateTo();
// act
let text = await page.getTitleText();
// assert
expect(text).toEqual('GNS3 Web UI');
}); });
}); });

View File

@ -6,7 +6,7 @@ export class Gns3WebUiPage {
} }
getTitleText() { getTitleText() {
return browser.getTitle(); return browser.driver.getTitle();
} }
getParagraphText() { getParagraphText() {

20
e2e/helpers/server.po.ts Normal file
View File

@ -0,0 +1,20 @@
import { browser, by, element } from 'protractor';
export class ServersPage {
maximizeWindow() {
browser.driver.manage().window().maximize();
}
navigateToServersPage() {
return browser.get('/servers');
}
getAddServerNotificationText() {
return browser.driver.findElement(by.className('mat-card-content')).getText();
// return element(by.className('mat-card-content')[0]).getText();
}
checkServersTable() {
return browser.driver.findElement(by.className('mat-cell cdk-column-id mat-column-id ng-star-inserted')).getText();
}
}

27
e2e/servers.e2e-spec.ts Normal file
View File

@ -0,0 +1,27 @@
import { ServersPage } from './helpers/server.po';
describe('gns3-web-ui App', () => {
let page: ServersPage;
beforeEach(() => {
page = new ServersPage();
});
it('should be able to add server', async () => {
// 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?");
// let firstRowOfServersTable = await page.checkServersTable();
// console.log('answer ********************* ', firstRowOfServersTable);
// expect(true).toBe(true);
});
});

View File

@ -85,6 +85,8 @@
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^0.803.10", "@angular-devkit/build-angular": "^0.803.10",
"@angular-devkit/core": "^8.3.23",
"@angular-devkit/schematics": "^8.3.23",
"@angular/cli": "^8.3.10", "@angular/cli": "^8.3.10",
"@angular/compiler-cli": "^8.2.11", "@angular/compiler-cli": "^8.2.11",
"@angular/language-service": "^8.2.11", "@angular/language-service": "^8.2.11",