mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-19 21:17:51 +00:00
E2E for project map page
This commit is contained in:
parent
2e82ed8ebf
commit
cf60f1a046
@ -0,0 +1,49 @@
|
||||
import { TestHelper } from "./common.po"
|
||||
import { browser, by } from "protractor";
|
||||
|
||||
export class ProjectMapPage {
|
||||
helper = new TestHelper();
|
||||
|
||||
async openAddProjectDialog() {
|
||||
let addButton = await browser.driver.findElement(by.css('button.addNode'));
|
||||
await addButton.click();
|
||||
}
|
||||
|
||||
async addNode() {
|
||||
let inputs = await browser.driver.findElements(by.css('input.mat-input-element'));
|
||||
await inputs[0].sendKeys('VPCS');
|
||||
this.helper.sleep(1000);
|
||||
|
||||
let selects = await browser.driver.findElements(by.css('mat-select.mat-select'));
|
||||
await selects[1].click();
|
||||
this.helper.sleep(1000);
|
||||
|
||||
let options = await browser.driver.findElements(by.css('mat-option.mat-option'));
|
||||
await options[1].click(); //first option should be chosen
|
||||
this.helper.sleep(1000);
|
||||
|
||||
// new select appears after refreshing data
|
||||
selects = await browser.driver.findElements(by.css('mat-select.mat-select'));
|
||||
if (selects[2]) {
|
||||
await selects[2].click();
|
||||
this.helper.sleep(1000);
|
||||
|
||||
options = await browser.driver.findElements(by.css('mat-option.mat-option'));
|
||||
await options[0].click();
|
||||
this.helper.sleep(1000);
|
||||
}
|
||||
|
||||
let addButton = await browser.driver.findElement(by.css('button.addButton'));
|
||||
await addButton.click();
|
||||
this.helper.sleep(1000);
|
||||
}
|
||||
|
||||
async verifyIfNodeWithLabelExists(labelToFind: string) {
|
||||
let nodeLabel = await browser.driver.findElement(by.css('#map > g > g.layer > g.nodes > g:nth-child(1) > g > g > g > text'));
|
||||
let selectedNode;
|
||||
let textFromNodeLabel = await nodeLabel.getText();
|
||||
if (textFromNodeLabel == labelToFind) selectedNode = nodeLabel;
|
||||
|
||||
return selectedNode ? true : false;
|
||||
}
|
||||
}
|
@ -2,15 +2,18 @@ import { ServersPage } from './helpers/server.po';
|
||||
import { TestHelper } from './helpers/common.po';
|
||||
import { element } from 'protractor';
|
||||
import { ProjectsPage } from './helpers/project.po';
|
||||
import { ProjectMapPage } from './helpers/project-map.po';
|
||||
|
||||
fdescribe('Project map page', () => {
|
||||
let serversPage: ServersPage;
|
||||
let projectsPage: ProjectsPage;
|
||||
let projectMapPage: ProjectMapPage;
|
||||
let helper: TestHelper;
|
||||
|
||||
beforeEach(async () => {
|
||||
serversPage = new ServersPage();
|
||||
projectsPage = new ProjectsPage();
|
||||
projectMapPage = new ProjectMapPage();
|
||||
helper = new TestHelper();
|
||||
|
||||
serversPage.maximizeWindow();
|
||||
@ -23,12 +26,16 @@ fdescribe('Project map page', () => {
|
||||
helper.sleep(2000);
|
||||
});
|
||||
|
||||
it('user should have possibility to add nodes to map', async () => {
|
||||
fit('user should have possibility to add nodes to map', async () => {
|
||||
// arrange
|
||||
projectMapPage.openAddProjectDialog();
|
||||
helper.sleep(2000);
|
||||
|
||||
//act
|
||||
projectMapPage.addNode();
|
||||
helper.sleep(2000);
|
||||
|
||||
//assert
|
||||
expect(true).toBe(true);
|
||||
expect(await projectMapPage.verifyIfNodeWithLabelExists('PC1')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
@ -71,5 +71,5 @@
|
||||
</div>
|
||||
<div mat-dialog-actions align="end">
|
||||
<button mat-button (click)="onNoClick()" tabindex="-1" color="accent">Close</button>
|
||||
<button mat-button (click)="onAddClick()" tabindex="2" mat-raised-button color="primary">Add</button>
|
||||
<button class="addButton" mat-button (click)="onAddClick()" tabindex="2" mat-raised-button color="primary">Add</button>
|
||||
</div>
|
||||
|
@ -1 +1 @@
|
||||
<button matTooltip="Add a node" mat-icon-button (click)="listTemplatesModal()"><mat-icon>add_to_queue</mat-icon></button>
|
||||
<button class="addNode" matTooltip="Add a node" mat-icon-button (click)="listTemplatesModal()"><mat-icon>add_to_queue</mat-icon></button>
|
||||
|
Loading…
Reference in New Issue
Block a user