You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2018/10/25 20:47:45 UTC

[trafficcontrol] branch master updated (60f530b -> a6cbb02)

This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.


    from 60f530b  Trim `wc -l` output for build number when running on Mac
     new 7f6358d  Automated UI Testing - CRUD for Servers, CDNs, Delivery Services
     new aea3df4  Automated UI Testing - added console outputs, fixed repeater error
     new 387a698  Automated UI Testing - Improved dropdown selection and added search box filtering
     new a6cbb02  Automated UI Testing - Added pauses to allow data to display properly

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../modules/dialog/delete/dialog.delete.tpl.html   |   2 +-
 .../modules/dialog/select/dialog.select.tpl.html   |   2 +-
 .../common/modules/table/cdns/table.cdns.tpl.html  |   4 +-
 .../table.deliveryServices.tpl.html                |   4 +-
 .../modules/table/servers/table.servers.tpl.html   |   4 +-
 traffic_portal/test/end_to_end/CDNs/cdns-spec.js   |  78 +++++++++++++++
 .../test/end_to_end/CDNs/pageData.js               |  36 +++----
 .../DeliveryServices/delivery-services-spec.js     | 106 +++++++++++++++++++++
 .../test/end_to_end/DeliveryServices/pageData.js   |  37 +++++++
 traffic_portal/test/end_to_end/README.md           |   5 +
 traffic_portal/test/end_to_end/Servers/pageData.js |  40 ++++++++
 .../test/end_to_end/Servers/servers-spec.js        |  98 +++++++++++++++++++
 .../end_to_end/common/commonFunctions.js}          |  21 ++--
 traffic_portal/test/end_to_end/conf.js             |  38 ++++++--
 traffic_portal/test/end_to_end/{ => login}/conf.js |   5 +-
 .../{login_spec.js => login/login-spec.js}         |  28 +++---
 16 files changed, 436 insertions(+), 72 deletions(-)
 create mode 100644 traffic_portal/test/end_to_end/CDNs/cdns-spec.js
 copy traffic_monitor/handler/handler.go => traffic_portal/test/end_to_end/CDNs/pageData.js (61%)
 create mode 100644 traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
 create mode 100644 traffic_portal/test/end_to_end/DeliveryServices/pageData.js
 create mode 100644 traffic_portal/test/end_to_end/Servers/pageData.js
 create mode 100644 traffic_portal/test/end_to_end/Servers/servers-spec.js
 copy traffic_portal/{app/src/common/filters/PercentFilter.js => test/end_to_end/common/commonFunctions.js} (71%)
 copy traffic_portal/test/end_to_end/{ => login}/conf.js (91%)
 rename traffic_portal/test/end_to_end/{login_spec.js => login/login-spec.js} (70%)


[trafficcontrol] 01/04: Automated UI Testing - CRUD for Servers, CDNs, Delivery Services

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 7f6358d6ad63af4c85eb153ecbfb4f89edddb391
Author: cgillo000 <ch...@cable.comcast.com>
AuthorDate: Tue Oct 16 13:01:25 2018 -0600

    Automated UI Testing - CRUD for Servers, CDNs, Delivery Services
---
 .../modules/dialog/delete/dialog.delete.tpl.html   |   2 +-
 .../modules/dialog/select/dialog.select.tpl.html   |   2 +-
 .../common/modules/table/cdns/table.cdns.tpl.html  |   4 +-
 .../table.deliveryServices.tpl.html                |   4 +-
 .../modules/table/servers/table.servers.tpl.html   |   4 +-
 traffic_portal/test/end_to_end/CDNs/cdns-spec.js   |  77 +++++++++++++++
 .../test/end_to_end/{conf.js => CDNs/pageData.js}  |  22 ++---
 .../DeliveryServices/delivery-services-spec.js     | 106 +++++++++++++++++++++
 .../{conf.js => DeliveryServices/pageData.js}      |  29 +++---
 traffic_portal/test/end_to_end/Servers/pageData.js |  39 ++++++++
 .../test/end_to_end/Servers/servers-spec.js        |  99 +++++++++++++++++++
 traffic_portal/test/end_to_end/conf.js             |  35 +++++--
 traffic_portal/test/end_to_end/{ => login}/conf.js |   5 +-
 .../{login_spec.js => login/login-spec.js}         |  27 +++---
 14 files changed, 396 insertions(+), 59 deletions(-)

diff --git a/traffic_portal/app/src/common/modules/dialog/delete/dialog.delete.tpl.html b/traffic_portal/app/src/common/modules/dialog/delete/dialog.delete.tpl.html
index 852d724..700ebe2 100644
--- a/traffic_portal/app/src/common/modules/dialog/delete/dialog.delete.tpl.html
+++ b/traffic_portal/app/src/common/modules/dialog/delete/dialog.delete.tpl.html
@@ -24,7 +24,7 @@ under the License.
 <div class="modal-body">
     <form name="deleteForm" novalidate>
         <p>This action CANNOT be undone. This will permanently delete '{{::params.key}}'. Please type in '{{::params.key}}' to confirm deletion.</p>
-        <input type="text" class="form-control" ng-model="confirmKey" match="params.key" required>
+        <input type="text" name="confirmWithNameInput" class="form-control" ng-model="confirmKey" match="params.key" required>
     </form>
 </div>
 <div class="modal-footer">
diff --git a/traffic_portal/app/src/common/modules/dialog/select/dialog.select.tpl.html b/traffic_portal/app/src/common/modules/dialog/select/dialog.select.tpl.html
index ae3a098..3ed9f7d 100644
--- a/traffic_portal/app/src/common/modules/dialog/select/dialog.select.tpl.html
+++ b/traffic_portal/app/src/common/modules/dialog/select/dialog.select.tpl.html
@@ -24,7 +24,7 @@ under the License.
 <div class="modal-body">
     <p ng-bind-html="params.message"></p>
     <form name="selectForm" novalidate>
-        <select class="form-control" ng-model="selectedItemId" ng-options="item.id as label(item) for item in collection" required>
+        <select class="form-control" name="selectFormDropdown" ng-model="selectedItemId" ng-options="item.id as label(item) for item in collection" required>
             <option value="">Select...</option>
         </select>
     </form>
diff --git a/traffic_portal/app/src/common/modules/table/cdns/table.cdns.tpl.html b/traffic_portal/app/src/common/modules/table/cdns/table.cdns.tpl.html
index a3050f0..0189e0f 100644
--- a/traffic_portal/app/src/common/modules/table/cdns/table.cdns.tpl.html
+++ b/traffic_portal/app/src/common/modules/table/cdns/table.cdns.tpl.html
@@ -23,7 +23,7 @@ under the License.
             <li class="active">CDNs</li>
         </ol>
         <div class="pull-right">
-            <button class="btn btn-primary" title="Create CDN" ng-click="createCDN()"><i class="fa fa-plus"></i></button>
+            <button name="createCdnButton" class="btn btn-primary" title="Create CDN" ng-click="createCDN()"><i class="fa fa-plus"></i></button>
             <button class="btn btn-default" title="Refresh" ng-click="refresh()"><i class="fa fa-refresh"></i></button>
         </div>
         <div class="clearfix"></div>
