This is an automated email from the ASF dual-hosted git repository.
mattjackson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 7fcc27e TP Migrate login test from E2E to integrate test suite (#5988)
7fcc27e is described below
commit 7fcc27e1b7c7cba2e077f440e01e21f9b111556f
Author: dpham <[email protected]>
AuthorDate: Tue Jul 6 09:43:43 2021 -0600
TP Migrate login test from E2E to integrate test suite (#5988)
* Add logout
* Add test
* Fix check
* Remove log out
Co-authored-by: Pham, Dandy (Contractor) <[email protected]>
---
traffic_portal/test/integration/PageObjects/LoginPage.po.ts | 11 ++++++++++-
traffic_portal/test/integration/specs/Login.spec.ts | 7 ++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/traffic_portal/test/integration/PageObjects/LoginPage.po.ts
b/traffic_portal/test/integration/PageObjects/LoginPage.po.ts
index 84af4b2..c5a3a97 100644
--- a/traffic_portal/test/integration/PageObjects/LoginPage.po.ts
+++ b/traffic_portal/test/integration/PageObjects/LoginPage.po.ts
@@ -46,10 +46,11 @@ export class LoginPage extends BasePage{
private btnLogin = element(by.name("loginSubmit"))
private lnkResetPassword= element (by.xpath("//button[text()='Reset
Password']"))
private lblUserName = element(by.xpath("//span[@id='headerUsername']"))
+ private bannerEnvironment = element(by.css('.enviro-banner.prod'));
private randomize = randomize;
- async Login(login: LoginData){
+ public async Login(login: LoginData){
let result = false;
const basePage = new BasePage();
if(login.username === 'admin'){
@@ -82,4 +83,12 @@ export class LoginPage extends BasePage{
return false;
}
}
+
+ public async CheckBanner(): Promise<boolean> {
+ if(await this.bannerEnvironment.isPresent()){
+ return true;
+ }else{
+ return false;
+ }
+ }
};
diff --git a/traffic_portal/test/integration/specs/Login.spec.ts
b/traffic_portal/test/integration/specs/Login.spec.ts
index 084ae6d..ce28e74 100644
--- a/traffic_portal/test/integration/specs/Login.spec.ts
+++ b/traffic_portal/test/integration/specs/Login.spec.ts
@@ -17,20 +17,21 @@
* under the License.
*/
import { browser } from 'protractor';
-
import { LoginPage } from '../PageObjects/LoginPage.po';
import { login } from "../Data";
const loginPage = new LoginPage();
-
login.tests.forEach(async loginData => {
loginData.logins.forEach(login => {
describe(`Traffic Portal - Login - ${login.description}`, () => {
it('can open login page', async () => {
browser.get(browser.params.baseUrl);
});
+ it('check environment banner does not display',async() => {
+ expect(await loginPage.CheckBanner()).toBe(false);
+ })
it(login.description, async () => {
- expect(await loginPage.Login(login)).toBeTruthy();
+ expect(await loginPage.Login(login)).toBe(true);
});
});
});