mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
ESLint: cleanup await expect from protractor tests (#9630)
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createApiService,
|
||||
import {
|
||||
createApiService,
|
||||
BrowserActions,
|
||||
LoginPage,
|
||||
ModelActions,
|
||||
@@ -46,7 +47,7 @@ describe('content type', () => {
|
||||
const loginPage = new LoginPage();
|
||||
const randomString = StringUtil.generateRandomString();
|
||||
|
||||
const model: CustomModel = {
|
||||
const model: CustomModel = {
|
||||
name: `test-${randomString}`,
|
||||
namespaceUri: `http://www.customModel.com/model/${randomString}/1.0`,
|
||||
namespacePrefix: `e2e-${randomString}`,
|
||||
@@ -55,7 +56,12 @@ describe('content type', () => {
|
||||
status: 'DRAFT'
|
||||
};
|
||||
const type: CustomType = { name: `test-type-${randomString}`, parentName: 'cm:content', title: `Test type - ${randomString}` };
|
||||
const property = { name: `test-property-${randomString}`, title: `Test property - ${randomString}`, dataType: 'd:text', defaultValue: randomString };
|
||||
const property = {
|
||||
name: `test-property-${randomString}`,
|
||||
title: `Test property - ${randomString}`,
|
||||
dataType: 'd:text',
|
||||
defaultValue: randomString
|
||||
};
|
||||
const pdfFile = new FileModel({ name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name });
|
||||
const docxFileModel = new FileModel({
|
||||
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
|
||||
@@ -63,12 +69,12 @@ describe('content type', () => {
|
||||
});
|
||||
let acsUser: UserModel;
|
||||
|
||||
beforeAll( async () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await apiService.loginWithProfile('admin');
|
||||
await modelActions.createModel(model);
|
||||
await modelActions.createType(model.name, type);
|
||||
await modelActions.addPropertyToType(model.name, type.name, [property]);
|
||||
await modelActions.createType(model.name, type);
|
||||
await modelActions.addPropertyToType(model.name, type.name, [property]);
|
||||
await modelActions.activateCustomModel(model.name);
|
||||
await modelActions.isCustomTypeSearchable(type.title);
|
||||
|
||||
@@ -79,7 +85,6 @@ describe('content type', () => {
|
||||
pdfFile.id = filePdfNode.entry.id;
|
||||
const docsNode = await uploadActions.uploadFile(docxFileModel.location, docxFileModel.name, '-my-');
|
||||
docxFileModel.id = docsNode.entry.id;
|
||||
|
||||
} catch (e) {
|
||||
fail('Failed to setup custom types :: ' + JSON.stringify(e, null, 2));
|
||||
}
|
||||
@@ -98,17 +103,17 @@ describe('content type', () => {
|
||||
}
|
||||
});
|
||||
|
||||
beforeEach( async () => {
|
||||
beforeEach(async () => {
|
||||
await loginPage.login(acsUser.username, acsUser.password);
|
||||
await navigationBarPage.navigateToContentServices();
|
||||
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
|
||||
});
|
||||
|
||||
afterEach( async () => {
|
||||
afterEach(async () => {
|
||||
await navigationBarPage.clickLogoutButton();
|
||||
});
|
||||
|
||||
it('[C593560] Should the user be able to select a new content type and save it only after the confirmation dialog', async () => {
|
||||
it('[C593560] Should the user be able to select a new content type and save it only after the confirmation dialog', async () => {
|
||||
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${pdfFile.id}/view)`);
|
||||
await viewerPage.checkFileIsLoaded(pdfFile.name);
|
||||
await viewerPage.clickInfoButton();
|
||||
@@ -116,19 +121,20 @@ describe('content type', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.isEditGeneralIconDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
const defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
|
||||
await expect(defaultType).toBe(true, 'Content type not found');
|
||||
expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
const defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
|
||||
expect(defaultType).toBe(true);
|
||||
|
||||
await metadataViewPage.clickEditIconGeneral();
|
||||
|
||||
await expect(await metadataViewPage.changeContentType(type.title)).toBe(true, 'Failed to update node type.');
|
||||
expect(await metadataViewPage.changeContentType(type.title)).toBe(true, 'Failed to update node type.');
|
||||
await metadataViewPage.clickSaveGeneralMetadata();
|
||||
await metadataViewPage.checkConfirmDialogDisplayed();
|
||||
await metadataViewPage.applyNodeProperties();
|
||||
|
||||
await expect(await metadataViewPage.checkPropertyDisplayed(`properties.${model.namespacePrefix}:${property.name}`))
|
||||
.toContain(property.defaultValue, 'Custom property not found');
|
||||
expect(await metadataViewPage.checkPropertyDisplayed(`properties.${model.namespacePrefix}:${property.name}`)).toContain(
|
||||
property.defaultValue
|
||||
);
|
||||
|
||||
await navigationBarPage.clickLogoutButton();
|
||||
await loginPage.login(acsUser.username, acsUser.password);
|
||||
@@ -141,15 +147,16 @@ describe('content type', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.isEditGeneralIconDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
const customType = (await metadataViewPage.hasContentType(type.title)) || (await metadataViewPage.hasContentType(`${model.namespacePrefix}:${type.name}`));
|
||||
await expect(customType).toBe(true, 'Custom type not found');
|
||||
await expect(await metadataViewPage.getPropertyText(`properties.${model.namespacePrefix}:${property.name}`)).toContain(property.defaultValue);
|
||||
expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
const customType =
|
||||
(await metadataViewPage.hasContentType(type.title)) || (await metadataViewPage.hasContentType(`${model.namespacePrefix}:${type.name}`));
|
||||
expect(customType).toBe(true);
|
||||
expect(await metadataViewPage.getPropertyText(`properties.${model.namespacePrefix}:${property.name}`)).toContain(property.defaultValue);
|
||||
|
||||
await viewerPage.clickCloseButton();
|
||||
});
|
||||
|
||||
it('[C593559] Should the user be able to select a new content type and not save it when press cancel in the confirmation dialog', async () => {
|
||||
it('[C593559] Should the user be able to select a new content type and not save it when press cancel in the confirmation dialog', async () => {
|
||||
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${docxFileModel.id}/view)`);
|
||||
await viewerPage.checkFileIsLoaded(docxFileModel.name);
|
||||
await viewerPage.clickInfoButton();
|
||||
@@ -157,13 +164,13 @@ describe('content type', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.isEditGeneralIconDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
let defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
|
||||
await expect(defaultType).toBe(true, 'Content type not found');
|
||||
expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
let defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
|
||||
expect(defaultType).toBe(true);
|
||||
|
||||
await metadataViewPage.clickEditIconGeneral();
|
||||
|
||||
await expect(await metadataViewPage.changeContentType(type.title)).toBe(true, 'Failed to update node type.');
|
||||
expect(await metadataViewPage.changeContentType(type.title)).toBe(true);
|
||||
await metadataViewPage.clickSaveGeneralMetadata();
|
||||
|
||||
await metadataViewPage.checkConfirmDialogDisplayed();
|
||||
@@ -180,9 +187,9 @@ describe('content type', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.isEditGeneralIconDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
|
||||
await expect(defaultType).toBe(true, 'Content type not found');
|
||||
expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
|
||||
expect(defaultType).toBe(true);
|
||||
await viewerPage.clickCloseButton();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ describe('permissions', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.editIconIsDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
|
||||
await metadataViewPage.clickMetadataGroup('EXIF');
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('permissions', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.editIconIsDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
expect(await viewerPage.getActiveTab()).toEqual('Properties');
|
||||
|
||||
await metadataViewPage.clickMetadataGroup('EXIF');
|
||||
|
||||
|
||||
@@ -15,14 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createApiService,
|
||||
CheckboxPage,
|
||||
LoginPage,
|
||||
UploadActions,
|
||||
UserModel,
|
||||
UsersActions,
|
||||
ViewerPage
|
||||
} from '@alfresco/adf-testing';
|
||||
import { createApiService, CheckboxPage, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
|
||||
import { MetadataViewPage } from '../../core/pages/metadata-view.page';
|
||||
import { FileModel } from '../../models/ACS/file.model';
|
||||
import { browser } from 'protractor';
|
||||
@@ -30,7 +23,6 @@ import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
|
||||
import { ContentServicesPage } from '../../core/pages/content-services.page';
|
||||
|
||||
describe('CardView Component - properties', () => {
|
||||
|
||||
const METADATA = {
|
||||
DATA_FORMAT: 'mmm dd yyyy',
|
||||
TITLE: 'Details',
|
||||
@@ -71,7 +63,7 @@ describe('CardView Component - properties', () => {
|
||||
|
||||
await navigationBarPage.navigateToContentServices();
|
||||
await contentServicesPage.waitForTableBody();
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await viewerPage.clickCloseButton();
|
||||
@@ -84,8 +76,7 @@ describe('CardView Component - properties', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.editIconIsDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
|
||||
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
|
||||
await metadataViewPage.clickMetadataGroup('EXIF');
|
||||
|
||||
@@ -114,7 +105,6 @@ describe('CardView Component - properties', () => {
|
||||
await viewerPage.checkInfoSideBarIsDisplayed();
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
|
||||
|
||||
await metadataViewPage.checkMetadataGroupIsExpand('properties');
|
||||
await metadataViewPage.checkMetadataGroupIsNotExpand('EXIF');
|
||||
|
||||
@@ -129,7 +119,7 @@ describe('CardView Component - properties', () => {
|
||||
|
||||
await metadataViewPage.checkMetadataGroupIsExpand('EXIF');
|
||||
await metadataViewPage.checkMetadataGroupIsExpand('properties');
|
||||
});
|
||||
});
|
||||
|
||||
it('[C280559] Should show/hide the default metadata properties when displayDefaultProperties is true/false', async () => {
|
||||
await viewerPage.viewFile(pngFileModel.name);
|
||||
|
||||
@@ -134,9 +134,9 @@ describe('Metadata component', () => {
|
||||
await viewerPage.checkInfoSideBarIsNotDisplayed();
|
||||
await viewerPage.clickInfoButton();
|
||||
await viewerPage.checkInfoSideBarIsDisplayed();
|
||||
await expect(await viewerPage.getActiveTab()).toEqual(METADATA.COMMENTS_TAB);
|
||||
expect(await viewerPage.getActiveTab()).toEqual(METADATA.COMMENTS_TAB);
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
});
|
||||
|
||||
it('[C245654] Should be possible edit the basic Metadata Info of a Document', async () => {
|
||||
@@ -145,15 +145,13 @@ describe('Metadata component', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.isEditGeneralIconDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
|
||||
await metadataViewPage.clickEditIconGeneral();
|
||||
|
||||
await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText');
|
||||
await metadataViewPage.clickResetMetadata();
|
||||
await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(
|
||||
browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name
|
||||
);
|
||||
expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
|
||||
|
||||
await metadataViewPage.clickEditIconGeneral();
|
||||
await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText.png');
|
||||
@@ -161,9 +159,9 @@ describe('Metadata component', () => {
|
||||
await metadataViewPage.enterDescriptionText('example description');
|
||||
await metadataViewPage.clickSaveGeneralMetadata();
|
||||
|
||||
await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('exampleText.png');
|
||||
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title');
|
||||
await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description');
|
||||
expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('exampleText.png');
|
||||
expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title');
|
||||
expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description');
|
||||
|
||||
await viewerPage.clickCloseButton();
|
||||
await contentServicesPage.waitForTableBody();
|
||||
@@ -174,14 +172,12 @@ describe('Metadata component', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.isEditGeneralIconDisplayed();
|
||||
|
||||
await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('exampleText.png');
|
||||
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title');
|
||||
expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('exampleText.png');
|
||||
expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title');
|
||||
|
||||
await metadataViewPage.clickEditIconGeneral();
|
||||
await metadataViewPage.enterPropertyText('properties.cm:name', browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
|
||||
await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(
|
||||
browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name
|
||||
);
|
||||
expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
|
||||
await metadataViewPage.clickSaveGeneralMetadata();
|
||||
});
|
||||
|
||||
@@ -190,7 +186,7 @@ describe('Metadata component', () => {
|
||||
await viewerPage.checkInfoSideBarIsDisplayed();
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
await metadataViewPage.clickMetadataGroupEditIcon('EXIF');
|
||||
|
||||
await metadataViewPage.enterPropertyText('properties.exif:software', 'test custom text software');
|
||||
@@ -198,9 +194,9 @@ describe('Metadata component', () => {
|
||||
await metadataViewPage.enterPropertyText('properties.exif:fNumber', 22);
|
||||
await metadataViewPage.clickSaveMetadata();
|
||||
|
||||
await expect(await metadataViewPage.getPropertyText('properties.exif:isoSpeedRatings')).toEqual('test custom text isoSpeedRatings');
|
||||
await expect(await metadataViewPage.getPropertyText('properties.exif:software')).toEqual('test custom text software');
|
||||
await expect(await metadataViewPage.getPropertyText('properties.exif:fNumber')).toEqual('22');
|
||||
expect(await metadataViewPage.getPropertyText('properties.exif:isoSpeedRatings')).toEqual('test custom text isoSpeedRatings');
|
||||
expect(await metadataViewPage.getPropertyText('properties.exif:software')).toEqual('test custom text software');
|
||||
expect(await metadataViewPage.getPropertyText('properties.exif:fNumber')).toEqual('22');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -214,13 +210,13 @@ describe('Metadata component', () => {
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
await metadataViewPage.isEditGeneralIconDisplayed();
|
||||
|
||||
await expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
|
||||
|
||||
await metadataViewPage.clickEditIconGeneral();
|
||||
|
||||
await metadataViewPage.enterDescriptionText('check author example description');
|
||||
await metadataViewPage.clickSaveGeneralMetadata();
|
||||
await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('check author example description');
|
||||
expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('check author example description');
|
||||
|
||||
await navigationBarPage.clickLogoutButton();
|
||||
await loginPage.login(acsUser.username, acsUser.password);
|
||||
@@ -233,7 +229,7 @@ describe('Metadata component', () => {
|
||||
await viewerPage.checkInfoSideBarIsDisplayed();
|
||||
await metadataViewPage.clickOnPropertiesTab();
|
||||
|
||||
await expect(await metadataViewPage.getPropertyText('modifiedByUser.displayName')).toEqual('Administrator');
|
||||
expect(await metadataViewPage.getPropertyText('modifiedByUser.displayName')).toEqual('Administrator');
|
||||
|
||||
await viewerPage.clickCloseButton();
|
||||
await contentServicesPage.waitForTableBody();
|
||||
|
||||
Reference in New Issue
Block a user