maximesson | 44c4957 | 2021-05-20 11:28:46 +0200 | [diff] [blame] | 1 | import { tick } from '@angular/core/testing'; |
elinuxhenrik | f507d92 | 2020-03-19 14:52:24 +0100 | [diff] [blame] | 2 | /*- |
| 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 | */ |
elinuxhenrik | 45d525d | 2021-04-21 16:07:31 +0200 | [diff] [blame] | 21 | import { browser, by, element, logging } from "protractor"; |
elinuxhenrik | f507d92 | 2020-03-19 14:52:24 +0100 | [diff] [blame] | 22 | |
maximesson | 44c4957 | 2021-05-20 11:28:46 +0200 | [diff] [blame] | 23 | describe("Home page", () => { |
elinuxhenrik | f507d92 | 2020-03-19 14:52:24 +0100 | [diff] [blame] | 24 | |
| 25 | beforeEach(() => { |
maximesson | 44c4957 | 2021-05-20 11:28:46 +0200 | [diff] [blame] | 26 | browser.get("http://localhost:4200/"); |
elinuxhenrik | f507d92 | 2020-03-19 14:52:24 +0100 | [diff] [blame] | 27 | }); |
| 28 | |
elinuxhenrik | 45d525d | 2021-04-21 16:07:31 +0200 | [diff] [blame] | 29 | it("should display title", () => { |
elinuxhenrik | 45d525d | 2021-04-21 16:07:31 +0200 | [diff] [blame] | 30 | expect(browser.getTitle()).toEqual("Non-RT RIC Control Panel"); |
elinuxhenrik | f507d92 | 2020-03-19 14:52:24 +0100 | [diff] [blame] | 31 | }); |
| 32 | |
maximesson | 44c4957 | 2021-05-20 11:28:46 +0200 | [diff] [blame] | 33 | 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 | |
PatrikBuhr | 1408f85 | 2021-12-14 08:48:59 +0100 | [diff] [blame^] | 38 | it("should reach information coordinator page when clicking on the information coordinator card", async () => { |
maximesson | 44c4957 | 2021-05-20 11:28:46 +0200 | [diff] [blame] | 39 | 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 | |
| 54 | describe("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 | |
PatrikBuhr | 1408f85 | 2021-12-14 08:48:59 +0100 | [diff] [blame^] | 73 | it("should reach information coordinator page when clicking in the side bar", async () => { |
maximesson | 44c4957 | 2021-05-20 11:28:46 +0200 | [diff] [blame] | 74 | 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 | |
| 89 | describe("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 | |
PatrikBuhr | 1408f85 | 2021-12-14 08:48:59 +0100 | [diff] [blame^] | 130 | describe("Information coordinator page", () => { |
maximesson | 44c4957 | 2021-05-20 11:28:46 +0200 | [diff] [blame] | 131 | |
| 132 | beforeEach(() => { |
| 133 | browser.get("http://localhost:4200/ei-coordinator"); |
| 134 | }); |
| 135 | |
PatrikBuhr | 1408f85 | 2021-12-14 08:48:59 +0100 | [diff] [blame^] | 136 | it("should reach back to home from information coordinator page when clicking in the side bar", async () => { |
maximesson | 44c4957 | 2021-05-20 11:28:46 +0200 | [diff] [blame] | 137 | 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 | |
elinuxhenrik | f507d92 | 2020-03-19 14:52:24 +0100 | [diff] [blame] | 142 | afterEach(async () => { |
| 143 | // Assert that there are no errors emitted from the browser |
| 144 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); |
elinuxhenrik | 45d525d | 2021-04-21 16:07:31 +0200 | [diff] [blame] | 145 | expect(logs).not.toContain( |
| 146 | jasmine.objectContaining({ |
| 147 | level: logging.Level.SEVERE, |
| 148 | }) |
| 149 | ); |
elinuxhenrik | f507d92 | 2020-03-19 14:52:24 +0100 | [diff] [blame] | 150 | }); |
| 151 | }); |