blob: 534e3dbe490842fa10852e06f4522de6f5f0a8a9 [file] [log] [blame]
maximesson44c49572021-05-20 11:28:46 +02001import { tick } from '@angular/core/testing';
elinuxhenrikf507d922020-03-19 14:52:24 +01002/*-
3 * ========================LICENSE_START=================================
4 * O-RAN-SC
5 * %%
6 * Copyright (C) 2019 AT&T Intellectual Property
7 * %%
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ========================LICENSE_END===================================
20 */
elinuxhenrik45d525d2021-04-21 16:07:31 +020021import { browser, by, element, logging } from "protractor";
elinuxhenrikf507d922020-03-19 14:52:24 +010022
maximesson44c49572021-05-20 11:28:46 +020023describe("Home page", () => {
elinuxhenrikf507d922020-03-19 14:52:24 +010024
25 beforeEach(() => {
maximesson44c49572021-05-20 11:28:46 +020026 browser.get("http://localhost:4200/");
elinuxhenrikf507d922020-03-19 14:52:24 +010027 });
28
elinuxhenrik45d525d2021-04-21 16:07:31 +020029 it("should display title", () => {
elinuxhenrik45d525d2021-04-21 16:07:31 +020030 expect(browser.getTitle()).toEqual("Non-RT RIC Control Panel");
elinuxhenrikf507d922020-03-19 14:52:24 +010031 });
32
maximesson44c49572021-05-20 11:28:46 +020033 it("should reach policy types page when clicking on the policy types card", async () => {
34 await element(by.id('policyControlCard')).click();
35 expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/policy");
36 });
37
PatrikBuhr1408f852021-12-14 08:48:59 +010038 it("should reach information coordinator page when clicking on the information coordinator card", async () => {
maximesson44c49572021-05-20 11:28:46 +020039 await element(by.id('eicCard')).click();
40 expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/ei-coordinator");
41 });
42
43 afterEach(async () => {
44 // Assert that there are no errors emitted from the browser
45 const logs = await browser.manage().logs().get(logging.Type.BROWSER);
46 expect(logs).not.toContain(
47 jasmine.objectContaining({
48 level: logging.Level.SEVERE,
49 })
50 );
51 });
52});
53
54describe("Sidebar navigation", () => {
55
56 beforeEach(() => {
57 browser.get("http://localhost:4200/");
58 element(by.id('Menu_Burger_Icon')).click();
59 });
60
61 it("should reach policy types page when clicking in the side bar", async () => {
62 await element(by.id('policyToggle')).click();
63 await element(by.id('policyLink')).click();
64 expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/policy");
65 });
66
67 it("should reach ric configuration page when clicking in the side bar", async () => {
68 await element(by.id('policyToggle')).click();
69 await element(by.id('ricConfigLink')).click();
70 expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/ric-config");
71 });
72
PatrikBuhr1408f852021-12-14 08:48:59 +010073 it("should reach information coordinator page when clicking in the side bar", async () => {
maximesson44c49572021-05-20 11:28:46 +020074 await element(by.id('eicLink')).click();
75 expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/ei-coordinator");
76 });
77
78 afterEach(async () => {
79 // Assert that there are no errors emitted from the browser
80 const logs = await browser.manage().logs().get(logging.Type.BROWSER);
81 expect(logs).not.toContain(
82 jasmine.objectContaining({
83 level: logging.Level.SEVERE,
84 })
85 );
86 });
87});
88
89describe("Policy types page", () => {
90
91 beforeEach(() => {
92 browser.get("http://localhost:4200/policy");
93 });
94
95 it("should reach back to home from policy types page when clicking in the side bar", async () => {
96 await element(by.id('Menu_Burger_Icon')).click();
97 await element(by.id('homeLink')).click();
98 expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/");
99 });
100
101 it("should show types when clicking on expand button in policy types page", async () => {
102 await element(by.id('visible')).click();
103 expect(element(by.id('createButton'))).toBeTruthy();
104 });
105
106 it("should display a pop-up window when clicking on the create button for a policy instance", async () => {
107 await element(by.id('visible')).click();
108 await element(by.id('createButton')).click();
109 expect(element(by.id('closeButton'))).toBeTruthy();
110 });
111
112 it("should open a pop-up window when clicking on the data of a policy instance", async () => {
113 await element(by.id('visible')).click();
114 let instanceTable = element(by.id('policiesTable'));
115 await element(by.css('mat-cell')).click();
116 expect(element(by.id('closeButton'))).toBeTruthy();
117 });
118
119 afterEach(async () => {
120 // Assert that there are no errors emitted from the browser
121 const logs = await browser.manage().logs().get(logging.Type.BROWSER);
122 expect(logs).not.toContain(
123 jasmine.objectContaining({
124 level: logging.Level.SEVERE,
125 })
126 );
127 });
128});
129
PatrikBuhr1408f852021-12-14 08:48:59 +0100130describe("Information coordinator page", () => {
maximesson44c49572021-05-20 11:28:46 +0200131
132 beforeEach(() => {
133 browser.get("http://localhost:4200/ei-coordinator");
134 });
135
PatrikBuhr1408f852021-12-14 08:48:59 +0100136 it("should reach back to home from information coordinator page when clicking in the side bar", async () => {
maximesson44c49572021-05-20 11:28:46 +0200137 await element(by.id('Menu_Burger_Icon')).click();
138 await element(by.id('homeLink')).click();
139 expect(browser.getCurrentUrl()).toEqual("http://localhost:4200/");
140 });
141
elinuxhenrikf507d922020-03-19 14:52:24 +0100142 afterEach(async () => {
143 // Assert that there are no errors emitted from the browser
144 const logs = await browser.manage().logs().get(logging.Type.BROWSER);
elinuxhenrik45d525d2021-04-21 16:07:31 +0200145 expect(logs).not.toContain(
146 jasmine.objectContaining({
147 level: logging.Level.SEVERE,
148 })
149 );
elinuxhenrikf507d922020-03-19 14:52:24 +0100150 });
151});