alfresco-ng2-components/e2e/core/error-component.e2e.ts
gmandakini 4376d357ac [ADF-3962] sso download directive automated (#4452)
* sso download directive automated

* temp changes

* temp changes

* moving of services under lib testing and ADF-3962 automated

* removed the browser sleep

* cspell and linting fixes.

* codacy improvements

* export public-api update

* remove circular dep

* remove circular dep

* fixes

* fix user info test

* fix datatable

* random commit

* move other string

* fix lint

* fix lint

* fix prolem type

* fix failing test

* fix tag test

* fix problems after rebase

* fix lint

* remove space

* remove visibility method duplicated
2019-03-27 09:57:26 +00:00

78 lines
2.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed 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.
*/
import { LoginPage } from '../pages/adf/loginPage';
import { AcsUserModel } from '../models/ACS/acsUserModel';
import TestConfig = require('../test.config');
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { ErrorPage } from '../pages/adf/errorPage';
import { browser } from 'protractor';
describe('Error Component', () => {
const acsUser = new AcsUserModel();
const loginPage = new LoginPage();
const errorPage = new ErrorPage();
beforeAll(async (done) => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
it('[C277302] Should display the error 403 when access to unauthorized page - My Change', () => {
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.');
});
});