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:48 UTC
[trafficcontrol] 03/04: Automated UI Testing - Improved dropdown
selection and added search box filtering
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();
+ });
+ }
+ };
+};