@@ -40,7 +40,7 @@ under the License.
             </thead>
             <tbody>
                 <tr ng-click="editCDN(cdn.id)" ng-repeat="cdn in ::cdns">
-                    <td data-search="^{{::cdn.name}}$">{{::cdn.name}}</td>
+                    <td name="name" data-search="^{{::cdn.name}}$">{{::cdn.name}}</td>
                     <td data-search="^{{::cdn.domainName}}$">{{::cdn.domainName}}</td>
                     <td data-search="^{{::cdn.dnssecEnabled}}$">{{::cdn.dnssecEnabled}}</td>
                 </tr>
diff --git a/traffic_portal/app/src/common/modules/table/deliveryServices/table.deliveryServices.tpl.html b/traffic_portal/app/src/common/modules/table/deliveryServices/table.deliveryServices.tpl.html
index af43709..747a5d9 100644
--- a/traffic_portal/app/src/common/modules/table/deliveryServices/table.deliveryServices.tpl.html
+++ b/traffic_portal/app/src/common/modules/table/deliveryServices/table.deliveryServices.tpl.html
@@ -23,7 +23,7 @@ under the License.
             <li class="active">Delivery Services</li>
         </ol>
         <div class="pull-right" role="group">
-            <button class="btn btn-primary" title="Create Delivery Service" ng-click="selectDSType()"><i class="fa fa-plus"></i></button>
+            <button class="btn btn-primary" name="createDeliveryServiceButton" title="Create Delivery Service" ng-click="selectDSType()"><i class="fa fa-plus"></i></button>
             <button class="btn btn-default" title="Refresh" ng-click="refresh()"><i class="fa fa-refresh"></i></button>
             <div class="btn-group" role="group" uib-dropdown is-open="more.isopen">
                 <button type="button" class="btn btn-default dropdown-toggle" uib-dropdown-toggle aria-haspopup="true" aria-expanded="false">
@@ -59,7 +59,7 @@ under the License.
             </thead>
             <tbody>
                 <tr ng-click="editDeliveryService(ds)" ng-repeat="ds in ::deliveryServices">
-                    <td data-search="^{{::ds.xmlId}}$">{{::ds.xmlId}}</td>
+                    <td name="xmlId" data-search="^{{::ds.xmlId}}$">{{::ds.xmlId}}</td>
                     <td data-search="^{{::ds.tenant}}$">{{::ds.tenant}}</td>
                     <td data-search="^{{::ds.orgServerFqdn}}$">{{::ds.orgServerFqdn}}</td>
                     <td data-search="^{{::ds.active}}$">{{::ds.active}}</td>
diff --git a/traffic_portal/app/src/common/modules/table/servers/table.servers.tpl.html b/traffic_portal/app/src/common/modules/table/servers/table.servers.tpl.html
index 0e27f6e..fe21082 100644
--- a/traffic_portal/app/src/common/modules/table/servers/table.servers.tpl.html
+++ b/traffic_portal/app/src/common/modules/table/servers/table.servers.tpl.html
@@ -23,7 +23,7 @@ under the License.
             <li class="active">Servers</li>
         </ol>
         <div class="pull-right">
-            <button class="btn btn-primary" title="Create Server" ng-click="createServer()"><i class="fa fa-plus"></i></button>
+            <button class="btn btn-primary" name="createServersButton" title="Create Server" ng-click="createServer()"><i class="fa fa-plus"></i></button>
             <button class="btn btn-default" title="Refresh" ng-click="refresh()"><i class="fa fa-refresh"></i></button>
             <div class="btn-group" role="group" uib-dropdown is-open="more.isopen">
                 <button type="button" class="btn btn-default dropdown-toggle" uib-dropdown-toggle aria-haspopup="true" aria-expanded="false">
@@ -63,7 +63,7 @@ under the License.
                     <i title="Updates Pending" ng-show="s.updPending" class="fa fa-clock-o fa-lg" aria-hidden="true"></i>
                     <i title="Updates Applied" ng-show="!s.updPending" class="fa fa-check fa-lg" aria-hidden="true"></i>
                 </td>
-                <td data-search="^{{::s.hostName}}$">{{::s.hostName}}</td>
+                <td name="hostName" data-search="^{{::s.hostName}}$">{{::s.hostName}}</td>
                 <td data-search="^{{::s.domainName}}$">{{::s.domainName}}</td>
                 <td data-search="^{{::s.ipAddress}}$"><a ng-click="ssh(s.ipAddress, $event)">{{::s.ipAddress}}</a></td>
                 <td data-search="^{{::s.ip6Address}}$">{{::s.ip6Address}}</td>
diff --git a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
new file mode 100644
index 0000000..cf58ed7
--- /dev/null
+++ b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
@@ -0,0 +1,77 @@
+/*
+ * 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');
+
+describe('Traffic Portal CDNs Test Suite', function() {
+
+	var pageData = new pd();
+	var myNewCDN = 'pTestCDN';
+	var myDomainName = 'ptest.com';
+	var mydnssec = 'true';
+
+	it('should go to the CDNs page', function() {
+		console.log("should go to the CDNs page");
+		browser.get(browser.baseUrl + "/#!/cdns");
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/cdns");
+	});
+
+    it('should open new CDN form page', function() {
+	    console.log("should open new CDN form page");
+	    browser.driver.findElement(by.name('createCdnButton')).click();
+	    expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/cdns/new");
+    });
+
+	it('should fill out form, create button is enabled and submit', function () {
+		console.log("should fill out form, create button is enabled and submit");
+		expect(pageData.createButton.isEnabled()).toBe(false);
+		pageData.name.sendKeys(myNewCDN);
+		pageData.domainName.sendKeys(myDomainName);
+		pageData.dnssecEnabled.click();
+		pageData.dnssecEnabled.sendKeys(mydnssec);
+		expect(pageData.createButton.isEnabled()).toBe(true);
+		pageData.createButton.click();
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/cdns");
+	});
+
+	it('should verify the new CDN and then update CDN', function() {
+		console.log("should verify the new CDN and then update CDN");
+		browser.sleep(1000);
+		element.all(by.repeater('cdn in ::cdns')).filter(function(row){
+			return row.element(by.name('name')).getText().then(function(val){
+				console.log(val + " vs " + myNewCDN);
+				return val === myNewCDN;
+			});
+		}).get(0).click();
+		browser.sleep(1000);
+		pageData.domainName.clear();
+		pageData.domainName.sendKeys('ptestUpdated.com');
+		pageData.dnssecEnabled.click();
+		pageData.dnssecEnabled.sendKeys('false');
+		pageData.updateButton.click();
+		expect(pageData.domainName.getText() === 'ptestUpdated.com');
+	});
+
+	it('should delete the new CDN', function() {
+		console.log("should delete the new CDN");
+		pageData.deleteButton.click();
+		pageData.confirmWithNameInput.sendKeys(myNewCDN);
+		pageData.deletePermanentlyButton.click();
+	});
+});
diff --git a/traffic_portal/test/end_to_end/conf.js b/traffic_portal/test/end_to_end/CDNs/pageData.js
similarity index 62%
copy from traffic_portal/test/end_to_end/conf.js
copy to traffic_portal/test/end_to_end/CDNs/pageData.js
index 99bb0c9..adea56b 100644
--- a/traffic_portal/test/end_to_end/conf.js
+++ b/traffic_portal/test/end_to_end/CDNs/pageData.js
@@ -17,15 +17,13 @@
  * under the License.
  */
 
