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 2019/07/23 21:51:05 UTC
[trafficcontrol] branch master updated: Change redirect location
after creating a parameter or profile (#3737)
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 685c7d3 Change redirect location after creating a parameter or profile (#3737)
685c7d3 is described below
commit 685c7d360d04efaffa604a5a510606bc86b58d15
Author: Alex Luckerman <35...@users.noreply.github.com>
AuthorDate: Tue Jul 23 15:50:59 2019 -0600
Change redirect location after creating a parameter or profile (#3737)
* Change redirect on param/profile creation
* Add UI tests
---
.../app/src/common/api/ParameterService.js | 2 +-
.../app/src/common/api/ProfileService.js | 2 +-
.../{profiles => parameters}/pageData.js | 10 +++---
.../parameters-spec.js} | 37 +++++++++++-----------
.../test/end_to_end/profiles/pageData.js | 1 +
.../test/end_to_end/profiles/profiles-spec.js | 4 +--
6 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/traffic_portal/app/src/common/api/ParameterService.js b/traffic_portal/app/src/common/api/ParameterService.js
index 4303451..bd72fe7 100644
--- a/traffic_portal/app/src/common/api/ParameterService.js
+++ b/traffic_portal/app/src/common/api/ParameterService.js
@@ -45,7 +45,7 @@ var ParameterService = function($http, locationUtils, messageModel, ENV) {
return $http.post(ENV.api['root'] + 'parameters', parameter).then(
function(result) {
messageModel.setMessages([ { level: 'success', text: 'Parameter created' } ], true);
- locationUtils.navigateToPath('/parameters');
+ locationUtils.navigateToPath('/parameters/' + result.data.response.id + '/profiles');
return result;
},
function(err) {
diff --git a/traffic_portal/app/src/common/api/ProfileService.js b/traffic_portal/app/src/common/api/ProfileService.js
index f805c41..d949fac 100644
--- a/traffic_portal/app/src/common/api/ProfileService.js
+++ b/traffic_portal/app/src/common/api/ProfileService.js
@@ -45,7 +45,7 @@ var ProfileService = function($http, locationUtils, messageModel, ENV) {
return $http.post(ENV.api['root'] + 'profiles', profile).then(
function(result) {
messageModel.setMessages([ { level: 'success', text: 'Profile created' } ], true);
- locationUtils.navigateToPath('/profiles');
+ locationUtils.navigateToPath('/profiles/' + result.data.response.id + '/parameters');
return result;
},
function(err) {
diff --git a/traffic_portal/test/end_to_end/profiles/pageData.js b/traffic_portal/test/end_to_end/parameters/pageData.js
similarity index 78%
copy from traffic_portal/test/end_to_end/profiles/pageData.js
copy to traffic_portal/test/end_to_end/parameters/pageData.js
index fbdd761..75a2a8d 100644
--- a/traffic_portal/test/end_to_end/profiles/pageData.js
+++ b/traffic_portal/test/end_to_end/parameters/pageData.js
@@ -18,15 +18,15 @@
*/
module.exports = function(){
+ this.createParameterButton=element(by.css('[title="Create Parameter"]'));
this.name=element(by.name('name'));
- this.cdn=element(by.name('cdn'));
- this.type=element(by.name('type'));
- this.routingDisabled=element(by.name('routingDisabled'));
- this.description=element(by.id('description'));
+ this.configFile=element(by.name('configFile'));
+ this.secure=element(by.name('secure'));
+ this.value=element(by.name('value'));
this.createButton=element(by.buttonText('Create'));
this.deleteButton=element(by.buttonText('Delete'));
this.updateButton=element(by.buttonText('Update'));
- this.searchFilter=element(by.id('profilesTable_filter')).element(by.css('label')).element(by.css('input'));
+ this.searchFilter=element(by.id('parametersTable_filter')).element(by.css('label')).element(by.css('input'));
this.confirmWithNameInput=element(by.name('confirmWithNameInput'));
this.deletePermanentlyButton=element(by.buttonText('Delete Permanently'));
};
diff --git a/traffic_portal/test/end_to_end/profiles/profiles-spec.js b/traffic_portal/test/end_to_end/parameters/parameters-spec.js
similarity index 59%
copy from traffic_portal/test/end_to_end/profiles/profiles-spec.js
copy to traffic_portal/test/end_to_end/parameters/parameters-spec.js
index e8ea5dd..848aba3 100644
--- a/traffic_portal/test/end_to_end/profiles/profiles-spec.js
+++ b/traffic_portal/test/end_to_end/parameters/parameters-spec.js
@@ -20,37 +20,36 @@
var pd = require('./pageData.js');
var cfunc = require('../common/commonFunctions.js');
-describe('Traffic Portal Profiles Test Suite', function() {
+describe('Traffic Portal Parameters Test Suite', function() {
const pageData = new pd();
const commonFunctions = new cfunc();
- const myNewProfile = {
- name: 'profile-' + commonFunctions.shuffle('abcdefghijklmonpqrstuvwxyz0123456789'),
+ const myNewParameter = {
+ name: 'parameter-' + commonFunctions.shuffle('abcdefghijklmonpqrstuvwxyz0123456789'),
+ configFile: 'config-' + commonFunctions.shuffle('abcdefghijklmonpqrstuvwxyz0123456789')
};
- it('should go to the profiles page', function() {
- console.log("Go to the profiles page");
- browser.setLocation("profiles");
- expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toEqual(commonFunctions.urlPath(browser.baseUrl)+"#!/profiles");
+ it('should go to the parameters page', function() {
+ console.log("Go to the parameters page");
+ browser.get(browser.baseUrl + "/#!/parameters");
+ expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toEqual(commonFunctions.urlPath(browser.baseUrl)+"#!/parameters");
});
- it('should open new profile form page', function() {
- console.log("Open new profile form page");
- browser.driver.findElement(by.name('createProfileButton')).click();
- expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toEqual(commonFunctions.urlPath(browser.baseUrl)+"#!/profiles/new");
+ it('should open new parameter form page', function() {
+ console.log("Open new parameter form page");
+ pageData.createParameterButton.click();
+ expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toEqual(commonFunctions.urlPath(browser.baseUrl)+"#!/parameters/new");
});
it('should fill out form, create button is enabled and submit', function () {
console.log("Filling out form, check create button is enabled and submit");
expect(pageData.createButton.isEnabled()).toBe(false);
- pageData.name.sendKeys(myNewProfile.name);
- commonFunctions.selectDropdownbyNum(pageData.cdn, 1);
- commonFunctions.selectDropdownbyNum(pageData.type, 1);
- pageData.routingDisabled.click();
- pageData.routingDisabled.sendKeys('false');
- pageData.description.sendKeys(myNewProfile.name);
+ pageData.name.sendKeys(myNewParameter.name);
+ pageData.configFile.sendKeys(myNewParameter.configFile);
+ commonFunctions.selectDropdownbyNum(pageData.secure, 1);
+ pageData.value.sendKeys(myNewParameter.name);
expect(pageData.createButton.isEnabled()).toBe(true);
pageData.createButton.click();
- expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toEqual(commonFunctions.urlPath(browser.baseUrl)+"#!/profiles");
+ expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toMatch(commonFunctions.urlPath(browser.baseUrl)+"#!/parameters/[0-9]+/profiles");
});
-});
+});
\ No newline at end of file
diff --git a/traffic_portal/test/end_to_end/profiles/pageData.js b/traffic_portal/test/end_to_end/profiles/pageData.js
index fbdd761..12bcf0e 100644
--- a/traffic_portal/test/end_to_end/profiles/pageData.js
+++ b/traffic_portal/test/end_to_end/profiles/pageData.js
@@ -18,6 +18,7 @@
*/
module.exports = function(){
+ this.createProfileButton=element(by.name('createProfileButton'));
this.name=element(by.name('name'));
this.cdn=element(by.name('cdn'));
this.type=element(by.name('type'));
diff --git a/traffic_portal/test/end_to_end/profiles/profiles-spec.js b/traffic_portal/test/end_to_end/profiles/profiles-spec.js
index e8ea5dd..24a0938 100644
--- a/traffic_portal/test/end_to_end/profiles/profiles-spec.js
+++ b/traffic_portal/test/end_to_end/profiles/profiles-spec.js
@@ -35,7 +35,7 @@ describe('Traffic Portal Profiles Test Suite', function() {
it('should open new profile form page', function() {
console.log("Open new profile form page");
- browser.driver.findElement(by.name('createProfileButton')).click();
+ pageData.createProfileButton.click();
expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toEqual(commonFunctions.urlPath(browser.baseUrl)+"#!/profiles/new");
});
@@ -50,7 +50,7 @@ describe('Traffic Portal Profiles Test Suite', function() {
pageData.description.sendKeys(myNewProfile.name);
expect(pageData.createButton.isEnabled()).toBe(true);
pageData.createButton.click();
- expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toEqual(commonFunctions.urlPath(browser.baseUrl)+"#!/profiles");
+ expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toMatch(commonFunctions.urlPath(browser.baseUrl)+"#!/profiles/[0-9]+/parameters");
});
});