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/12/13 22:53:14 UTC
[trafficcontrol] branch master updated: Delivery Service Requests
Protractor Tests (#3108)
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
The following commit(s) were added to refs/heads/master by this push:
new 28aab0f Delivery Service Requests Protractor Tests (#3108)
28aab0f is described below
commit 28aab0f719186ee78ba68ee9e1eca201519be5d9
Author: Chad Gilloth <ch...@cable.comcast.com>
AuthorDate: Thu Dec 13 15:53:10 2018 -0700
Delivery Service Requests Protractor Tests (#3108)
---
.../dialog.deliveryServiceRequest.tpl.html | 2 +-
.../table.deliveryServiceRequestComments.tpl.html | 6 +-
.../table.deliveryServiceRequests.tpl.html | 2 +-
.../delivery-service-requests-spec.js | 149 +++++++++++++++++++++
.../end_to_end/DeliveryServiceRequests/pageData.js | 47 +++++++
.../end_to_end/conf-delivery-service-requests.js | 36 +++++
6 files changed, 237 insertions(+), 5 deletions(-)
diff --git a/traffic_portal/app/src/common/modules/dialog/deliveryServiceRequest/dialog.deliveryServiceRequest.tpl.html b/traffic_portal/app/src/common/modules/dialog/deliveryServiceRequest/dialog.deliveryServiceRequest.tpl.html
index 37b10a3..f9fb848 100644
--- a/traffic_portal/app/src/common/modules/dialog/deliveryServiceRequest/dialog.deliveryServiceRequest.tpl.html
+++ b/traffic_portal/app/src/common/modules/dialog/deliveryServiceRequest/dialog.deliveryServiceRequest.tpl.html
@@ -24,7 +24,7 @@ under the License.
<div class="modal-body">
<form name="dsRequestForm" novalidate>
<p ng-bind-html="params.message"></p>
- <select class="form-control" ng-model="selectedStatusId" ng-options="status.id as status.name for status in statuses" required>
+ <select name="requestStatus" class="form-control" ng-model="selectedStatusId" ng-options="status.id as status.name for status in statuses" required>
<option value="">Select request status...</option>
</select>
<textarea name="comment" rows="5" cols="17" style="margin-top: 10px;" placeholder="Enter request comment..." class="form-control" ng-model="comment" required></textarea>
diff --git a/traffic_portal/app/src/common/modules/table/deliveryServiceRequestComments/table.deliveryServiceRequestComments.tpl.html b/traffic_portal/app/src/common/modules/table/deliveryServiceRequestComments/table.deliveryServiceRequestComments.tpl.html
index 6332511..65384e0 100644
--- a/traffic_portal/app/src/common/modules/table/deliveryServiceRequestComments/table.deliveryServiceRequestComments.tpl.html
+++ b/traffic_portal/app/src/common/modules/table/deliveryServiceRequestComments/table.deliveryServiceRequestComments.tpl.html
@@ -23,7 +23,7 @@ under the License.
<li class="active">Comments</li>
</ol>
<div class="pull-right" role="group">
- <button class="btn btn-primary" title="Create Comment" ng-click="createComment()"><i class="fa fa-plus"></i>
+ <button name="createComment" class="btn btn-primary" title="Create Comment" ng-click="createComment()"><i class="fa fa-plus"></i>
</button>
<button class="btn btn-default" title="Refresh" ng-click="getComments()"><i class="fa fa-refresh"></i>
</button>
@@ -61,9 +61,9 @@ under the License.
<span class="ds-comment-italic">{{getRelativeTime(c.lastUpdated)}}</span>
</div>
<div class="pull-right cell-right" style="text-align: right; vertical-align: top;">
- <a class="link action-link" title="Update Comment"
+ <a name="editComment" class="link action-link" title="Update Comment"
ng-click="editComment(c)"><i class="fa fa-edit"></i></a>
- <a class="link action-link" title="Delete Comment"
+ <a name="deleteComment" class="link action-link" title="Delete Comment"
ng-click="deleteComment(c, $event)"><i class="fa fa-trash-o"></i></a>
</div>
<div class="clearfix"></div>
diff --git a/traffic_portal/app/src/common/modules/table/deliveryServiceRequests/table.deliveryServiceRequests.tpl.html b/traffic_portal/app/src/common/modules/table/deliveryServiceRequests/table.deliveryServiceRequests.tpl.html
index 775e756..63ea010 100644
--- a/traffic_portal/app/src/common/modules/table/deliveryServiceRequests/table.deliveryServiceRequests.tpl.html
+++ b/traffic_portal/app/src/common/modules/table/deliveryServiceRequests/table.deliveryServiceRequests.tpl.html
@@ -44,7 +44,7 @@ under the License.
</thead>
<tbody>
<tr ng-click="editDeliveryServiceRequest(request)" ng-repeat="request in ::dsRequests" ng-class="::{'active': closed(request)}">
- <td data-search="^{{::request.deliveryService.xmlId}}$">{{::request.deliveryService.xmlId}}</td>
+ <td name="xmlId" data-search="^{{::request.deliveryService.xmlId}}$">{{::request.deliveryService.xmlId}}</td>
<td data-search="^{{::request.changeType}}$">{{::request.changeType}}</td>
<td data-search="^{{::request.status}}$">
<span ng-if="!open(request)">{{::request.status}}</span>
diff --git a/traffic_portal/test/end_to_end/DeliveryServiceRequests/delivery-service-requests-spec.js b/traffic_portal/test/end_to_end/DeliveryServiceRequests/delivery-service-requests-spec.js
new file mode 100644
index 0000000..91201aa
--- /dev/null
+++ b/traffic_portal/test/end_to_end/DeliveryServiceRequests/delivery-service-requests-spec.js
@@ -0,0 +1,149 @@
+/*
+ * 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 Delivery Service Requests', function() {
+
+ var pageData = new pd();
+ var commonFunctions = new cfunc();
+ var mockVals = {
+ dsType: ["ANY MAP", "DNS", "HTTP", "STEERING"],
+ active: "true",
+ xmlId: "thisIsOnlyADSTest",
+ displayName: "dsTest",
+ orgServerFqdn: "http://dstest.com",
+ longDesc: "This is only a test that should be disposed of by Automated UI Testing.",
+ commentInput: "This is the second comment"
+ };
+
+ it('should open ds services page and click button to create a new one', function() {
+ console.log('Opening delivery service requests 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);
+ 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() {
+ 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);
+ pageData.active.click();
+ pageData.active.sendKeys(mockVals.active);
+ commonFunctions.selectDropdownbyNum(pageData.type, 1);
+ pageData.xmlId.sendKeys(mockVals.xmlId);
+ pageData.displayName.sendKeys(mockVals.displayName);
+ commonFunctions.selectDropdownbyNum(pageData.tenantId, 1);
+ commonFunctions.selectDropdownbyNum(pageData.cdn, 1);
+ pageData.orgServerFqdn.sendKeys(mockVals.orgServerFqdn);
+ commonFunctions.selectDropdownbyNum(pageData.protocol, 1);
+ pageData.longDesc.sendKeys(mockVals.longDesc);
+ expect(pageData.createButton.isEnabled()).toBe(true);
+ pageData.createButton.click();
+ browser.sleep(250);
+ });
+
+ it('should select a status from the dropdown and add comment before submitting', function() {
+ browser.sleep(250);
+ commonFunctions.selectDropdownbyNum(pageData.requestStatus, 2);
+ pageData.dialogComment.sendKeys('This is comment one');
+ browser.sleep(250);
+ expect(pageData.dialogSubmit.isEnabled()).toBe(true);
+ pageData.dialogSubmit.click();
+ browser.sleep(250);
+ });
+
+ it('should redirect to delivery-service-requests page', function() {
+ console.log('Backing out and verifying ' + mockVals.xmlId + ' exists');
+ expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-service-requests");
+ });
+
+ it('should open up and update the ds', function() {
+ console.log('Updating the form for ' + mockVals.xmlId);
+ browser.sleep(250);
+ element.all(by.repeater('request in ::dsRequests')).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");
+ expect(pageData.updateButton.isEnabled()).toBe(true);
+ pageData.updateButton.click();
+ browser.sleep(250);
+ expect(pageData.displayName.getText() === mockVals.displayName + "updated");
+ });
+
+ it('should select a status from the dropdown and add comment before submitting', function() {
+ browser.sleep(250);
+ commonFunctions.selectDropdownbyNum(pageData.requestStatus, 2);
+ pageData.dialogComment.sendKeys('This is comment two');
+ browser.sleep(250);
+ expect(pageData.dialogSubmit.isEnabled()).toBe(true);
+ pageData.dialogSubmit.click();
+ browser.sleep(250);
+ });
+
+ it('should add a comment', function () {
+ console.log('Adding Comment');
+ pageData.newCommentButton.click();
+ browser.sleep(250);
+ pageData.commentInput.sendKeys(mockVals.commentInput);
+ pageData.createCommentButton.click();
+ });
+
+ it('should edit a comment', function () {
+ console.log('Editing Comment');
+ browser.sleep(250);
+ element.all(by.css('.link.action-link')).first().click();
+ browser.sleep(250);
+ pageData.commentInput.sendKeys(mockVals.commentInput);
+ pageData.updateCommentButton.click();
+ });
+
+ it('should delete a comment', function () {
+ console.log('Deleting Comment');
+ browser.sleep(250);
+ element.all(by.css('.link.action-link')).get(1).click();
+ browser.sleep(250);
+ pageData.yesButton.click();
+ });
+
+ it('should delete the ds request', function() {
+ console.log('Deleting ' + mockVals.xmlId);
+ pageData.deleteButton.click();
+ pageData.confirmWithNameInput.sendKeys(mockVals.xmlId + ' request');
+ pageData.deletePermanentlyButton.click();
+ expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+"/#!/delivery-service-requests");
+ });
+});
diff --git a/traffic_portal/test/end_to_end/DeliveryServiceRequests/pageData.js b/traffic_portal/test/end_to_end/DeliveryServiceRequests/pageData.js
new file mode 100644
index 0000000..0a74753
--- /dev/null
+++ b/traffic_portal/test/end_to_end/DeliveryServiceRequests/pageData.js
@@ -0,0 +1,47 @@
+/*
+ * 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.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.requestStatus=element(by.name('requestStatus'));
+ this.createButton=element(by.buttonText('Create'));
+ this.deleteButton=element(by.buttonText('Delete Request'));
+ this.updateButton=element(by.buttonText('Update Request'));
+ this.fulfillButton=element(by.buttonText('Fulfill Request'));
+ this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
+ this.dialogComment=element(by.name('comment'));
+ this.dialogSubmit=element(by.buttonText('Submit'));
+ this.newCommentButton=element(by.name('createComment'));
+ this.editCommentButton=element(by.name('editComment'));
+ this.deleteCommentButton=element(by.name('deleteComment'));
+ this.updateCommentButton=element(by.buttonText('Update Comment'));
+ this.yesButton=element(by.buttonText('Yes'));
+ this.commentInput=element(by.name('text'));
+ this.createCommentButton=element(by.buttonText('Create Comment'));
+ this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
+};
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/conf-delivery-service-requests.js b/traffic_portal/test/end_to_end/conf-delivery-service-requests.js
new file mode 100644
index 0000000..b9efd93
--- /dev/null
+++ b/traffic_portal/test/end_to_end/conf-delivery-service-requests.js
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+exports.config = {
+ framework: 'jasmine',
+ seleniumAddress: 'http://localhost:4444/wd/hub',
+ specs: ['login/login-spec.js', 'DeliveryServiceRequests/delivery-service-requests-spec.js'],
+ baseUrl: 'https://localhost:4443',
+ getPageTimeout: 30000,
+
+ capabilities: {
+ 'browserName': 'chrome'
+ },
+ params: {
+ adminUser: 'admin',
+ adminPassword: 'twelve'
+ },
+ jasmineNodeOpts: {defaultTimeoutInterval: 600000},
+
+};