-exports.config = {
-    framework: 'jasmine',
-    seleniumAddress: 'http://localhost:4444/wd/hub',
-    specs: ['login_spec.js'],
-    baseUrl: 'https://localhost:8443',
-
-    params: {
-        adminUser: 'admin',
-        adminPassword: 'password'
-   }
-}
-
+module.exports = function(){
+	this.name=element(by.name('name'));
+	this.domainName=element(by.name('domainName'));
+	this.dnssecEnabled=element(by.name('dnssecEnabled'));
+	this.createButton=element(by.buttonText('Create'));
+	this.deleteButton=element(by.buttonText('Delete'));
+	this.updateButton=element(by.buttonText('Update'));
+	this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
+	this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
+};
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js b/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
new file mode 100644
index 0000000..fee9865
--- /dev/null
+++ b/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
@@ -0,0 +1,106 @@
+/*
+ * 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');
+
+describe('Traffic Portal Delivery Services Suite', function() {
+
+	var pageData = new pd();
+	var mockVals = {
+		dsType: ["ANY MAP", "DNS", "HTTP", "STEERING"],
+		active: "true",
+		type: "DNS",
+		xmlId: 4343432432424,
+		displayName: "dsTest",
+		tenantId: "- root",
+		cdn: "CDN-in-a-Box",
+		orgServerFqdn: "http://dstest.com",
+		protocol: "0 - HTTP",
+		longDesc: "This is only a test that should be disposed of by Automated UI Testing."
+	};
+
+	it('should open ds page and click button to create a new one', function() {
+		browser.get(browser.baseUrl + "/#!/delivery-services");
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-services");
+	});
+
+	it('should create and select type of ds from the dropdown and confirm', function() {
+		browser.driver.findElement(by.name('createDeliveryServiceButton')).click();
+		browser.sleep(1000);
+		expect(pageData.selectFormSubmitButton.isEnabled()).toBe(false);
+		browser.driver.findElement(by.name('selectFormDropdown')).sendKeys(mockVals.dsType[1]);
+		browser.sleep(250);
+		expect(pageData.selectFormSubmitButton.isEnabled()).toBe(true);
+		pageData.selectFormSubmitButton.click();
+	});
+
+	it('should populate and submit the ds form', function() {
+		browser.sleep(250);
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-services/new?type=" + mockVals.dsType[1]);
+		expect(pageData.createButton.isEnabled()).toBe(false);
+		pageData.active.click();
+		pageData.active.sendKeys(mockVals.active);
+		pageData.type.click();
+		pageData.type.sendKeys(mockVals.type);
+		pageData.xmlId.sendKeys(mockVals.xmlId);
+		pageData.displayName.sendKeys(mockVals.displayName);
+		pageData.tenantId.click();
+		pageData.tenantId.sendKeys(mockVals.tenantId);
+		pageData.cdn.click();
+		pageData.cdn.sendKeys(mockVals.cdn);
+		pageData.orgServerFqdn.sendKeys(mockVals.orgServerFqdn);
+		pageData.protocol.click();
+		pageData.protocol.sendKeys(mockVals.protocol);
+		pageData.longDesc.sendKeys(mockVals.longDesc);
+		expect(pageData.createButton.isEnabled()).toBe(true);
+		pageData.createButton.click();
+		browser.sleep(250);
+	});
+
+	it('should back out to ds page and verify new ds and update it', function() {
+		browser.get(browser.baseUrl + "/#!/delivery-services");
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-services");
+		browser.sleep(250);
+		element(by.repeater('ds in ::deliveryServices').row(0)).click();
+		// Need to get the below code to function. Currently throwing an index out of bounds error
+		// And then remove the single line click above
+		//
+		// element.all(by.repeater('ds in ::deliveryServices')).filter(function(row){
+		// 	return row.element(by.name('xmlId')).getText().then(function(val){
+		// 		console.log(val + " this is my val " + row);
+		// 		return val === mockVals.xmlId;
+		// 	});
+		// })
+		// 	.get(0).click();
+		browser.sleep(250);
+		expect(pageData.updateButton.isEnabled()).toBe(false);
+		pageData.displayName.sendKeys(mockVals.displayName + "updated");
+		expect(pageData.updateButton.isEnabled()).toBe(true);
+		pageData.updateButton.click();
+		browser.sleep(250);
+		expect(pageData.displayName.getText() === mockVals.displayName + "updated");
+	});
+
+	it('should delete the ds', function() {
+		pageData.deleteButton.click();
+		pageData.confirmWithNameInput.sendKeys(mockVals.xmlId);
+		pageData.deletePermanentlyButton.click();
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-services");
+	});
+});
diff --git a/traffic_portal/test/end_to_end/conf.js b/traffic_portal/test/end_to_end/DeliveryServices/pageData.js
similarity index 50%
copy from traffic_portal/test/end_to_end/conf.js
copy to traffic_portal/test/end_to_end/DeliveryServices/pageData.js
index 99bb0c9..63aefd4 100644
--- a/traffic_portal/test/end_to_end/conf.js
+++ b/traffic_portal/test/end_to_end/DeliveryServices/pageData.js
@@ -17,15 +17,20 @@
  * under the License.
  */
 
