You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/05/19 15:13:18 UTC

[GitHub] [trafficcontrol] rimashah25 opened a new pull request #5870: Migrate user tests from E2E to integration

rimashah25 opened a new pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870


   <!--
   ************ STOP!! ************
   If this Pull Request is intended to fix a security vulnerability, DO NOT submit it! Instead, contact
   the Apache Software Foundation Security Team at security@trafficcontrol.apache.org and follow the
   guidelines at https://www.apache.org/security/ regarding vulnerability disclosure.
   -->
   ## What does this PR (Pull Request) do?
   <!-- Explain the changes you made here. If this fixes an Issue, identify it by
   replacing the text in the checkbox item with the Issue number e.g.
   
   - [x] This PR fixes #9001 OR is not related to any Issue
   
   ^ This will automatically close Issue number 9001 when the Pull Request is
   merged (The '#' is important).
   
   Be sure you check the box properly, see the "The following criteria are ALL
   met by this PR" section for details.
   -->
   
   - [ ] This PR fixes #REPLACE_ME OR is not related to any Issue <!-- You can check for an issue here: https://github.com/apache/trafficcontrol/issues -->
   
   
   ## Which Traffic Control components are affected by this PR?
   <!-- Please delete all components from this list that are NOT affected by this
   Pull Request. Also, feel free to add the name of a tool or script that is
   affected but not on the list.
   
   Additionally, if this Pull Request does NOT affect documentation, please
   explain why documentation is not required. -->
   
   - CDN in a Box
   - Documentation
   - Grove
   - Traffic Control Client <!-- Please specify which; e.g. 'Python', 'Go', 'Java' -->
   - Traffic Monitor
   - Traffic Ops
   - Traffic Ops ORT
   - Traffic Portal
   - Traffic Router
   - Traffic Stats
   - Traffic Vault
   - CI tests
   
   ## What is the best way to verify this PR?
   <!-- Please include here ALL the steps necessary to test your Pull Request. If
   it includes tests (and most should), outline here the steps needed to run the
   tests. If not, lay out the manual testing procedure and please explain why
   tests are unnecessary for this Pull Request. -->
   
   ## If this is a bug fix, what versions of Traffic Control are affected?
   <!-- If this PR fixes a bug, please list here all of the affected versions - to
   the best of your knowledge. It's also pretty helpful to include a commit hash
   of where 'master' is at the time this PR is opened (if it affects master),
   because what 'master' means will change over time. For example, if this PR
   fixes a bug that's present in master (at commit hash '1df853c8'), in v4.0.0,
   and in the current 4.0.1 Release candidate (e.g. RC1), then this list would
   look like:
   
   - master (1df853c8)
   - 4.0.0
   - 4.0.1 (RC1)
   
   If you don't know what other versions might have this bug, AND don't know how
   to find the commit hash of 'master', then feel free to leave this section
   blank (or, preferably, delete it entirely).
    -->
   
   
   ## The following criteria are ALL met by this PR
   <!-- Check the boxes to signify that the associated statement is true. To
   "check a box", replace the space inside of the square brackets with an 'x'.
   e.g.
   
   - [ x] <- Wrong
   - [x ] <- Wrong
   - [] <- Wrong
   - [*] <- Wrong
   - [x] <- Correct!
   
   -->
   
   - [ ] This PR includes tests OR I have explained why tests are unnecessary
   - [ ] This PR includes documentation OR I have explained why documentation is unnecessary
   - [ ] This PR includes an update to CHANGELOG.md OR such an update is not necessary
   - [ ] This PR includes any and all required license headers
   - [ ] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details)
   
   
   ## Additional Information
   <!-- If you would like to include any additional information on the PR for
   potential reviewers please put it here.
   
   Some examples of this would be:
   
   - Before and after screenshots/gifs of the Traffic Portal if it is affected
   - Links to other dependent Pull Requests
   - References to relevant context (e.g. new/updates to dependent libraries,
   mailing list records, blueprints)
   
   Feel free to leave this section blank (or, preferably, delete it entirely).
   -->
   
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635617800



