mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
* library dialog * integrate with demo shell * update resources * fix license * auto focus for the first input * update e2e tests * try close the dialog between tests * fix afterEach * Revert "try close the dialog between tests" This reverts commit 63464f2b03c226c606d09b18c7d2782e3bb52c0a. * update code due to css lint issues * csslint settings for vs code * missing import lint fix remove not used import convert errorPage js to ts convert tasklistpage js to ts fix redirection creation folder in root fix lint issue fix e2e * e2e fix * fix PS tests * navigation import * fix tests tooltip convert paginapage to ts * fix lint * fix lock files e2e filterspage to ts * fix lint * fix cs cre git dept 3 and not 50 as default in travis * quiet log git download * add some delay and change the delete lock * fix node entry * convert searchDialog to typescript parallel protractor * disable browser execute * restote test * change search tests * move search in a separate e2e folder * experiment fix e2e * change util presence change protractor conf * fix unshare test * improve query viewerPage using css over xpath * waitForAngularEnabled before browser redirect * convert util to ts and more * convert other files to ts * convert to ts other files * trigger build * function fixes use arrow function * process service fixes * lint fix review timeout default * fix failing tests * restore timeout * share dialog fix * remove * use configuration admin * fix APS 2 login sso
316 lines
12 KiB
TypeScript
316 lines
12 KiB
TypeScript
/*!
|
|
* @license
|
|
* Copyright 2016 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 { element, by } from 'protractor';
|
|
|
|
import { LoginPage } from '../../pages/adf/loginPage';
|
|
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
|
|
import { MetadataViewPage } from '../../pages/adf/metadataViewPage';
|
|
|
|
import TestConfig = require('../../test.config');
|
|
import resources = require('../../util/resources');
|
|
import AlfrescoApi = require('alfresco-js-api-node');
|
|
import { UsersActions } from '../../actions/users.actions';
|
|
import { AppsActions } from '../../actions/APS/apps.actions';
|
|
import { CardViewComponentPage } from '../../pages/adf/cardViewComponentPage';
|
|
import { Util } from '../../util/util';
|
|
|
|
describe('CardView Component', () => {
|
|
const loginPage = new LoginPage();
|
|
const navigationBarPage = new NavigationBarPage();
|
|
const cardViewPageComponent = new CardViewComponentPage();
|
|
const metadataViewPage = new MetadataViewPage();
|
|
|
|
const app = resources.Files.APP_WITH_PROCESSES;
|
|
|
|
beforeAll(async (done) => {
|
|
const apps = new AppsActions();
|
|
const users = new UsersActions();
|
|
|
|
this.alfrescoJsApi = new AlfrescoApi({
|
|
provider: 'BPM',
|
|
hostBpm: TestConfig.adf.url
|
|
});
|
|
|
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
|
|
|
let user = await users.createTenantAndUser(this.alfrescoJsApi);
|
|
|
|
await this.alfrescoJsApi.login(user.email, user.password);
|
|
|
|
await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
|
|
|
|
loginPage.loginToProcessServicesUsingUserModel(user);
|
|
|
|
navigationBarPage.clickCardViewButton();
|
|
|
|
done();
|
|
});
|
|
|
|
afterEach(() => {
|
|
cardViewPageComponent.clickOnResetButton();
|
|
});
|
|
|
|
describe('key-value pair ', () => {
|
|
|
|
it('[C279938] Should the label be present', () => {
|
|
let label = element(by.css('div[data-automation-id="card-key-value-pairs-label-key-value-pairs"]'));
|
|
|
|
Util.waitUntilElementIsPresent(label);
|
|
});
|
|
|
|
it('[C279898] Should be possible edit key-value pair properties', () => {
|
|
cardViewPageComponent.clickOnAddButton();
|
|
cardViewPageComponent.setName('testName');
|
|
cardViewPageComponent.setValue('testValue');
|
|
cardViewPageComponent.clickOnAddButton();
|
|
cardViewPageComponent.waitForOutput();
|
|
expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Key-Value Pairs Item] - [{"name":"testName","value":"testValue"}]');
|
|
|
|
cardViewPageComponent.deletePairsValues();
|
|
|
|
expect(cardViewPageComponent.getOutputText(1)).toBe('[CardView Key-Value Pairs Item] - []');
|
|
});
|
|
});
|
|
|
|
describe('SelectBox', () => {
|
|
|
|
it('[C279939] Should the label be present', () => {
|
|
let label = element(by.css('div[data-automation-id="card-select-label-select"]'));
|
|
|
|
Util.waitUntilElementIsPresent(label);
|
|
});
|
|
|
|
it('[C279899] Should be possible edit selectBox item', () => {
|
|
cardViewPageComponent.clickSelectBox();
|
|
cardViewPageComponent.selectValueFromComboBox(1);
|
|
|
|
expect(cardViewPageComponent.getOutputText(0))
|
|
.toBe('[CardView Select Item] - two');
|
|
});
|
|
});
|
|
|
|
describe('Text', () => {
|
|
|
|
it('[C279937] Should the label be present', () => {
|
|
let label = element(by.css('div[data-automation-id="card-textitem-label-name"]'));
|
|
|
|
Util.waitUntilElementIsPresent(label);
|
|
});
|
|
|
|
it('[C279943] Should be present a default value', () => {
|
|
expect(cardViewPageComponent.getTextFieldText()).toBe('Spock');
|
|
});
|
|
|
|
it('[C279934] Should be possible edit text item', () => {
|
|
cardViewPageComponent
|
|
.clickOnTextField()
|
|
.enterTextField('example')
|
|
.clickOnTextSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Text Item] - example');
|
|
});
|
|
|
|
it('[C279944] Should be possible undo text item modify when click on the clear button', () => {
|
|
cardViewPageComponent
|
|
.clickOnTextField()
|
|
.enterTextField('example')
|
|
.clickOnTextClearIcon();
|
|
|
|
expect(cardViewPageComponent.getTextFieldText()).toBe('Spock');
|
|
});
|
|
});
|
|
|
|
describe('Int', () => {
|
|
|
|
it('[C279940] Should the label be present', () => {
|
|
let label = element(by.css('div[data-automation-id="card-textitem-label-int"]'));
|
|
|
|
Util.waitUntilElementIsPresent(label);
|
|
});
|
|
|
|
it('[C279945] Should be present a default value', () => {
|
|
expect(cardViewPageComponent.getIntFieldText()).toBe('213');
|
|
});
|
|
|
|
it('[C279946] Should be possible edit int item', () => {
|
|
cardViewPageComponent
|
|
.clickOnIntField()
|
|
.enterIntField('99999')
|
|
.clickOnIntSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Int Item] - 99999');
|
|
});
|
|
|
|
it('[C279947] Should not be possible add string value to the int item', () => {
|
|
cardViewPageComponent
|
|
.clickOnIntField()
|
|
.enterIntField('string value')
|
|
.clickOnIntSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getErrorInt()).toBe('Use an integer format');
|
|
});
|
|
|
|
it('[C279948] Should not be possible add float value to the int item', () => {
|
|
cardViewPageComponent
|
|
.clickOnIntField()
|
|
.enterIntField('0.22')
|
|
.clickOnIntSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getErrorInt()).toBe('Use an integer format');
|
|
});
|
|
|
|
it('[C279949] Should not be possible have an empty value', () => {
|
|
cardViewPageComponent
|
|
.clickOnIntField()
|
|
.enterIntField(' ')
|
|
.clickOnIntSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getErrorInt()).toBe('Use an integer format');
|
|
});
|
|
|
|
it('[C279950] Should return an error when the value is > 2147483647', () => {
|
|
cardViewPageComponent
|
|
.clickOnIntField()
|
|
.enterIntField('214748367')
|
|
.clickOnIntSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Int Item] - 214748367');
|
|
|
|
cardViewPageComponent
|
|
.clickOnIntField()
|
|
.enterIntField('2147483648')
|
|
.clickOnIntSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getErrorInt()).toBe('Use an integer format');
|
|
});
|
|
|
|
it('[C279951] Should be possible undo item modify when click on the clear button', () => {
|
|
cardViewPageComponent
|
|
.clickOnIntField()
|
|
.enterIntField('999')
|
|
.clickOnIntClearIcon();
|
|
|
|
expect(cardViewPageComponent.getIntFieldText()).toBe('213');
|
|
});
|
|
});
|
|
|
|
describe('Float', () => {
|
|
|
|
it('[C279941] Should the label be present', () => {
|
|
let label = element(by.css('div[data-automation-id="card-textitem-label-float"]'));
|
|
|
|
Util.waitUntilElementIsPresent(label);
|
|
});
|
|
|
|
it('[C279952] Should be present a default value', () => {
|
|
expect(cardViewPageComponent.getFloatFieldText()).toBe('9.9');
|
|
});
|
|
|
|
it('[C279953] Should be possible edit float item', () => {
|
|
cardViewPageComponent
|
|
.clickOnFloatField()
|
|
.enterFloatField('77.33')
|
|
.clickOnFloatSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Float Item] - 77.33');
|
|
});
|
|
|
|
it('[C279954] Should not be possible add string value to the float item', () => {
|
|
cardViewPageComponent
|
|
.clickOnFloatField()
|
|
.enterFloatField('string value')
|
|
.clickOnFloatSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getErrorFloat()).toBe('Use a number format');
|
|
});
|
|
|
|
it('[C279955] Should be possible undo item item modify when click on the clear button', () => {
|
|
cardViewPageComponent
|
|
.clickOnFloatField()
|
|
.enterFloatField('77.33')
|
|
.clickOnFloatClearIcon();
|
|
|
|
expect(cardViewPageComponent.getFloatFieldText()).toBe('9.9');
|
|
});
|
|
|
|
it('[C279956] Should not be possible have an empty value', () => {
|
|
cardViewPageComponent
|
|
.clickOnFloatField()
|
|
.enterFloatField(' ')
|
|
.clickOnFloatSaveIcon();
|
|
|
|
expect(cardViewPageComponent.getErrorFloat()).toBe('Use a number format');
|
|
});
|
|
|
|
});
|
|
|
|
describe('Boolean', () => {
|
|
|
|
it('[C279942] Should the label be present', () => {
|
|
let label = element(by.css('div[data-automation-id="card-boolean-label-boolean"]'));
|
|
|
|
Util.waitUntilElementIsPresent(label);
|
|
});
|
|
|
|
it('[C279957] Should be possible edit the checkbox value when click on it', () => {
|
|
cardViewPageComponent.checkboxClick();
|
|
|
|
expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Boolean Item] - false');
|
|
|
|
cardViewPageComponent.checkboxClick();
|
|
|
|
expect(cardViewPageComponent.getOutputText(1)).toBe('[CardView Boolean Item] - true');
|
|
});
|
|
});
|
|
|
|
describe('Date and DateTime', () => {
|
|
|
|
it('[C279961] Should the label be present', () => {
|
|
let labelDate = element(by.css('div[data-automation-id="card-dateitem-label-date"]'));
|
|
|
|
Util.waitUntilElementIsPresent(labelDate);
|
|
|
|
let labelDatetime = element(by.css('div[data-automation-id="card-dateitem-label-datetime"]'));
|
|
|
|
Util.waitUntilElementIsPresent(labelDatetime);
|
|
});
|
|
|
|
it('[C279962] Should be present a default value', () => {
|
|
expect(metadataViewPage.getPropertyText('date', 'date')).toEqual('24.12.1983');
|
|
expect(metadataViewPage.getPropertyText('datetime', 'datetime')).toEqual('Dec 24 1983 10:00');
|
|
});
|
|
|
|
});
|
|
|
|
it('[C279936] Should not be possible edit any parameter when editable property is false', () => {
|
|
cardViewPageComponent.disableEdit();
|
|
|
|
let editIconText = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-name"]'));
|
|
let editIconInt = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-int"]'));
|
|
let editIconFloat = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-float"]'));
|
|
let editIconKey = element(by.css('mat-icon[data-automation-id="card-key-value-pairs-button-key-value-pairs"]'));
|
|
let editIconData = element(by.css('mat-datetimepicker-toggle'));
|
|
|
|
Util.waitUntilElementIsNotVisible(editIconText);
|
|
Util.waitUntilElementIsNotVisible(editIconInt);
|
|
Util.waitUntilElementIsNotVisible(editIconFloat);
|
|
Util.waitUntilElementIsNotVisible(editIconKey);
|
|
Util.waitUntilElementIsNotVisible(editIconData);
|
|
});
|
|
});
|