-exports.config = {
-    framework: 'jasmine',
-    seleniumAddress: 'http://localhost:4444/wd/hub',
-    specs: ['login_spec.js'],
-    baseUrl: 'https://localhost:8443',
-
-    params: {
-        adminUser: 'admin',
-        adminPassword: 'password'
-   }
-}
-
+module.exports = function(){
+	this.selectFormSubmitButton=element(by.buttonText('Submit'));
+	this.active=element(by.name('active'));
+	this.type=element(by.name('type'));
+	this.xmlId=element(by.name('xmlId'));
+	this.displayName=element(by.name('displayName'));
+	this.tenantId=element(by.name('tenantId'));
+	this.cdn=element(by.name('cdn'));
+	this.orgServerFqdn=element(by.name('orgServerFqdn'));
+	this.protocol=element(by.name('protocol'));
+	this.longDesc=element(by.name('longDesc'));
+	this.createButton=element(by.buttonText('Create'));
+	this.deleteButton=element(by.buttonText('Delete'));
+	this.updateButton=element(by.buttonText('Update'));
+	this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
+	this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
+};
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/Servers/pageData.js b/traffic_portal/test/end_to_end/Servers/pageData.js
new file mode 100644
index 0000000..bca1764
--- /dev/null
+++ b/traffic_portal/test/end_to_end/Servers/pageData.js
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+module.exports = function(){
+	this.status=element(by.name('status'));
+	this.hostName=element(by.name('hostName'));
+	this.domainName=element(by.name('domainName'));
+	this.cdn=element(by.name('cdn'));
+	this.cachegroup=element(by.name('cachegroup'));
+	this.type=element(by.name('type'));
+	this.profile=element(by.name('profile'));
+	this.interfaceName=element(by.name('interfaceName'));
+	this.ipAddress=element(by.name('ipAddress'));
+	this.ipNetmask=element(by.name('ipNetmask'));
+	this.ipGateway=element(by.name('ipGateway'));
+	this.interfaceMtu=element(by.name('interfaceMtu'));
+	this.physLocation=element(by.name('physLocation'));
+	this.createButton=element(by.buttonText('Create'));
+	this.deleteButton=element(by.buttonText('Delete'));
+	this.updateButton=element(by.buttonText('Update'));
+	this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
+	this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
+};
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/Servers/servers-spec.js b/traffic_portal/test/end_to_end/Servers/servers-spec.js
new file mode 100644
index 0000000..045cd48
--- /dev/null
+++ b/traffic_portal/test/end_to_end/Servers/servers-spec.js
@@ -0,0 +1,99 @@
+/*
+ * 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');
+
+describe('Traffic Portal Servers Test Suite', function() {
+
+	var pageData = new pd();
+	var mockVals = {
+		status: "OFFLINE",
+		hostName: "testHost",
+		domainName: "servertest.com",
+		cdn: "CDN-in-a-Box",
+		cachegroup: "CDN_in_a_Box_Edge",
+		type: "EDGE",
+		profile: "ATS_EDGE_TIER_CACHE",
+		interfaceName: "testInterfaceName",
+		ipAddress: "10.42.80.118",
+		ipNetmask: "255.255.255.252",
+		ipGateway: "10.42.80.117",
+		interfaceMtu: "9000",
+		physLocation: "CDN-in-a-Box",
+	};
+
+	it('should go to the Servers page', function() {
+		browser.get(browser.baseUrl + "/#!/servers");
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/servers");
+	});
+
+    it('should open new Servers form page', function() {
+	    browser.driver.findElement(by.name('createServersButton')).click();
+	    expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/servers/new");
+    });
+
+	it('should fill out form, create button is enabled and submit', function () {
+		expect(pageData.createButton.isEnabled()).toBe(false);
+		pageData.status.click();
+		pageData.status.sendKeys(mockVals.status);
+		pageData.hostName.sendKeys(mockVals.hostName);
+		pageData.domainName.sendKeys(mockVals.domainName);
+		pageData.cdn.click();
+		pageData.cdn.sendKeys(mockVals.cdn);
+		pageData.cachegroup.click();
+		pageData.cachegroup.sendKeys(mockVals.cachegroup);
+		pageData.type.click();
+		pageData.type.sendKeys(mockVals.type);
+		pageData.profile.click();
+		pageData.profile.sendKeys(mockVals.profile);
+		pageData.interfaceName.sendKeys(mockVals.interfaceName);
+		pageData.ipAddress.sendKeys(mockVals.ipAddress);
+		pageData.ipNetmask.sendKeys(mockVals.ipNetmask);
+		pageData.ipGateway.sendKeys(mockVals.ipGateway);
+		pageData.interfaceMtu.sendKeys(mockVals.interfaceMtu);
+		pageData.physLocation.click();
+		pageData.physLocation.sendKeys(mockVals.physLocation);
+		expect(pageData.createButton.isEnabled()).toBe(true);
+		pageData.createButton.click();
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/servers");
+	});
+
+	it('should verify the new Server and then update Server', function() {
+		browser.sleep(1000);
+		element.all(by.repeater('s in ::servers')).filter(function(row){
+			return row.element(by.name('hostName')).getText().then(function(val){
+				return val === mockVals.hostName;
+			});
+		}).get(0).click();
+		browser.sleep(1000);
+		pageData.domainName.clear();
+		pageData.domainName.sendKeys('testupdated.com');
+		pageData.type.click();
+		pageData.type.sendKeys('MID');
+		pageData.updateButton.click();
+		expect(pageData.domainName.getText() === 'testupdated.com');
+		expect(pageData.type.getText() === 'MID');
+	});
+
+	it('should delete the new Server', function() {
+		pageData.deleteButton.click();
+		pageData.confirmWithNameInput.sendKeys(mockVals.hostName);
+		pageData.deletePermanentlyButton.click();
+	});
+});
diff --git a/traffic_portal/test/end_to_end/conf.js b/traffic_portal/test/end_to_end/conf.js
index 99bb0c9..2dd733b 100644
--- a/traffic_portal/test/end_to_end/conf.js
+++ b/traffic_portal/test/end_to_end/conf.js
@@ -18,14 +18,29 @@
  */
 
 exports.config = {
-    framework: 'jasmine',
-    seleniumAddress: 'http://localhost:4444/wd/hub',
-    specs: ['login_spec.js'],
-    baseUrl: 'https://localhost:8443',
-
-    params: {
-        adminUser: 'admin',
-        adminPassword: 'password'
-   }
-}
+	framework: 'jasmine',
+	seleniumAddress: 'http://localhost:4444/wd/hub',
+	baseUrl: 'https://localhost:4443',
+	getPageTimeout: 30000,
+	specs: [
+		'login/login-spec.js',
+		'CDNs/cdns-spec.js',
+		'DeliveryServices/delivery-services-spec.js',
+		'Servers/servers-spec.js',
+	],
+	capabilities: {
+		'browserName': 'chrome'
+	},
+	params: {
+		adminUser: 'admin',
+		adminPassword: 'twelve'
+	},
+	jasmineNodeOpts: {defaultTimeoutInterval: 600000},
 
+	suites: {
+		loginTests: 'login/login-spec.js',
+		cdnTests: ['login/login-spec.js','CDNs/cdns=spec.js'],
+		deliveryServiceTests: ['login/login-spec.js', 'DeliveryServices/delivery-services-spec.js'],
+		serverTests: ['login/login-spec.js', 'Servers/servers-spec.js'],
+	}
+};
diff --git a/traffic_portal/test/end_to_end/conf.js b/traffic_portal/test/end_to_end/login/conf.js
similarity index 91%
copy from traffic_portal/test/end_to_end/conf.js
copy to traffic_portal/test/end_to_end/login/conf.js
index 99bb0c9..ac3c7dc 100644
--- a/traffic_portal/test/end_to_end/conf.js
+++ b/traffic_portal/test/end_to_end/login/conf.js
@@ -21,11 +21,12 @@ exports.config = {
     framework: 'jasmine',
     seleniumAddress: 'http://localhost:4444/wd/hub',
     specs: ['login_spec.js'],
-    baseUrl: 'https://localhost:8443',
+    baseUrl: 'https://localhost:4443',
+	getPageTimeout: 30000,
 
     params: {
         adminUser: 'admin',
-        adminPassword: 'password'
+        adminPassword: 'twelve'
    }
 }
 
