e2e test error page and fix (#3672)

* fix wrong input parameter functionality

* not reload the page to go to the content service page

* navigate instead to reload to go to the process service page
This commit is contained in:
Eugenio Romano
2018-08-08 17:18:26 +01:00
committed by Eugenio Romano
parent 6cf6c9c0e4
commit 2e0945b0cc
32 changed files with 169 additions and 231 deletions

View File

@@ -44,11 +44,34 @@ describe('Error Component', () => {
});
it('[C277302] Error message displayed without permissions', () => {
it('[C277302] Should display the error 403 when access to unathorized page', () => {
browser.get(TestConfig.adf.url + '/error/403');
expect(errorPage.getErrorCode()).toBe('403');
expect(errorPage.getErrorTitle()).toBe('You don\'t have permission to access this server.');
expect(errorPage.getErrorDescription()).toBe('You\'re not allowed access to this resource on the server.');
});
it('[C280563] Should back home button navigate to the home page', () => {
browser.get(TestConfig.adf.url + '/error/404');
errorPage.clickBackButton();
expect(browser.getCurrentUrl()).toBe(TestConfig.adf.url + '/');
});
it('[C280564] Should secondary button by default redirect to report-issue URL', () => {
browser.get(TestConfig.adf.url + '/error/403');
errorPage.clickSecondButton();
expect(browser.getCurrentUrl()).toBe(TestConfig.adf.url + '/report-issue');
});
it('[C277304] We couldnt find the page you were looking for.\' to be \'You\'re not allowed access to this resource on the server.', () => {
browser.get(TestConfig.adf.url + '/error/404');
expect(errorPage.getErrorCode()).toBe('404');
expect(errorPage.getErrorTitle()).toBe('An error occurred.');
expect(errorPage.getErrorDescription()).toBe('We couldnt find the page you were looking for.');
});
});

View File

@@ -15,8 +15,6 @@
* limitations under the License.
*/
import { protractor } from 'protractor';
import AdfSettingsPage = require('../pages/adf/settingsPage');
import LoginPage = require('../pages/adf/loginPage');
import UserInfoDialog = require('../pages/adf/dialog/userInfoDialog');

View File

@@ -68,7 +68,7 @@ var CardViewComponentPage = function () {
return saveIcon.click();
};
this.getTextFieldText = function (text) {
this.getTextFieldText = function () {
var textField = element(by.css("span[data-automation-id='card-textitem-value-name']"));
Util.waitUntilElementIsVisible(textField);
return textField.getText();
@@ -108,13 +108,13 @@ var CardViewComponentPage = function () {
return this;
};
this.getIntFieldText = function (text) {
this.getIntFieldText = function () {
var textField = element(by.css('span[data-automation-id="card-textitem-value-int"]'));
Util.waitUntilElementIsVisible(textField);
return textField.getText();
};
this.getErrorInt = function (text) {
this.getErrorInt = function () {
let errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
Util.waitUntilElementIsVisible(errorElement);
return errorElement.getText();
@@ -147,13 +147,13 @@ var CardViewComponentPage = function () {
return this;
};
this.getFloatFieldText = function (text) {
this.getFloatFieldText = function () {
var textField = element(by.css('span[data-automation-id="card-textitem-value-float"]'));
Util.waitUntilElementIsVisible(textField);
return textField.getText();
};
this.getErrorFloat = function (text) {
this.getErrorFloat = function () {
let errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]'));
Util.waitUntilElementIsVisible(errorElement);
return errorElement.getText();

View File

@@ -20,6 +20,7 @@ var ContentList = require('./dialog/contentList');
var CreateFolderDialog = require('./dialog/createFolderDialog');
var path = require('path');
var TestConfig = require('../../test.config');
var NavigationBarPage = require('./navigationBarPage');
var ContentServicesPage = function () {
@@ -116,7 +117,8 @@ var ContentServicesPage = function () {
};
this.navigateToDocumentList = function () {
browser.driver.get(contentServicesURL);
var navigationBarPage = new NavigationBarPage();
navigationBarPage.clickContentServicesButton();
this.checkAcsContainer();
};
@@ -261,7 +263,7 @@ var ContentServicesPage = function () {
};
this.checkContentsAreDisplayed = function (content) {
for (i = 0; i < content.length; i++) {
for (var i = 0; i < content.length; i++) {
this.checkContentIsDisplayed(content[i]);
}
return this;
@@ -273,7 +275,7 @@ var ContentServicesPage = function () {
};
this.checkContentsAreNotDisplayed = function (content) {
for (i = 0; i < content.length; i++) {
for (var i = 0; i < content.length; i++) {
this.checkContentIsNotDisplayed(content[i]);
}
return this;
@@ -327,7 +329,6 @@ var ContentServicesPage = function () {
for (var i = 1; i < files.length; i++) {
allFiles = allFiles + "\n" + path.resolve(path.join(TestConfig.main.rootPath, files[i]));
}
;
uploadMultipleFileButton.sendKeys(allFiles);
Util.waitUntilElementIsVisible(uploadMultipleFileButton);
return this;
@@ -371,11 +372,11 @@ var ContentServicesPage = function () {
};
this.deleteContents = function (content) {
for (i = 0; i < content.length; i++) {
for (var i = 0; i < content.length; i++) {
this.deleteContent(content[i]);
this.checkContentIsNotDisplayed(content[i]);
browser.driver.sleep(1000);
};
}
return this;
};

View File

@@ -68,7 +68,6 @@ var ContentList = function () {
if (text !== '') {
initialList.push(text);
}
;
});
}).then(function () {
deferred.fulfill(initialList);

View File

@@ -123,7 +123,7 @@ var SearchDialog = function () {
this.clearText = function () {
Util.waitUntilElementIsVisible(searchBar);
var deferred = protractor.promise.defer();
searchBar.clear().then(function (value) {
searchBar.clear().then(function () {
searchBar.sendKeys(protractor.Key.ESCAPE);
});
return deferred.promise;

View File

@@ -85,7 +85,7 @@ var UploadDialog = function () {
};
this.filesAreUploaded = function (content) {
for (i=0; i<content.length; i++) {
for (var i=0; i<content.length; i++) {
this.fileIsUploaded(content[i]);
}
return this;
@@ -96,7 +96,7 @@ var UploadDialog = function () {
return this;
};
this.cancelUploads = function (content) {
this.cancelUploads = function () {
Util.waitUntilElementIsVisible(cancelUploads);
cancelUploads.click();
return this;

View File

@@ -24,6 +24,7 @@ var ErrorPage = function(){
var errorPageTitle = element(by.css("adf-error-content .adf-error-content-title"));
var errorPageDescription = element(by.css("adf-error-content .adf-error-content-description"));
var backButton = element(by.id("adf-return-button"));
var secondButton = element(by.id("adf-secondary-button"));
this.checkErrorPage = function(){
Util.waitUntilElementIsVisible(errorPage);
@@ -34,6 +35,11 @@ var ErrorPage = function(){
backButton.click();
};
this.clickSecondButton = function(){
Util.waitUntilElementIsVisible(secondButton);
secondButton.click();
};
this.checkErrorTitle = function(){
Util.waitUntilElementIsVisible(errorPageTitle);
};

View File

@@ -120,7 +120,7 @@ var LoginPage = function () {
* @method checkUsernameTooltip
* @param {String} message
*/
this.checkUsernameTooltip = function (message) {
this.checkUsernameTooltip = function () {
Util.waitUntilElementIsVisible(usernameTooltip);
};
@@ -129,7 +129,7 @@ var LoginPage = function () {
* @method checkPasswordTooltip
* @param {String} message
*/
this.checkPasswordTooltip = function (message) {
this.checkPasswordTooltip = function () {
Util.waitUntilElementIsVisible(passwordTooltip);
};

View File

@@ -241,7 +241,7 @@ var MetadataViewPage = function () {
editPropertyIcon.click();
};
this.getPropertyIconTooltip = function (propertyName, icon) {
this.getPropertyIconTooltip = function (propertyName) {
var editPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
return editPropertyIcon.getAttribute('title');
};

View File

@@ -106,7 +106,7 @@ var PaginationPage = function () {
element.getText().then(function(text) {
if(text !== '') {
initialList.push(text);
};
}
});
}).then(function () {
deferred.fulfill(initialList);

View File

@@ -16,7 +16,6 @@
*/
import Util = require('../../../util/util');
import TestConfig = require('../../../test.config');
export class AttachFormPage {

View File

@@ -17,6 +17,7 @@
var Util = require('../../../util/util');
var TestConfig = require('../../../test.config');
var NavigationBarPage = require('../navigationBarPage');
var ProcessListPage = function () {
@@ -30,7 +31,8 @@ var ProcessListPage = function () {
var startProcessButton = element(by.css('button[data-automation-id="btn-start"]'));
this.goToProcessList = function () {
browser.driver.get(processListURL);
var navigationBarPage = new NavigationBarPage();
navigationBarPage.clickProcessServicesButton();
Util.waitUntilElementIsVisible(pageLoaded);
};
@@ -70,4 +72,4 @@ var ProcessListPage = function () {
};
};
module.exports = ProcessListPage;
module.exports = ProcessListPage;

View File

@@ -115,12 +115,12 @@ var SearchResultsPage = function () {
if(sortOrder===true) {
if(result !== 'arrow_upward') {
element(sortArrowLocator).click();
};
}
}
else {
if(result === 'arrow_upward') {
element(sortArrowLocator).click();
};
}
}
return Promise.resolve();

View File

@@ -38,12 +38,12 @@ export class VersionManagePage {
return this;
}
uploadNewVersionFile = function (fileLocation) {
uploadNewVersionFile(fileLocation) {
Util.waitUntilElementIsVisible(this.uploadNewVersionButton);
this.uploadNewVersionButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation)));
Util.waitUntilElementIsVisible(this.showNewVersionButton);
return this;
};
}
getFileVersionName(version) {
let fileElement = element(by.css(`[id="adf-version-list-item-name-${version}"]`));

View File

@@ -25,7 +25,6 @@ import CONSTANTS = require('../util/constants');
import TestConfig = require('../test.config');
import resources = require('../util/resources');
import Util = require('../util/util.js');
import AlfrescoApi = require('alfresco-js-api-node');
import { UsersActions } from '../actions/users.actions';

View File

@@ -435,7 +435,7 @@ exports.waitUntilElementIsNotOnPage = function (elementToCheck, timeout) {
};
exports.waitUntilElementIsOnPage = function (elementToCheck, timeout) {
waitTimeout = timeout || DEFAULT_TIMEOUT;
var waitTimeout = timeout || DEFAULT_TIMEOUT;
return browser.wait(browser.wait(until.visibilityOf(elementToCheck)), timeout);
};