X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fe2e%2Fsrc%2Fapp.e2e-spec.ts;h=4e0107588bc9848bce18b3bd053d3fe519fab86b;hb=1b0075b7dba448dc6ea494649e0141bee615b8f5;hp=e72cb6ebaec68396ff29cd5218424ec16751da57;hpb=f507d92d55ee77fad16cc024ea95c869e0d5dc32;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/e2e/src/app.e2e-spec.ts b/webapp-frontend/e2e/src/app.e2e-spec.ts index e72cb6e..4e01075 100644 --- a/webapp-frontend/e2e/src/app.e2e-spec.ts +++ b/webapp-frontend/e2e/src/app.e2e-spec.ts @@ -1,3 +1,4 @@ +import { tick } from '@angular/core/testing'; /*- * ========================LICENSE_START================================= * O-RAN-SC @@ -17,26 +18,134 @@ * limitations under the License. * ========================LICENSE_END=================================== */ -import { AppPage } from './app.po'; -import { browser, logging } from 'protractor'; +import { browser, by, element, logging } from "protractor"; -describe('workspace-project App', () => { - let page: AppPage; +describe("Home page", () => { beforeEach(() => { - page = new AppPage(); + browser.get("http://localhost:4200/"); }); - it('should display welcome message', () => { - page.navigateTo(); - expect(page.getTitleText()).toEqual('Welcome to controlpanelApp!'); + it("should display title", () => { + expect(browser.getTitle()).toEqual("Non-RT RIC Control Panel"); + }); + + it("should reach policy types page when clicking on the policy types card", async () => { + await element(by.id('policyControlCard')).click(); + expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/policy"); + }); + + it("should reach enrichment information coordinator page when clicking on the enrichment information coordinator card", async () => { + await element(by.id('eicCard')).click(); + expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/ei-coordinator"); + }); + + afterEach(async () => { + // Assert that there are no errors emitted from the browser + const logs = await browser.manage().logs().get(logging.Type.BROWSER); + expect(logs).not.toContain( + jasmine.objectContaining({ + level: logging.Level.SEVERE, + }) + ); + }); +}); + +describe("Sidebar navigation", () => { + + beforeEach(() => { + browser.get("http://localhost:4200/"); + element(by.id('Menu_Burger_Icon')).click(); + }); + + it("should reach policy types page when clicking in the side bar", async () => { + await element(by.id('policyToggle')).click(); + await element(by.id('policyLink')).click(); + expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/policy"); + }); + + it("should reach ric configuration page when clicking in the side bar", async () => { + await element(by.id('policyToggle')).click(); + await element(by.id('ricConfigLink')).click(); + expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/ric-config"); + }); + + it("should reach enrichment information coordinator page when clicking in the side bar", async () => { + await element(by.id('eicLink')).click(); + expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/ei-coordinator"); + }); + + afterEach(async () => { + // Assert that there are no errors emitted from the browser + const logs = await browser.manage().logs().get(logging.Type.BROWSER); + expect(logs).not.toContain( + jasmine.objectContaining({ + level: logging.Level.SEVERE, + }) + ); + }); +}); + +describe("Policy types page", () => { + + beforeEach(() => { + browser.get("http://localhost:4200/policy"); + }); + + it("should reach back to home from policy types page when clicking in the side bar", async () => { + await element(by.id('Menu_Burger_Icon')).click(); + await element(by.id('homeLink')).click(); + expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/"); + }); + + it("should show types when clicking on expand button in policy types page", async () => { + await element(by.id('visible')).click(); + expect(element(by.id('createButton'))).toBeTruthy(); + }); + + it("should display a pop-up window when clicking on the create button for a policy instance", async () => { + await element(by.id('visible')).click(); + await element(by.id('createButton')).click(); + expect(element(by.id('closeButton'))).toBeTruthy(); + }); + + it("should open a pop-up window when clicking on the data of a policy instance", async () => { + await element(by.id('visible')).click(); + let instanceTable = element(by.id('policiesTable')); + await element(by.css('mat-cell')).click(); + expect(element(by.id('closeButton'))).toBeTruthy(); + }); + + afterEach(async () => { + // Assert that there are no errors emitted from the browser + const logs = await browser.manage().logs().get(logging.Type.BROWSER); + expect(logs).not.toContain( + jasmine.objectContaining({ + level: logging.Level.SEVERE, + }) + ); + }); +}); + +describe("Enrichment information coordinator page", () => { + + beforeEach(() => { + browser.get("http://localhost:4200/ei-coordinator"); + }); + + it("should reach back to home from enrichment information coordinator page when clicking in the side bar", async () => { + await element(by.id('Menu_Burger_Icon')).click(); + await element(by.id('homeLink')).click(); + expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/"); }); afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); - expect(logs).not.toContain(jasmine.objectContaining({ - level: logging.Level.SEVERE, - })); + expect(logs).not.toContain( + jasmine.objectContaining({ + level: logging.Level.SEVERE, + }) + ); }); });