diff --git a/traffic_portal/test/end_to_end/login_spec.js b/traffic_portal/test/end_to_end/login/login-spec.js
similarity index 72%
rename from traffic_portal/test/end_to_end/login_spec.js
rename to traffic_portal/test/end_to_end/login/login-spec.js
index 7d8d00d..a918aca 100644
--- a/traffic_portal/test/end_to_end/login_spec.js
+++ b/traffic_portal/test/end_to_end/login/login-spec.js
@@ -21,29 +21,26 @@ describe('Traffic Portal Login Test Suite', function() {
 
     beforeEach(function() {
         browser.get(browser.baseUrl);
-    });
-
-    it('should successfully login to Traffic Portal', function() {
-
-        browser.driver.findElement(by.name('loginUsername')).sendKeys(browser.params.adminUser);
-        browser.driver.findElement(by.name('loginPass')).sendKeys(browser.params.adminPassword);
-        browser.driver.findElement(by.name('loginSubmit')).click();
-        browser.debugger();
-
-        expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/dashboard");
-
+	    browser.driver.manage().window().maximize();
+	    browser.wait(function() {
+		    return element(by.name('loginUsername')).isPresent();
+	    }, 5000);
     });
 
     it('should fail login to Traffic Portal with bad user', function() {
-
         browser.driver.findElement(by.name('loginUsername')).sendKeys('badUser');
         browser.driver.findElement(by.name('loginPass')).sendKeys('badPassword');
         browser.driver.findElement(by.name('loginSubmit')).click();
         browser.sleep(250);
         browser.debugger();
-
         expect(browser.driver.findElement(by.css('div.ng-binding')).getText()).toEqual('Invalid username or password.');
-
-
     });
+
+	it('should successfully login to Traffic Portal', function() {
+		browser.driver.findElement(by.name('loginUsername')).sendKeys(browser.params.adminUser);
+		browser.driver.findElement(by.name('loginPass')).sendKeys(browser.params.adminPassword);
+		browser.driver.findElement(by.name('loginSubmit')).click();
+		browser.debugger();
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/");
+	});
 });


[trafficcontrol] 02/04: Automated UI Testing - added console outputs, fixed repeater error

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit aea3df4c01a66fbc11bd05d7cebd6b727255fe23
Author: cgillo000 <ch...@cable.comcast.com>
AuthorDate: Mon Oct 22 13:18:12 2018 -0600

    Automated UI Testing - added console outputs, fixed repeater error
---
 traffic_portal/test/end_to_end/CDNs/cdns-spec.js   | 14 +++++------
 .../DeliveryServices/delivery-services-spec.js     | 29 +++++++++++++---------
 traffic_portal/test/end_to_end/README.md           |  5 ++++
 .../test/end_to_end/Servers/servers-spec.js        |  9 +++++--
 traffic_portal/test/end_to_end/conf.js             | 28 ++++++++++++++-------
 traffic_portal/test/end_to_end/login/login-spec.js |  5 ++--
 6 files changed, 58 insertions(+), 32 deletions(-)