##########
File path: traffic_portal/test/integration/Data/users.ts
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {randomize} from "../config";
+
+export const users = {
+    tests: [
+        {
+            logins: [
+                {
+                    description: "Admin Role",
+                    username: "TPAdmin",
+                    password: "pa$$word"
+                }
+            ],
+            check: [
+                {
+                    description: "check CSV link from CDN page",
+                    Name: "Export as CSV"
+                }
+            ],
+            toggle: [
+                {
+                    description: "hide first table column",
+                    Name: "Email"
+                },
+                {
+                    description: "redisplay first table column",
+                    Name: "Email"
+                }
+            ],
+            add: [
+                {
+                    description: "create a new User",
+                    FullName: "TPCreateUser1",
+                    Username: "User1",
+                    Email: "test@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    Password: "qwe@123#rty",
+                    ConfirmPassword: "qwe@123#rty",
+                    PublicSSHKey: "",
+                    validationMessage: "User created"
+                },
+            ],
+            register: [
+                {
+                    description: "create a registered User",
+                    Email: "test2@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    validationMessage: "Sent user registration to {{ test2@cdn.tc.com"+randomize+"}} with the following permissions [ role: admin | tenant: tenantSame"+randomize+" ]"

Review comment:
       Ok, Thanks for the explanation. I am neutral on the easier read wrt template string vs string manipulation. But I have seen template string usage in TO/TM/TS go code and can maintain the same in typescript too.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635574490



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {

Review comment:
       Why would I need a return type when the function isn't returning anything?
   SideNavigatePath() => also, doesn't return anything but only executes the cmds
   ```
   async NavigateToUsersPage(){
           await browser.wait(ExpectedConditions.visibilityOf(this.lnkUsers), 2000);
           await browser.actions().mouseMove(this.lnkUsers).perform();
           await browser.actions().click(this.lnkUsers).perform();
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635521989



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();
+        let name = nameEmail + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('email')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async UpdateUser(user: UpdateUser): Promise<boolean  | undefined> {

Review comment:
       It looks like the tests actually only check that the resolution of this is "truthy" or literally `true`, so why not just return a `Promise<boolean>` instead of allowing it to be `undefined`? Allowing `undefined` could be confusing, for example, if `UpdateUser` returns a `Promise<boolean>`, these are the same check:
   
   ```typescript
   expect(await usersPage.UpdateUser(u)).toBeTrue(); // or .toBe(true)
   expect(await usersPage.UpdateUser(u)).not.toBeFalse(); // or .toBe(false)
   ```
   
   ... but if it returns a `Promise<boolean | undefined>`, they are **not** the same. These checks also have the same problem where they're identical for `Promise<boolean>` but not `Promise<boolean>`:
   
   ```typescript
   expect(await usersPage.UpdateUser(u)).toBeFalse();
   expect(await usersPage.UpdateUser(u)).toBe(false);
   expect(await usersPage.UpdateUser(u)).toBeFalsey()
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635574490



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {

Review comment:
       Why would I need a return type when the function isn't returning anything?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635612670



##########
File path: traffic_portal/test/integration/Data/users.ts
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {randomize} from "../config";
+
+export const users = {
+    tests: [
+        {
+            logins: [
+                {
+                    description: "Admin Role",
+                    username: "TPAdmin",
+                    password: "pa$$word"
+                }
+            ],
+            check: [
+                {
+                    description: "check CSV link from CDN page",
+                    Name: "Export as CSV"
+                }
+            ],
+            toggle: [
+                {
+                    description: "hide first table column",
+                    Name: "Email"
+                },
+                {
+                    description: "redisplay first table column",
+                    Name: "Email"
+                }
+            ],
+            add: [
+                {
+                    description: "create a new User",
+                    FullName: "TPCreateUser1",
+                    Username: "User1",
+                    Email: "test@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    Password: "qwe@123#rty",
+                    ConfirmPassword: "qwe@123#rty",
+                    PublicSSHKey: "",
+                    validationMessage: "User created"
+                },
+            ],
+            register: [
+                {
+                    description: "create a registered User",
+                    Email: "test2@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    validationMessage: "Sent user registration to {{ test2@cdn.tc.com"+randomize+"}} with the following permissions [ role: admin | tenant: tenantSame"+randomize+" ]"

Review comment:
       What I mean is that
   ```typescript
   "part of a string "+something+" the rest of the string";
   ```
   is the same as
   ```typescript
   `part of a string ${something} the rest of the string`;
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635575254



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();
+        await snp.NavigateToUsersPage();
+    }
+
+    async OpenUserMenu() {

Review comment:
       Same question as the above




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635616326



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {

Review comment:
       That's why, because it actually does return something, and that's not immediately obvious:
   ```javascript
   // A Promise that just resolves to 5
   const p = new Promise(resolve=>resolve(5));
   async function sideNavMethod() {
   	await p; // discarding return value; just wanted to 'await' something
   }
   
   async function userPageMethod() {
   	await sideNavMethod();
   }
   
   // outputs: object
   console.log(typeof(userPageMethod()));
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635578074



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {

Review comment:
       Again, not returning anything, so why a return type?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635574490



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {

Review comment:
       Why would I need a return type when the function isn't returning anything?
   SideNavigatePath() => also, doesn't return anything but only executes the cmds
   async NavigateToUsersPage(){
           await browser.wait(ExpectedConditions.visibilityOf(this.lnkUsers), 2000);
           await browser.actions().mouseMove(this.lnkUsers).perform();
           await browser.actions().click(this.lnkUsers).perform();
       }




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635567427



##########
File path: traffic_portal/test/integration/Data/users.ts
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {randomize} from "../config";
+
+export const users = {
+    tests: [
+        {
+            logins: [
+                {
+                    description: "Admin Role",
+                    username: "TPAdmin",
+                    password: "pa$$word"
+                }
+            ],
+            check: [
+                {
+                    description: "check CSV link from CDN page",
+                    Name: "Export as CSV"
+                }
+            ],
+            toggle: [
+                {
+                    description: "hide first table column",
+                    Name: "Email"
+                },
+                {
+                    description: "redisplay first table column",
+                    Name: "Email"
+                }
+            ],
+            add: [
+                {
+                    description: "create a new User",
+                    FullName: "TPCreateUser1",
+                    Username: "User1",
+                    Email: "test@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    Password: "qwe@123#rty",
+                    ConfirmPassword: "qwe@123#rty",
+                    PublicSSHKey: "",
+                    validationMessage: "User created"
+                },
+            ],
+            register: [
+                {
+                    description: "create a registered User",
+                    Email: "test2@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    validationMessage: "Sent user registration to {{ test2@cdn.tc.com"+randomize+"}} with the following permissions [ role: admin | tenant: tenantSame"+randomize+" ]"

Review comment:
       I am not sure I understand what you are trying to imply.
   The above validation message is what is seen on TP, when a user registers.
   ![image](https://user-images.githubusercontent.com/22248619/118881064-de1a8680-b8af-11eb-825d-7743968a558b.png)
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635567427



##########
File path: traffic_portal/test/integration/Data/users.ts
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {randomize} from "../config";
+
+export const users = {
+    tests: [
+        {
+            logins: [
+                {
+                    description: "Admin Role",
+                    username: "TPAdmin",
+                    password: "pa$$word"
+                }
+            ],
+            check: [
+                {
+                    description: "check CSV link from CDN page",
+                    Name: "Export as CSV"
+                }
+            ],
+            toggle: [
+                {
+                    description: "hide first table column",
+                    Name: "Email"
+                },
+                {
+                    description: "redisplay first table column",
+                    Name: "Email"
+                }
+            ],
+            add: [
+                {
+                    description: "create a new User",
+                    FullName: "TPCreateUser1",
+                    Username: "User1",
+                    Email: "test@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    Password: "qwe@123#rty",
+                    ConfirmPassword: "qwe@123#rty",
+                    PublicSSHKey: "",
+                    validationMessage: "User created"
+                },
+            ],
+            register: [
+                {
+                    description: "create a registered User",
+                    Email: "test2@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    validationMessage: "Sent user registration to {{ test2@cdn.tc.com"+randomize+"}} with the following permissions [ role: admin | tenant: tenantSame"+randomize+" ]"

Review comment:
       I am not sure I understand what you are trying to imply.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635521989



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();
+        let name = nameEmail + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('email')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async UpdateUser(user: UpdateUser): Promise<boolean  | undefined> {

Review comment:
       It looks like the tests actually only check that the resolution of this is "truthy" or literally `true`, so why not just return a `Promise<boolean>` instead of allowing it to be `undefined`? Allowing `undefined` could be confusing, for example, if `UpdateUser` returns a `Promise<boolean>`, these are the same check:
   
   ```typescript
   expect(await usersPage.UpdateUser(u)).toBeTrue(); // or .toBe(true)
   expect(await usersPage.UpdateUser(u)).not.toBeFalse(); // or .toBe(false)
   ```
   
   ... but if it returns a `Promise<boolean | undefined>`, they are **not** the same. These checks also have the same problem where they're identical for `Promise<boolean>` but not `Promise<boolean | undefined>`:
   
   ```typescript
   expect(await usersPage.UpdateUser(u)).toBeFalse();
   expect(await usersPage.UpdateUser(u)).toBe(false);
   expect(await usersPage.UpdateUser(u)).toBeFalsey()
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635502168



##########
File path: traffic_portal/test/integration/Data/users.ts
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {randomize} from "../config";
+
+export const users = {
+    tests: [
+        {
+            logins: [
+                {
+                    description: "Admin Role",
+                    username: "TPAdmin",
+                    password: "pa$$word"
+                }
+            ],
+            check: [
+                {
+                    description: "check CSV link from CDN page",
+                    Name: "Export as CSV"
+                }
+            ],
+            toggle: [
+                {
+                    description: "hide first table column",
+                    Name: "Email"
+                },
+                {
+                    description: "redisplay first table column",
+                    Name: "Email"
+                }
+            ],
+            add: [
+                {
+                    description: "create a new User",
+                    FullName: "TPCreateUser1",
+                    Username: "User1",
+                    Email: "test@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    Password: "qwe@123#rty",
+                    ConfirmPassword: "qwe@123#rty",
+                    PublicSSHKey: "",
+                    validationMessage: "User created"
+                },
+            ],
+            register: [
+                {
+                    description: "create a registered User",
+                    Email: "test2@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    validationMessage: "Sent user registration to {{ test2@cdn.tc.com"+randomize+"}} with the following permissions [ role: admin | tenant: tenantSame"+randomize+" ]"
+                }
+            ],
+            update: [
+                {
+                    description: "update user's fullname",
+                    Username: "User1",
+                    NewFullName: "TPUpdatedUser1",
+                    validationMessage: "user was updated."
+                },
+            ],
+            updateRegisterUser: [
+                {
+                    description: "update registered user's fullname",
+                    Email: "test2@cdn.tc.com",
+                    NewFullName: "TPRegisterUser1",
+                    validationMessage: "user was updated."
+                }
+            ],
+        },
+    ]
+};

Review comment:
       Missing newline at EOF

##########
File path: traffic_portal/test/integration/PageObjects/BasePage.po.ts
##########
@@ -39,6 +39,7 @@ export class BasePage {
   private btnCancel =  element(by.className('close')).element(by.xpath("//span[text()='×']"));
   private btnUpdate = element(by.xpath("//button[text()='Update']"))
   private btnSubmit = element(by.xpath("//button[text()='Submit']"));
+  private btnRegister = element(by.xpath("//button[text()='Send Registration']"));

Review comment:
       You can just use [`by.buttonText`](https://www.protractortest.org/#/api?view=ProtractorBy.prototype.buttonText) to get a button with some specific text.

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();

Review comment:
       nit: `snp` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/Data/users.ts
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {randomize} from "../config";
+
+export const users = {
+    tests: [
+        {
+            logins: [
+                {
+                    description: "Admin Role",
+                    username: "TPAdmin",
+                    password: "pa$$word"
+                }
+            ],
+            check: [
+                {
+                    description: "check CSV link from CDN page",
+                    Name: "Export as CSV"
+                }
+            ],
+            toggle: [
+                {
+                    description: "hide first table column",
+                    Name: "Email"
+                },
+                {
+                    description: "redisplay first table column",
+                    Name: "Email"
+                }
+            ],
+            add: [
+                {
+                    description: "create a new User",
+                    FullName: "TPCreateUser1",
+                    Username: "User1",
+                    Email: "test@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    Password: "qwe@123#rty",
+                    ConfirmPassword: "qwe@123#rty",
+                    PublicSSHKey: "",
+                    validationMessage: "User created"
+                },
+            ],
+            register: [
+                {
+                    description: "create a registered User",
+                    Email: "test2@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    validationMessage: "Sent user registration to {{ test2@cdn.tc.com"+randomize+"}} with the following permissions [ role: admin | tenant: tenantSame"+randomize+" ]"

Review comment:
       nit: template string would be easier to read and write

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();
+        await snp.NavigateToUsersPage();
+    }
+
+    async OpenUserMenu() {

Review comment:
       Missing return type on call signature

##########
File path: traffic_portal/test/integration/PageObjects/BasePage.po.ts
##########
@@ -77,6 +78,14 @@ export class BasePage {
       return false;
     }
   }
+  async ClickRegister(){

Review comment:
       Missing return type on call signature. I also like to specify `public`/`protected`/`private`, but that's entirely up to you.

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {

Review comment:
       Missing return type on call signature

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();
+        await snp.NavigateToUsersPage();
+    }
+
+    async OpenUserMenu() {
+        let snp = new SideNavigationPage();
+        await snp.ClickUserAdminMenu();
+    }
+
+    public async CheckCSV(name: string): Promise<boolean> {
+        return element(by.cssContainingText("span", name)).isPresent();
+    }
+
+    public async CheckToggle(name: string): Promise<boolean> {
+        let result = false;
+        await this.btnTableColumn.click();
+        //if the box is already checked, uncheck it and return false
+        if (await browser.isElementPresent(element(by.xpath("//th[text()='" + name + "']"))) === true) {

Review comment:
       Don't need to compare boolean values to `true`, you can just use them as the condition.

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();
+        let name = nameEmail + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('email')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async UpdateUser(user: UpdateUser): Promise<boolean  | undefined> {
+        let basePage = new BasePage();
+        switch (user.description) {
+            case "update user's fullname":
+                await this.txtFullName.clear();
+                await this.txtFullName.sendKeys(user.NewFullName);
+                await basePage.ClickUpdate();
+                break;
+            default:
+                return undefined;
+        }
+        return await basePage.GetOutputMessage().then(value => user.validationMessage === value);
+    }
+
+    public async RegisterUser(user: RegisterUser): Promise<boolean> {
+        let result = false;
+        let basePage = new BasePage();
+        let snp = new SideNavigationPage();

Review comment:
       nit: `snp` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {

Review comment:
       Missing return type on call signature

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();
+        let name = nameEmail + this.randomize;

Review comment:
       nit: `name` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;

Review comment:
       nit: `name` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();
+        let name = nameEmail + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('email')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async UpdateUser(user: UpdateUser): Promise<boolean  | undefined> {

Review comment:
       It looks like the tests actually only check that the resolution of this is "truthy" or literally `true`, so why not just return a `Promise<boolean>` instead of allowing it to be `undefined`? Allowing `undefined` could be confusing, for example, if `UpdateUser` returns a `Promise<boolean>`, these are the same check:
   
   ```typescript
   expect(await usersPage.UpdateUser(u)).toBeTrue(); // or .toBe(true)
   expect(await usersPage.UpdateUser(u)).not.toBeFalse(); // or .toBe(false)
   ```
   
   ... but if it returns a `Promise<boolean | undefined>`, they are **not** the same. These pairs of checks also have the same problem where they're identical for `Promise<boolean>` but not `Promise<boolean>`:
   
   ```typescript
   expect(await usersPage.UpdateUser(u)).toBeFalse();
   expect(await usersPage.UpdateUser(u)).toBe(false);
   expect(await usersPage.UpdateUser(u)).toBeFalsey()
   ```

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();
+        let name = nameEmail + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('email')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async UpdateUser(user: UpdateUser): Promise<boolean  | undefined> {
+        let basePage = new BasePage();

Review comment:
       nit: `basePage` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/specs/Users.spec.ts
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { browser } from 'protractor';
+
+import { LoginPage } from '../PageObjects/LoginPage.po';
+import { UsersPage } from '../PageObjects/UsersPage.po';
+import { TopNavigationPage } from '../PageObjects/TopNavigationPage.po';
+import { users } from "../Data/users";
+
+const loginPage = new LoginPage();
+const topNavigation = new TopNavigationPage();
+const usersPage = new UsersPage();
+
+users.tests.forEach(async usersData =>{
+    usersData.logins.forEach(login => {
+        describe('Traffic Portal - Users - ' + login.description, function(){
+            it('can login', async () => {
+                browser.get(browser.params.baseUrl);
+                await loginPage.Login(login);
+                expect(await loginPage.CheckUserName(login)).toBeTruthy();
+            });
+            it('can open users page', async () => {
+                await usersPage.OpenUserMenu()
+                await usersPage.OpenUserPage();
+            });
+            usersData.check.forEach(check => {
+                it(check.description, async () => {
+                    expect(await usersPage.CheckCSV(check.Name)).toBe(true);
+                    await usersPage.OpenUserPage();
+                });
+            });
+            usersData.toggle.forEach(toggle => {
+                it(toggle.description, async () => {
+                    if(toggle.description.includes('hide')){
+                        expect(await usersPage.CheckToggle(toggle.Name)).toBe(false);
+                        await usersPage.OpenUserPage();
+                    }else{
+                        expect(await usersPage.CheckToggle(toggle.Name)).toBe(true);
+                        await usersPage.OpenUserPage();
+                    }
+                });
+            })
+            usersData.add.forEach(add => {
+                it(add.description, async () => {
+                    expect(await usersPage.CreateUser(add)).toBeTruthy();
+                    await usersPage.OpenUserPage();
+                });
+            });
+            usersData.update.forEach(update => {
+                it(update.description, async () => {
+                    await usersPage.SearchUser(update.Username);
+                    expect(await usersPage.UpdateUser(update)).toBe(true);
+                    await usersPage.OpenUserPage();
+                });
+            });
+            usersData.register.forEach(register => {
+                it(register.description, async () => {
+                    expect(await usersPage.RegisterUser(register)).toBeTruthy();
+                    await usersPage.OpenUserPage();
+                });
+            });
+            usersData.updateRegisterUser.forEach(updateRegisterUser => {
+                it(updateRegisterUser.description, async () => {
+                    await usersPage.SearchEmailUser(updateRegisterUser.Email);
+                    expect(await usersPage.UpdateRegisterUser(updateRegisterUser)).toBe(true);
+                    await usersPage.OpenUserPage();
+                });
+            });
+            it('can logout', async () => {
+                expect(await topNavigation.Logout()).toBeTruthy();
+            });
+        });
+    });
+});

Review comment:
       Missing newline at EOF

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();
+        let name = nameEmail + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('email')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async UpdateUser(user: UpdateUser): Promise<boolean  | undefined> {
+        let basePage = new BasePage();
+        switch (user.description) {
+            case "update user's fullname":
+                await this.txtFullName.clear();
+                await this.txtFullName.sendKeys(user.NewFullName);
+                await basePage.ClickUpdate();
+                break;
+            default:
+                return undefined;
+        }
+        return await basePage.GetOutputMessage().then(value => user.validationMessage === value);
+    }
+
+    public async RegisterUser(user: RegisterUser): Promise<boolean> {
+        let result = false;
+        let basePage = new BasePage();
+        let snp = new SideNavigationPage();
+        await this.btnRegisterNewUser.click();
+        await this.txtEmail.sendKeys(user.Email + this.randomize);
+        await this.txtRole.sendKeys(user.Role);
+        await this.txtTenant.sendKeys(user.Tenant + this.randomize);
+        await basePage.ClickRegister();
+        if (await basePage.GetOutputMessage() === user.existsMessage) {
+            await snp.NavigateToUsersPage();
+            result = true;
+        } else if (await basePage.GetOutputMessage() === user.validationMessage) {
+            result = true;
+        } else {
+            result = false;
+        }
+        return result;
+    }
+
+    public async UpdateRegisterUser(user: UpdateRegisterUser): Promise<boolean | undefined> {
+        let basePage = new BasePage();
+        switch (user.description) {
+            case "update registered user's fullname":
+                await this.txtFullName.sendKeys(user.NewFullName);
+                await basePage.ClickUpdate();
+                break;
+            default:
+                return undefined;
+        }
+        return await basePage.GetOutputMessage().then(value => user.validationMessage === value);

Review comment:
       nit: you don't need to `await` a Promise you're returning.

##########
File path: traffic_portal/test/integration/PageObjects/BasePage.po.ts
##########
@@ -77,6 +78,14 @@ export class BasePage {
       return false;
     }
   }
+  async ClickRegister(){
+    if(await this.btnRegister.isEnabled() == true){

Review comment:
       `element(locator).isEnabled()` returns a `Promise<boolean>`, so you don't need to compare it to `true`; when the Promise resolves (which it will do immediately in the logical flow since it's being `await`ed) it will be literally one of `true` or `false`.
   
   Plus using `==` to compare - especially with boolean values - is hazard-prone. For example:
   ```javascript
   // outputs: true
   console.log(1 == true);
   ```

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();

Review comment:
       nit: `snp` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();
+        await snp.NavigateToUsersPage();
+    }
+
+    async OpenUserMenu() {
+        let snp = new SideNavigationPage();
+        await snp.ClickUserAdminMenu();
+    }
+
+    public async CheckCSV(name: string): Promise<boolean> {
+        return element(by.cssContainingText("span", name)).isPresent();
+    }
+
+    public async CheckToggle(name: string): Promise<boolean> {
+        let result = false;
+        await this.btnTableColumn.click();
+        //if the box is already checked, uncheck it and return false
+        if (await browser.isElementPresent(element(by.xpath("//th[text()='" + name + "']"))) === true) {
+            await element(by.xpath("//label[text()=' " + name + "']")).click();

Review comment:
       same as above RE: `by.xpath` vs `by.cssContainingText`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();
+        await snp.NavigateToUsersPage();

Review comment:
       this works fine as-is, but if it's more intuitive for you, you should knowyou can just directly return this Promise to run asynchronously and resolve the Promise returned by this method when it resolves. It'll work the same way, essentially, since this method is `async`, but might make more sense since I asked for a return type for the function to actually `return` something explicitly. (To be clear, it is returning something implicitly already).

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {

Review comment:
       Missing return type on call signature

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();
+        await snp.NavigateToUsersPage();
+    }
+
+    async OpenUserMenu() {
+        let snp = new SideNavigationPage();

Review comment:
       nit: `snp` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();

Review comment:
       nit: `snp` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {
+        let snp = new SideNavigationPage();
+        let name = nameEmail + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('email')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async UpdateUser(user: UpdateUser): Promise<boolean  | undefined> {
+        let basePage = new BasePage();
+        switch (user.description) {
+            case "update user's fullname":
+                await this.txtFullName.clear();
+                await this.txtFullName.sendKeys(user.NewFullName);
+                await basePage.ClickUpdate();
+                break;
+            default:
+                return undefined;
+        }
+        return await basePage.GetOutputMessage().then(value => user.validationMessage === value);
+    }
+
+    public async RegisterUser(user: RegisterUser): Promise<boolean> {
+        let result = false;
+        let basePage = new BasePage();

Review comment:
       nit: `basePage` is never reassigned, could be `const`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();
+        await snp.NavigateToUsersPage();
+    }
+
+    async OpenUserMenu() {
+        let snp = new SideNavigationPage();
+        await snp.ClickUserAdminMenu();
+    }
+
+    public async CheckCSV(name: string): Promise<boolean> {
+        return element(by.cssContainingText("span", name)).isPresent();
+    }
+
+    public async CheckToggle(name: string): Promise<boolean> {
+        let result = false;
+        await this.btnTableColumn.click();
+        //if the box is already checked, uncheck it and return false
+        if (await browser.isElementPresent(element(by.xpath("//th[text()='" + name + "']"))) === true) {
+            await element(by.xpath("//label[text()=' " + name + "']")).click();
+            result = false;
+        } else {
+            //if the box is unchecked, then check it and return true
+            await element(by.xpath("//label[text()=' " + name + "']")).click();

Review comment:
       same as above RE: `by.xpath` vs `by.cssContainingText`

##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -46,13 +68,39 @@ export class UsersPage extends BasePage {
     private txtPassword = element(by.name('uPass'));
     private txtConfirmPassword = element(by.name('confirmPassword'));
     private txtPublicSSHKey = element(by.name('publicSshKey'));
+    private txtSearch = element(by.id('usersTable_filter')).element(by.css('label input'));
+    private btnTableColumn = element(by.css('[title="Select Table Columns"]'));
     private randomize = randomize;
 
-    async OpenUserPage(){
-      let snp = new SideNavigationPage();
-      await snp.ClickUserAdminMenu();
-      await snp.NavigateToUsersPage();
-     }
+    async OpenUserPage() {
+        let snp = new SideNavigationPage();
+        await snp.NavigateToUsersPage();
+    }
+
+    async OpenUserMenu() {
+        let snp = new SideNavigationPage();
+        await snp.ClickUserAdminMenu();
+    }
+
+    public async CheckCSV(name: string): Promise<boolean> {
+        return element(by.cssContainingText("span", name)).isPresent();
+    }
+
+    public async CheckToggle(name: string): Promise<boolean> {
+        let result = false;
+        await this.btnTableColumn.click();
+        //if the box is already checked, uncheck it and return false
+        if (await browser.isElementPresent(element(by.xpath("//th[text()='" + name + "']"))) === true) {

Review comment:
       nit: instead of using an XPath here, you could just do like you did above with the CheckCSV span:
   
   ```typescript
   if (await element(by.cssContainingText("th", name)).isPresent()) {
       // ...
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635578483



##########
File path: traffic_portal/test/integration/PageObjects/UsersPage.po.ts
##########
@@ -61,22 +109,94 @@ export class UsersPage extends BasePage {
       await this.btnCreateNewUser.click();
       await this.txtFullName.sendKeys(user.FullName + this.randomize);
       await this.txtUserName.sendKeys(user.Username + this.randomize);
-      await this.txtEmail.sendKeys(user.FullName + this.randomize + user.Email);
+      await this.txtEmail.sendKeys(user.Email + this.randomize);
       await this.txtRole.sendKeys(user.Role);
       await this.txtTenant.sendKeys(user.Tenant+this.randomize);
       await this.txtPassword.sendKeys(user.Password);
       await this.txtConfirmPassword.sendKeys(user.ConfirmPassword);
       await this.txtPublicSSHKey.sendKeys(user.PublicSSHKey);
       await basePage.ClickCreate();
-      if(await basePage.GetOutputMessage() == user.existsMessage){
+      if(await basePage.GetOutputMessage() === user.existsMessage){
         await snp.NavigateToUsersPage();
         result = true;
-      }else if(await basePage.GetOutputMessage() == user.validationMessage){
+      }else if(await basePage.GetOutputMessage() === user.validationMessage){
         result = true;
       }else{
         result = false;
       }
       return result;
     }
 
+    public async SearchUser(nameUser: string) {
+        let snp = new SideNavigationPage();
+        let name = nameUser + this.randomize;
+        await snp.NavigateToUsersPage();
+        await this.txtSearch.clear();
+        await this.txtSearch.sendKeys(name);
+        await element.all(by.repeater('u in ::users')).filter(function (row) {
+            return row.element(by.name('username')).getText().then(function (val) {
+                return val === name;
+            });
+        }).first().click();
+    }
+
+    public async SearchEmailUser(nameEmail: string) {

Review comment:
       Same question as above




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870#discussion_r635612670



##########
File path: traffic_portal/test/integration/Data/users.ts
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {randomize} from "../config";
+
+export const users = {
+    tests: [
+        {
+            logins: [
+                {
+                    description: "Admin Role",
+                    username: "TPAdmin",
+                    password: "pa$$word"
+                }
+            ],
+            check: [
+                {
+                    description: "check CSV link from CDN page",
+                    Name: "Export as CSV"
+                }
+            ],
+            toggle: [
+                {
+                    description: "hide first table column",
+                    Name: "Email"
+                },
+                {
+                    description: "redisplay first table column",
+                    Name: "Email"
+                }
+            ],
+            add: [
+                {
+                    description: "create a new User",
+                    FullName: "TPCreateUser1",
+                    Username: "User1",
+                    Email: "test@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    Password: "qwe@123#rty",
+                    ConfirmPassword: "qwe@123#rty",
+                    PublicSSHKey: "",
+                    validationMessage: "User created"
+                },
+            ],
+            register: [
+                {
+                    description: "create a registered User",
+                    Email: "test2@cdn.tc.com",
+                    Role: "admin",
+                    Tenant: "- tenantSame",
+                    validationMessage: "Sent user registration to {{ test2@cdn.tc.com"+randomize+"}} with the following permissions [ role: admin | tenant: tenantSame"+randomize+" ]"

Review comment:
       What I mean is that
   ```typescript
   "part of a string "+something+" the rest of the string";
   ```
   is the same as
   ```typescript
   `part of a string ${something} the rest of the string`;
   ```
   and I just think the latter is generally easier to work with. But if you don't want to change it you don't have to, it's just something I like to point out in case people aren't aware (because, for example, you actually can't do that in Traffic Portal source code, so even being a TP expert isn't a guarantee that someone is familiar with template strings).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 merged pull request #5870: Migrate user tests from E2E to integration

Posted by GitBox <gi...@apache.org>.
ocket8888 merged pull request #5870:
URL: https://github.com/apache/trafficcontrol/pull/5870


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org