dandypham commented on a change in pull request #3748: Add initial origins and 
users TP tests
URL: https://github.com/apache/trafficcontrol/pull/3748#discussion_r318749684
 
 

 ##########
 File path: traffic_portal/test/end_to_end/users/users-spec.js
 ##########
 @@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+var pd = require('./pageData.js');
+var cfunc = require('../common/commonFunctions.js');
+
+describe('Traffic Portal Users Test Suite', () => {
+    const pageData = new pd();
+    const commonFunctions = new cfunc();
+    const newUser = function() {
+        return {
+            name: 'User Name',
+            username: 'username-' + 
commonFunctions.shuffle('abcdefghijklmonpqrstuvwxyz0123456789'),
+            email: 'user-' + 
commonFunctions.shuffle('abcdefghijklmonpqrstuvwxyz0123456789') + 
'@example.com',
+            password: 
commonFunctions.shuffle('abcdefghijklmonpqrstuvwxyz0123456789'),
+            role: 'admin (30)',
+            tenant: '- root'
+        };
+    };
+    const myNewUser = newUser();
+    const myOtherNewUser = newUser();
+    const repeater = 'u in ::users';
+
+    it('should register a new user', async () => {
+        console.log('Registering new user')
+        await browser.setLocation('users');
+        await pageData.registerUserButton.click();
+        await pageData.email.sendKeys(myNewUser.email);
+        await commonFunctions.selectDropdownByLabel(pageData.role, 
myNewUser.role); // note: this creates a new user with admin permissions
+        await commonFunctions.selectDropdownByLabel(pageData.tenant, 
myNewUser.tenant);
+        await pageData.sendRegistration.click();
+        expect(pageData.successMsg.isPresent()).toBe(true);
+        expect(pageData.userRegisteredText.isPresent()).toBe(true, 'Actual 
message does not match expected message');
 
 Review comment:
   ```suggestion
           //expect(pageData.userRegisteredText.isPresent()).toBe(true, 'Actual 
message does not match expected message');
   ```
   Comment this out because when register a new user, the message will display 
with a format like this "Sent user registration to u...@example.com with the 
following permissions [ role: admin | tenant: root ]" instead of "User was 
registered."
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to