diff --git a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
index cf58ed7..f300603 100644
--- a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
+++ b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
@@ -27,19 +27,19 @@ describe('Traffic Portal CDNs Test Suite', function() {
 	var mydnssec = 'true';
 
 	it('should go to the CDNs page', function() {
-		console.log("should go to the CDNs page");
+		console.log("Go to the CDNs page");
 		browser.get(browser.baseUrl + "/#!/cdns");
 		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/cdns");
 	});
 
     it('should open new CDN form page', function() {
-	    console.log("should open new CDN form page");
-	    browser.driver.findElement(by.name('createCdnButton')).click();
-	    expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/cdns/new");
+    	console.log("Open new CDN form page");
+		browser.driver.findElement(by.name('createCdnButton')).click();
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/cdns/new");
     });
 
 	it('should fill out form, create button is enabled and submit', function () {
-		console.log("should fill out form, create button is enabled and submit");
+		console.log("Filling out form, check create button is enabled and submit");
 		expect(pageData.createButton.isEnabled()).toBe(false);
 		pageData.name.sendKeys(myNewCDN);
 		pageData.domainName.sendKeys(myDomainName);
@@ -51,7 +51,7 @@ describe('Traffic Portal CDNs Test Suite', function() {
 	});
 
 	it('should verify the new CDN and then update CDN', function() {
-		console.log("should verify the new CDN and then update CDN");
+		console.log("verifying the new CDN and then updating CDN");
 		browser.sleep(1000);
 		element.all(by.repeater('cdn in ::cdns')).filter(function(row){
 			return row.element(by.name('name')).getText().then(function(val){
@@ -69,7 +69,7 @@ describe('Traffic Portal CDNs Test Suite', function() {
 	});
 
 	it('should delete the new CDN', function() {
-		console.log("should delete the new CDN");
+		console.log("Deleting " + myNewCDN);
 		pageData.deleteButton.click();
 		pageData.confirmWithNameInput.sendKeys(myNewCDN);
 		pageData.deletePermanentlyButton.click();
diff --git a/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js b/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
index fee9865..8f13ea6 100644
--- a/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
+++ b/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
@@ -26,7 +26,7 @@ describe('Traffic Portal Delivery Services Suite', function() {
 		dsType: ["ANY MAP", "DNS", "HTTP", "STEERING"],
 		active: "true",
 		type: "DNS",
-		xmlId: 4343432432424,
+		xmlId: "thisIsOnlyATest",
 		displayName: "dsTest",
 		tenantId: "- root",
 		cdn: "CDN-in-a-Box",
@@ -36,11 +36,13 @@ describe('Traffic Portal Delivery Services Suite', function() {
 	};
 
 	it('should open ds page and click button to create a new one', function() {
+		console.log('Opening delivery services page');
 		browser.get(browser.baseUrl + "/#!/delivery-services");
 		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-services");
 	});
 
 	it('should create and select type of ds from the dropdown and confirm', function() {
+		console.log('Clicked Create New and selecting a type');
 		browser.driver.findElement(by.name('createDeliveryServiceButton')).click();
 		browser.sleep(1000);
 		expect(pageData.selectFormSubmitButton.isEnabled()).toBe(false);
@@ -51,6 +53,7 @@ describe('Traffic Portal Delivery Services Suite', function() {
 	});
 
 	it('should populate and submit the ds form', function() {
+		console.log('Filling out form for ' + mockVals.xmlId);
 		browser.sleep(250);
 		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-services/new?type=" + mockVals.dsType[1]);
 		expect(pageData.createButton.isEnabled()).toBe(false);
@@ -74,20 +77,21 @@ describe('Traffic Portal Delivery Services Suite', function() {
 	});
 
 	it('should back out to ds page and verify new ds and update it', function() {
+		console.log('Backing out and verifying ' + mockVals.xmlId + ' exists');
 		browser.get(browser.baseUrl + "/#!/delivery-services");
 		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-services");
+
+	});
+
+	it('should update the ds', function() {
+		console.log('Updating the form for ' + mockVals.xmlId);
 		browser.sleep(250);
-		element(by.repeater('ds in ::deliveryServices').row(0)).click();
-		// Need to get the below code to function. Currently throwing an index out of bounds error
-		// And then remove the single line click above
-		//
-		// element.all(by.repeater('ds in ::deliveryServices')).filter(function(row){
-		// 	return row.element(by.name('xmlId')).getText().then(function(val){
-		// 		console.log(val + " this is my val " + row);
-		// 		return val === mockVals.xmlId;
-		// 	});
-		// })
-		// 	.get(0).click();
+		element.all(by.repeater('ds in ::deliveryServices')).filter(function(row){
+			return row.element(by.name('xmlId')).getText().then(function(val){
+				console.log(val + " this is my val " + mockVals.xmlId);
+				return val.toString() === mockVals.xmlId.toString();
+			});
+		}).get(0).click();
 		browser.sleep(250);
 		expect(pageData.updateButton.isEnabled()).toBe(false);
 		pageData.displayName.sendKeys(mockVals.displayName + "updated");
@@ -98,6 +102,7 @@ describe('Traffic Portal Delivery Services Suite', function() {
 	});
 
 	it('should delete the ds', function() {
+		console.log('Deleting ' + mockVals.xmlId);
 		pageData.deleteButton.click();
 		pageData.confirmWithNameInput.sendKeys(mockVals.xmlId);
 		pageData.deletePermanentlyButton.click();
diff --git a/traffic_portal/test/end_to_end/README.md b/traffic_portal/test/end_to_end/README.md
index b673a56..a0ca376 100644
--- a/traffic_portal/test/end_to_end/README.md
+++ b/traffic_portal/test/end_to_end/README.md
@@ -32,3 +32,8 @@
 - Run your tests
   protractor conf.js --params.adminUser 'user' --params.adminPassword 'password'
 
+- NOTE: Errors with webdriver
+  Most errors with webdriver can be remedied by running the following:
+  webdriver-manager clean
+  webdriver-manager update
+
diff --git a/traffic_portal/test/end_to_end/Servers/servers-spec.js b/traffic_portal/test/end_to_end/Servers/servers-spec.js
index 045cd48..a469502 100644
--- a/traffic_portal/test/end_to_end/Servers/servers-spec.js
+++ b/traffic_portal/test/end_to_end/Servers/servers-spec.js
@@ -39,16 +39,19 @@ describe('Traffic Portal Servers Test Suite', function() {
 	};
 
 	it('should go to the Servers page', function() {
+		console.log('Looading Configure/Servers');
 		browser.get(browser.baseUrl + "/#!/servers");
 		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/servers");
 	});
 
     it('should open new Servers form page', function() {
-	    browser.driver.findElement(by.name('createServersButton')).click();
-	    expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/servers/new");
+		console.log('Clicking on Create new server ' + mockVals.hostName);
+		browser.driver.findElement(by.name('createServersButton')).click();
+		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/servers/new");
     });
 
 	it('should fill out form, create button is enabled and submit', function () {
+		console.log('Filling out Server form');
 		expect(pageData.createButton.isEnabled()).toBe(false);
 		pageData.status.click();
 		pageData.status.sendKeys(mockVals.status);
@@ -75,6 +78,7 @@ describe('Traffic Portal Servers Test Suite', function() {
 	});
 
 	it('should verify the new Server and then update Server', function() {
+		console.log('Verifying new server added and updating ' + mockVals.hostName);
 		browser.sleep(1000);
 		element.all(by.repeater('s in ::servers')).filter(function(row){
 			return row.element(by.name('hostName')).getText().then(function(val){
@@ -92,6 +96,7 @@ describe('Traffic Portal Servers Test Suite', function() {
 	});
 
 	it('should delete the new Server', function() {
+		console.log('Deleting the server ' + mockVals.hostName);
 		pageData.deleteButton.click();
 		pageData.confirmWithNameInput.sendKeys(mockVals.hostName);
 		pageData.deletePermanentlyButton.click();
diff --git a/traffic_portal/test/end_to_end/conf.js b/traffic_portal/test/end_to_end/conf.js
index 2dd733b..a834eca 100644
--- a/traffic_portal/test/end_to_end/conf.js
+++ b/traffic_portal/test/end_to_end/conf.js
@@ -22,12 +22,12 @@ exports.config = {
 	seleniumAddress: 'http://localhost:4444/wd/hub',
 	baseUrl: 'https://localhost:4443',
 	getPageTimeout: 30000,
-	specs: [
-		'login/login-spec.js',
-		'CDNs/cdns-spec.js',
-		'DeliveryServices/delivery-services-spec.js',
-		'Servers/servers-spec.js',
-	],
+	// specs: [
+	// 	'login/login-spec.js',
+	// 	'CDNs/cdns-spec.js',
+	// 	'DeliveryServices/delivery-services-spec.js',
+	// 	'Servers/servers-spec.js',
+	// ],
 	capabilities: {
 		'browserName': 'chrome'
 	},
@@ -39,8 +39,18 @@ exports.config = {
 
 	suites: {
 		loginTests: 'login/login-spec.js',
-		cdnTests: ['login/login-spec.js','CDNs/cdns=spec.js'],
-		deliveryServiceTests: ['login/login-spec.js', 'DeliveryServices/delivery-services-spec.js'],
-		serverTests: ['login/login-spec.js', 'Servers/servers-spec.js'],
+		allTests: [
+			'login/login-spec.js',
+			'CDNs/cdns-spec.js',
+			'DeliveryServices/delivery-services-spec.js',
+			'Servers/servers-spec.js'],
+		cdnTests: ['login/login-spec.js',
+			'CDNs/cdns-spec.js'],
+		deliveryServiceTests: [
+			'login/login-spec.js',
+			'DeliveryServices/delivery-services-spec.js'],
+		serverTests: [
+			'login/login-spec.js',
+			'Servers/servers-spec.js'],
 	}
 };
diff --git a/traffic_portal/test/end_to_end/login/login-spec.js b/traffic_portal/test/end_to_end/login/login-spec.js
index a918aca..de91b10 100644
--- a/traffic_portal/test/end_to_end/login/login-spec.js
+++ b/traffic_portal/test/end_to_end/login/login-spec.js
@@ -21,13 +21,13 @@ describe('Traffic Portal Login Test Suite', function() {
 
     beforeEach(function() {
         browser.get(browser.baseUrl);
-	    browser.driver.manage().window().maximize();
-	    browser.wait(function() {
+        browser.wait(function() {
 		    return element(by.name('loginUsername')).isPresent();
 	    }, 5000);
     });
 
     it('should fail login to Traffic Portal with bad user', function() {
+        console.log('Negative login test');
         browser.driver.findElement(by.name('loginUsername')).sendKeys('badUser');
         browser.driver.findElement(by.name('loginPass')).sendKeys('badPassword');
         browser.driver.findElement(by.name('loginSubmit')).click();
@@ -37,6 +37,7 @@ describe('Traffic Portal Login Test Suite', function() {
     });
 
 	it('should successfully login to Traffic Portal', function() {
+		console.log('Logging in to Traffic Portal');
 		browser.driver.findElement(by.name('loginUsername')).sendKeys(browser.params.adminUser);
 		browser.driver.findElement(by.name('loginPass')).sendKeys(browser.params.adminPassword);
 		browser.driver.findElement(by.name('loginSubmit')).click();


[trafficcontrol] 04/04: Automated UI Testing - Added pauses to allow data to display properly

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit a6cbb02434ee925a492e36642ed38d38c8d3f16d
Author: cgillo000 <ch...@cable.comcast.com>
AuthorDate: Thu Oct 25 10:35:08 2018 -0600

    Automated UI Testing - Added pauses to allow data to display properly
---
 traffic_portal/test/end_to_end/CDNs/cdns-spec.js                   | 3 ++-
 .../test/end_to_end/DeliveryServices/delivery-services-spec.js     | 1 +
 traffic_portal/test/end_to_end/Servers/servers-spec.js             | 1 +
 traffic_portal/test/end_to_end/conf.js                             | 7 +------
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
index 17eafdd..384726e 100644
--- a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
+++ b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
@@ -52,8 +52,9 @@ describe('Traffic Portal CDNs Test Suite', function() {
 
 	it('should verify the new CDN and then update CDN', function() {
 		console.log("verifying the new CDN and then updating CDN");
-		browser.sleep(1000);
+		browser.sleep(250);
 		pageData.searchFilter.sendKeys(myNewCDN);
+		browser.sleep(250);
 		element.all(by.repeater('cdn in ::cdns')).filter(function(row){
 			return row.element(by.name('name')).getText().then(function(val){
 				return val === myNewCDN;
diff --git a/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js b/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
index d8150cc..5bda1c2 100644
--- a/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
+++ b/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
@@ -81,6 +81,7 @@ describe('Traffic Portal Delivery Services Suite', function() {
 		console.log('Updating the form for ' + mockVals.xmlId);
 		browser.sleep(250);
 		pageData.searchFilter.sendKeys(mockVals.xmlId);
+		browser.sleep(250);
 		element.all(by.repeater('ds in ::deliveryServices')).filter(function(row){
 			return row.element(by.name('xmlId')).getText().then(function(val){
 				return val.toString() === mockVals.xmlId.toString();
diff --git a/traffic_portal/test/end_to_end/Servers/servers-spec.js b/traffic_portal/test/end_to_end/Servers/servers-spec.js
index fb41c57..067d5a0 100644
--- a/traffic_portal/test/end_to_end/Servers/servers-spec.js
+++ b/traffic_portal/test/end_to_end/Servers/servers-spec.js
@@ -73,6 +73,7 @@ describe('Traffic Portal Servers Test Suite', function() {
 		console.log('Verifying new server added and updating ' + mockVals.hostName);
 		browser.sleep(1000);
 		pageData.searchFilter.sendKeys(mockVals.hostName);
+		browser.sleep(250);
 		element.all(by.repeater('s in ::servers')).filter(function(row){
 			return row.element(by.name('hostName')).getText().then(function(val){
 				return val === mockVals.hostName;
diff --git a/traffic_portal/test/end_to_end/conf.js b/traffic_portal/test/end_to_end/conf.js
index a834eca..0776984 100644
--- a/traffic_portal/test/end_to_end/conf.js
+++ b/traffic_portal/test/end_to_end/conf.js
@@ -22,12 +22,7 @@ exports.config = {
 	seleniumAddress: 'http://localhost:4444/wd/hub',
 	baseUrl: 'https://localhost:4443',
 	getPageTimeout: 30000,
-	// specs: [
-	// 	'login/login-spec.js',
-	// 	'CDNs/cdns-spec.js',
-	// 	'DeliveryServices/delivery-services-spec.js',
-	// 	'Servers/servers-spec.js',
-	// ],
+
 	capabilities: {
 		'browserName': 'chrome'
 	},


[trafficcontrol] 03/04: Automated UI Testing - Improved dropdown selection and added search box filtering

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 387a698be764f7eea44bcc6f3427480728f7a63e
Author: cgillo000 <ch...@cable.comcast.com>
AuthorDate: Wed Oct 24 13:22:28 2018 -0600

    Automated UI Testing - Improved dropdown selection and added search box
    filtering
---
 traffic_portal/test/end_to_end/CDNs/cdns-spec.js   |  2 +-
 traffic_portal/test/end_to_end/CDNs/pageData.js    |  1 +
 .../DeliveryServices/delivery-services-spec.js     | 20 +++++++------------
 .../test/end_to_end/DeliveryServices/pageData.js   |  1 +
 traffic_portal/test/end_to_end/Servers/pageData.js |  1 +
 .../test/end_to_end/Servers/servers-spec.js        | 23 ++++++++--------------
 .../pageData.js => common/commonFunctions.js}      | 21 ++++++++++----------
 7 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
index f300603..17eafdd 100644
--- a/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
+++ b/traffic_portal/test/end_to_end/CDNs/cdns-spec.js
@@ -53,9 +53,9 @@ describe('Traffic Portal CDNs Test Suite', function() {
 	it('should verify the new CDN and then update CDN', function() {
 		console.log("verifying the new CDN and then updating CDN");
 		browser.sleep(1000);
+		pageData.searchFilter.sendKeys(myNewCDN);
 		element.all(by.repeater('cdn in ::cdns')).filter(function(row){
 			return row.element(by.name('name')).getText().then(function(val){
-				console.log(val + " vs " + myNewCDN);
 				return val === myNewCDN;
 			});
 		}).get(0).click();
diff --git a/traffic_portal/test/end_to_end/CDNs/pageData.js b/traffic_portal/test/end_to_end/CDNs/pageData.js
index adea56b..687cbd8 100644
--- a/traffic_portal/test/end_to_end/CDNs/pageData.js
+++ b/traffic_portal/test/end_to_end/CDNs/pageData.js
@@ -24,6 +24,7 @@ module.exports = function(){
 	this.createButton=element(by.buttonText('Create'));
 	this.deleteButton=element(by.buttonText('Delete'));
 	this.updateButton=element(by.buttonText('Update'));
+	this.searchFilter=element(by.id('cdnsTable_filter')).element(by.css('label')).element(by.css('input'));
 	this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
 	this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
 };
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js b/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
index 8f13ea6..d8150cc 100644
--- a/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
+++ b/traffic_portal/test/end_to_end/DeliveryServices/delivery-services-spec.js
@@ -18,20 +18,18 @@
  */
 
 var pd = require('./pageData.js');
+var cfunc = require('../common/commonFunctions.js');
 
 describe('Traffic Portal Delivery Services Suite', function() {
 
 	var pageData = new pd();
+	var commonFunctions = new cfunc();
 	var mockVals = {
 		dsType: ["ANY MAP", "DNS", "HTTP", "STEERING"],
 		active: "true",
-		type: "DNS",
 		xmlId: "thisIsOnlyATest",
 		displayName: "dsTest",
-		tenantId: "- root",
-		cdn: "CDN-in-a-Box",
 		orgServerFqdn: "http://dstest.com",
-		protocol: "0 - HTTP",
 		longDesc: "This is only a test that should be disposed of by Automated UI Testing."
 	};
 
@@ -59,17 +57,13 @@ describe('Traffic Portal Delivery Services Suite', function() {
 		expect(pageData.createButton.isEnabled()).toBe(false);
 		pageData.active.click();
 		pageData.active.sendKeys(mockVals.active);
-		pageData.type.click();
-		pageData.type.sendKeys(mockVals.type);
+		commonFunctions.selectDropdownbyNum(pageData.type, 1);
 		pageData.xmlId.sendKeys(mockVals.xmlId);
 		pageData.displayName.sendKeys(mockVals.displayName);
-		pageData.tenantId.click();
-		pageData.tenantId.sendKeys(mockVals.tenantId);
-		pageData.cdn.click();
-		pageData.cdn.sendKeys(mockVals.cdn);
+		commonFunctions.selectDropdownbyNum(pageData.tenantId, 1);
+		commonFunctions.selectDropdownbyNum(pageData.cdn, 1);
 		pageData.orgServerFqdn.sendKeys(mockVals.orgServerFqdn);
-		pageData.protocol.click();
-		pageData.protocol.sendKeys(mockVals.protocol);
+		commonFunctions.selectDropdownbyNum(pageData.protocol, 1);
 		pageData.longDesc.sendKeys(mockVals.longDesc);
 		expect(pageData.createButton.isEnabled()).toBe(true);
 		pageData.createButton.click();
@@ -86,9 +80,9 @@ describe('Traffic Portal Delivery Services Suite', function() {
 	it('should update the ds', function() {
 		console.log('Updating the form for ' + mockVals.xmlId);
 		browser.sleep(250);
+		pageData.searchFilter.sendKeys(mockVals.xmlId);
 		element.all(by.repeater('ds in ::deliveryServices')).filter(function(row){
 			return row.element(by.name('xmlId')).getText().then(function(val){
-				console.log(val + " this is my val " + mockVals.xmlId);
 				return val.toString() === mockVals.xmlId.toString();
 			});
 		}).get(0).click();
diff --git a/traffic_portal/test/end_to_end/DeliveryServices/pageData.js b/traffic_portal/test/end_to_end/DeliveryServices/pageData.js
index 63aefd4..97d495e 100644
--- a/traffic_portal/test/end_to_end/DeliveryServices/pageData.js
+++ b/traffic_portal/test/end_to_end/DeliveryServices/pageData.js
@@ -31,6 +31,7 @@ module.exports = function(){
 	this.createButton=element(by.buttonText('Create'));
 	this.deleteButton=element(by.buttonText('Delete'));
 	this.updateButton=element(by.buttonText('Update'));
+	this.searchFilter=element(by.id('deliveryServicesTable_filter')).element(by.css('label')).element(by.css('input'));
 	this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
 	this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
 };
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/Servers/pageData.js b/traffic_portal/test/end_to_end/Servers/pageData.js
index bca1764..c4b54b2 100644
--- a/traffic_portal/test/end_to_end/Servers/pageData.js
+++ b/traffic_portal/test/end_to_end/Servers/pageData.js
@@ -34,6 +34,7 @@ module.exports = function(){
 	this.createButton=element(by.buttonText('Create'));
 	this.deleteButton=element(by.buttonText('Delete'));
 	this.updateButton=element(by.buttonText('Update'));
+	this.searchFilter=element(by.id('serversTable_filter')).element(by.css('label')).element(by.css('input'));
 	this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
 	this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
 };
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/Servers/servers-spec.js b/traffic_portal/test/end_to_end/Servers/servers-spec.js
index a469502..fb41c57 100644
--- a/traffic_portal/test/end_to_end/Servers/servers-spec.js
+++ b/traffic_portal/test/end_to_end/Servers/servers-spec.js
@@ -18,24 +18,21 @@
  */
 
 var pd = require('./pageData.js');
+var cfunc = require('../common/commonFunctions.js');
 
 describe('Traffic Portal Servers Test Suite', function() {
 
 	var pageData = new pd();
+	var commonFunctions = new cfunc();
 	var mockVals = {
 		status: "OFFLINE",
 		hostName: "testHost",
 		domainName: "servertest.com",
-		cdn: "CDN-in-a-Box",
-		cachegroup: "CDN_in_a_Box_Edge",
-		type: "EDGE",
-		profile: "ATS_EDGE_TIER_CACHE",
 		interfaceName: "testInterfaceName",
 		ipAddress: "10.42.80.118",
 		ipNetmask: "255.255.255.252",
 		ipGateway: "10.42.80.117",
 		interfaceMtu: "9000",
-		physLocation: "CDN-in-a-Box",
 	};
 
 	it('should go to the Servers page', function() {
@@ -57,21 +54,16 @@ describe('Traffic Portal Servers Test Suite', function() {
 		pageData.status.sendKeys(mockVals.status);
 		pageData.hostName.sendKeys(mockVals.hostName);
 		pageData.domainName.sendKeys(mockVals.domainName);
-		pageData.cdn.click();
-		pageData.cdn.sendKeys(mockVals.cdn);
-		pageData.cachegroup.click();
-		pageData.cachegroup.sendKeys(mockVals.cachegroup);
-		pageData.type.click();
-		pageData.type.sendKeys(mockVals.type);
-		pageData.profile.click();
-		pageData.profile.sendKeys(mockVals.profile);
+		commonFunctions.selectDropdownbyNum(pageData.cdn, 1);
+		commonFunctions.selectDropdownbyNum(pageData.cachegroup, 1);
+		commonFunctions.selectDropdownbyNum(pageData.type, 1);
+		commonFunctions.selectDropdownbyNum(pageData.profile, 1);
 		pageData.interfaceName.sendKeys(mockVals.interfaceName);
 		pageData.ipAddress.sendKeys(mockVals.ipAddress);
 		pageData.ipNetmask.sendKeys(mockVals.ipNetmask);
 		pageData.ipGateway.sendKeys(mockVals.ipGateway);
 		pageData.interfaceMtu.sendKeys(mockVals.interfaceMtu);
-		pageData.physLocation.click();
-		pageData.physLocation.sendKeys(mockVals.physLocation);
+		commonFunctions.selectDropdownbyNum(pageData.physLocation, 1);
 		expect(pageData.createButton.isEnabled()).toBe(true);
 		pageData.createButton.click();
 		expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/servers");
@@ -80,6 +72,7 @@ describe('Traffic Portal Servers Test Suite', function() {
 	it('should verify the new Server and then update Server', function() {
 		console.log('Verifying new server added and updating ' + mockVals.hostName);
 		browser.sleep(1000);
+		pageData.searchFilter.sendKeys(mockVals.hostName);
 		element.all(by.repeater('s in ::servers')).filter(function(row){
 			return row.element(by.name('hostName')).getText().then(function(val){
 				return val === mockVals.hostName;
diff --git a/traffic_portal/test/end_to_end/CDNs/pageData.js b/traffic_portal/test/end_to_end/common/commonFunctions.js
similarity index 62%
copy from traffic_portal/test/end_to_end/CDNs/pageData.js
copy to traffic_portal/test/end_to_end/common/commonFunctions.js
index adea56b..dc53731 100644
--- a/traffic_portal/test/end_to_end/CDNs/pageData.js
+++ b/traffic_portal/test/end_to_end/common/commonFunctions.js
@@ -17,13 +17,14 @@
  * under the License.
  */
 
-module.exports = function(){
-	this.name=element(by.name('name'));
-	this.domainName=element(by.name('domainName'));
-	this.dnssecEnabled=element(by.name('dnssecEnabled'));
-	this.createButton=element(by.buttonText('Create'));
-	this.deleteButton=element(by.buttonText('Delete'));
-	this.updateButton=element(by.buttonText('Update'));
-	this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
-	this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
-};
\ No newline at end of file
+module.exports = function() {
+	// selectDropdownbyNum - pass in the <SELECT> element and a option number, typically 1
+	this.selectDropdownbyNum = function ( element, optionNum ) {
+		if (optionNum){
+			var options = element.all(by.tagName('option'))
+				.then(function(options){
+					options[optionNum].click();
+				});
+		}
+	};
+};