Skip to content

Commit

Permalink
[ACS-6140] reduce access to internal material classes (#9053)
Browse files Browse the repository at this point in the history
* cleanup login (demo shell)

* cleanup e2e from useless calls

* [ci:force] cleanup e2e from useless calls

* [ci:force] cleanup e2e from useless calls

* [ci:force] improved uploader selectors

* [ci:force] remove useless selectors when automation id provided

* [ci:force] improved tests and selectors

* [ci:force] improved tests and selectors

* [ci:force] improved tests and selectors

* [ci:force] improved tests and selectors

* [ci:force] improved tests and selectors

* [ci:force] improved tests and selectors

* [ci:force] switch edit task filter to angular harness

* [ci:force] switch edit process filter to angular harness

* [ci:force] switch search chip list to angular harness

* [ci:force] switch search panel to angular harness

* [ci:force] switch search radio to angular harness

* [ci:force] switch search text to angular harness

* [ci:force] search logical filter

* [ci:force] search form component

* [ci:force] search filter container

* [ci:force] fix viewer test

* [ci:force] search facet chip harness

* [ci:force] search facet chip harness

* [ci:force] dropdown breadcrumb

* [ci:force] search check list

* [ci:force] folder dialog

* [ci:force] search filter component

* [ci:force] json cell

* [ci:force] amount widget

* [ci:force] checkbox widget

* [ci:force] multiline-text widget

* [ci:force] number widget

* [ci:force] text widget

* [ci:force] card view array item

* add permission dialog

* permission container component

* permission list component

* card view components

* search widget chip

* search facet chip

* edit service task filter

* card view components

* sites dropdown

* share dialog

* header component

* datetime widget

* remove comments
  • Loading branch information
DenysVuika committed Nov 3, 2023
1 parent 9278d92 commit 93fd0be
Show file tree
Hide file tree
Showing 62 changed files with 2,331 additions and 2,656 deletions.
2 changes: 1 addition & 1 deletion demo-shell/src/app/components/login/login.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a mat-fab class="app-setting-button" data-automation-id="settings" href="" routerLink="/settings">
<a class="app-setting-button" data-automation-id="settings" href="" routerLink="/settings">
<mat-icon>settings</mat-icon>
</a>

Expand Down
3 changes: 2 additions & 1 deletion demo-shell/src/app/components/login/login.component.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.app-setting-button.mat-fab {
.app-setting-button {
position: absolute;
right: 10px;
top: 10px;
z-index: 1;
color: white;
}
4 changes: 0 additions & 4 deletions e2e/content-services/upload/uploader-component.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ describe('Upload component', () => {

it('[C260172] Should be possible to enable versioning', async () => {
await uploadToggles.enableVersioning();
await uploadToggles.checkVersioningToggleIsEnabled();

await contentServicesPage.uploadFile(pdfFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
Expand All @@ -164,7 +163,6 @@ describe('Upload component', () => {
await contentServicesPage.goToDocumentList();

await uploadToggles.enableMaxSize();
await uploadToggles.checkMaxSizeToggleIsEnabled();
await uploadToggles.addMaxSize('400');

await contentServicesPage.uploadFile(fileWithSpecificSize.location);
Expand All @@ -190,7 +188,6 @@ describe('Upload component', () => {
it('[C272796] Should be possible to set max size to 0', async () => {
await contentServicesPage.goToDocumentList();
await uploadToggles.enableMaxSize();
await uploadToggles.checkMaxSizeToggleIsEnabled();
await uploadToggles.addMaxSize('0');
await contentServicesPage.uploadFile(fileWithSpecificSize.location);
// await expect(await contentServicesPage.getErrorMessage()).toEqual('File ' + fileWithSpecificSize.name + ' is larger than the allowed file size');
Expand All @@ -207,7 +204,6 @@ describe('Upload component', () => {

it('[C272797] Should be possible to set max size to 1', async () => {
await uploadToggles.enableMaxSize();
await uploadToggles.checkMaxSizeToggleIsEnabled();
await browser.sleep(1000);
await uploadToggles.addMaxSize('1');
await uploadToggles.disableMaxSize();
Expand Down
14 changes: 6 additions & 8 deletions e2e/core/pages/dialog/upload-dialog.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,19 @@ import { by, browser, ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';

export class UploadDialogPage {

closeButton = $('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]');
closeButton = $('#adf-upload-dialog-close');
dialog = $('div[id="upload-dialog"]');
minimizedDialog = $('div[class*="upload-dialog--minimized"]');
uploadedStatusIcon = 'mat-icon[class*="status--done"]';
uploadedStatusIcon = '.adf-file-uploading-row__status--done';
cancelledStatusIcon = 'div[class*="status--cancelled"]';
errorStatusIcon = 'div[class*="status--error"] mat-icon';
rowByRowName = by.xpath('ancestor::adf-file-uploading-list-row');
title = $('span[class*="upload-dialog__title"]');
minimizeButton = $('mat-icon[title="Minimize"]');
maximizeButton = $('mat-icon[title="Maximize"]');
toggleMinimizeButton = $(`[data-automation-id='adf-upload-dialog__toggle-minimize']`);

async clickOnCloseButton(): Promise<void> {
await this.checkCloseButtonIsDisplayed();
await BrowserActions.clickExecuteScript('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]');
await BrowserActions.click(this.closeButton);
}

async checkCloseButtonIsDisplayed(): Promise<void> {
Expand Down Expand Up @@ -107,11 +105,11 @@ export class UploadDialogPage {
}

async minimizeUploadDialog(): Promise<void> {
await BrowserActions.click(this.minimizeButton);
await BrowserActions.click(this.toggleMinimizeButton);
}

async maximizeUploadDialog(): Promise<void> {
await BrowserActions.click(this.maximizeButton);
await BrowserActions.click(this.toggleMinimizeButton);
}

async displayTooltip(): Promise<void> {
Expand Down
20 changes: 3 additions & 17 deletions e2e/core/pages/dialog/upload-toggles.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { $, browser } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions, BrowserVisibility, TogglePage } from '@alfresco/adf-testing';

export class UploadTogglesPage {
Expand All @@ -25,40 +25,26 @@ export class UploadTogglesPage {
extensionFilterToggle = $('#adf-extension-filter-upload-switch');
maxSizeToggle = $('#adf-max-size-filter-upload-switch');
versioningToggle = $('#adf-version-upload-switch');
extensionAcceptedField = $('input[data-automation-id="accepted-files-type"]');
maxSizeField = $('input[data-automation-id="max-files-size"]');
extensionAcceptedField = $('[data-automation-id="accepted-files-type"]');
maxSizeField = $('[data-automation-id="max-files-size"]');

async enableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.togglePage.enableToggle(this.multipleFileUploadToggle);
}

async disableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.togglePage.disableToggle(this.multipleFileUploadToggle);
}

async enableFolderUpload(): Promise<void> {
await this.togglePage.enableToggle(this.uploadFolderToggle);
}

async checkMaxSizeToggleIsEnabled(): Promise<void> {
const enabledToggle = $('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]');
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}

async checkVersioningToggleIsEnabled(): Promise<void> {
const enabledToggle = $('mat-slide-toggle[id="adf-version-upload-switch"][class*="mat-checked"]');
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}

async enableExtensionFilter(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.extensionFilterToggle);
await this.togglePage.enableToggle(this.extensionFilterToggle);
}

async disableExtensionFilter(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.extensionFilterToggle);
await this.togglePage.disableToggle(this.extensionFilterToggle);
}

Expand Down
4 changes: 2 additions & 2 deletions e2e/core/pages/metadata-view.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export class MetadataViewPage {
resetMetadataButton = $(`[data-automation-id='reset-metadata']`);

private getMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> =>
$(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"]`);
$(`[data-automation-id="adf-metadata-group-${groupName}"]`);
private getExpandedMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> =>
$(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"] > mat-expansion-panel-header`);
$(`[data-automation-id="adf-metadata-group-${groupName}"] > mat-expansion-panel-header`);

async getTitle(): Promise<string> {
return BrowserActions.getText(this.title);
Expand Down
2 changes: 1 addition & 1 deletion e2e/process-services/pages/task-details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class TaskDetailsPage {
}

async checkDueDatePickerButtonIsNotDisplayed(): Promise<void> {
const dueDatePickerButton = $('mat-datetimepicker-toggle[data-automation-id="datepickertoggle-dueDate"]');
const dueDatePickerButton = $('[data-automation-id="datepickertoggle-dueDate"]');
await BrowserVisibility.waitUntilElementIsNotVisible(dueDatePickerButton);
}

Expand Down
3 changes: 1 addition & 2 deletions e2e/search/pages/search-bar.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { ElementFinder, protractor, $ } from 'protractor';
import { BrowserVisibility, BrowserActions, TestElement } from '@alfresco/adf-testing';

export class SearchBarPage {

searchIcon = $(`button[class*='adf-search-button']`);
searchBar = $(`adf-search-control input`);
searchBarExpanded: TestElement = TestElement.byCss(`adf-search-control mat-form-field[class*="mat-focused"] input`);
Expand All @@ -29,7 +28,7 @@ export class SearchBarPage {
highlightName = `.adf-highlight`;
searchBarPage = $(`mat-list[id='autocomplete-search-result-list']`);

getRowByRowName = (name: string): ElementFinder => $(`mat-list-item[data-automation-id='autocomplete_for_${name}']`);
getRowByRowName = (name: string): ElementFinder => $(`[data-automation-id='autocomplete_for_${name}']`);

async clickOnSearchIcon(): Promise<void> {
await BrowserActions.click(this.searchIcon);
Expand Down
46 changes: 27 additions & 19 deletions e2e/search/pages/search-filters.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,38 @@
* limitations under the License.
*/

import { BrowserVisibility, DateRangeFilterPage, NumberRangeFilterPage, SearchCategoriesPage, SearchCheckListPage, SearchRadioPage, SearchSliderPage, SearchTextPage } from '@alfresco/adf-testing';
import {
BrowserVisibility,
DateRangeFilterPage,
NumberRangeFilterPage,
SearchCategoriesPage,
SearchCheckListPage,
SearchRadioPage,
SearchSliderPage,
SearchTextPage
} from '@alfresco/adf-testing';
import { $, by } from 'protractor';

export class SearchFiltersPage {

searchCategoriesPage: SearchCategoriesPage = new SearchCategoriesPage();

searchFilters = $('adf-search-filter');
fileTypeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]');
creatorFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FILTER.PEOPLE"]');
fileSizeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]');
nameFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Name"]');
checkListFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]');
createdDateRangeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Created Date (range)"]');
typeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Type"]');
sizeRangeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Content Size (range)"]');
sizeSliderFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Content Size"]');
facetQueriesDefaultGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' +
'mat-expansion-panel[data-automation-id="expansion-panel-My facet queries"]');
facetQueriesTypeGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-Type facet queries"]');
facetQueriesSizeGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-Size facet queries"]');
facetIntervalsByCreated = $('mat-expansion-panel[data-automation-id="expansion-panel-The Created"]');
facetIntervalsByModified = $('mat-expansion-panel[data-automation-id="expansion-panel-TheModified"]');
fileTypeFilter = $('[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]');
creatorFilter = $('[data-automation-id="expansion-panel-SEARCH.FILTER.PEOPLE"]');
fileSizeFilter = $('[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]');
nameFilter = $('[data-automation-id="expansion-panel-Name"]');
checkListFilter = $('[data-automation-id="expansion-panel-Check List"]');
createdDateRangeFilter = $('[data-automation-id="expansion-panel-Created Date (range)"]');
typeFilter = $('[data-automation-id="expansion-panel-Type"]');
sizeRangeFilter = $('[data-automation-id="expansion-panel-Content Size (range)"]');
sizeSliderFilter = $('[data-automation-id="expansion-panel-Content Size"]');
facetQueriesDefaultGroup = $(
'[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' + '[data-automation-id="expansion-panel-My facet queries"]'
);
facetQueriesTypeGroup = $('[data-automation-id="expansion-panel-Type facet queries"]');
facetQueriesSizeGroup = $('[data-automation-id="expansion-panel-Size facet queries"]');
facetIntervalsByCreated = $('[data-automation-id="expansion-panel-The Created"]');
facetIntervalsByModified = $('[data-automation-id="expansion-panel-TheModified"]');

async checkSearchFiltersIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchFilters);
Expand Down Expand Up @@ -72,7 +81,7 @@ export class SearchFiltersPage {
}

async checkCustomFacetFieldLabelIsDisplayed(fieldLabel: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible($(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`));
await BrowserVisibility.waitUntilElementIsVisible($(`[data-automation-id="expansion-panel-${fieldLabel}"]`));
}

sizeSliderFilterPage(): SearchSliderPage {
Expand Down Expand Up @@ -234,5 +243,4 @@ export class SearchFiltersPage {
async checkFileTypeFacetLabelIsNotDisplayed(fileType: string | RegExp): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ import { of } from 'rxjs';
import { TranslateModule } from '@ngx-translate/core';

describe('DropdownBreadcrumb', () => {

let component: DropdownBreadcrumbComponent;
let fixture: ComponentFixture<DropdownBreadcrumbComponent>;
let documentList: DocumentListComponent;
let documentListService: DocumentListService = jasmine.createSpyObj({ loadFolderByNodeId: of(''), isCustomSourceService: false });

beforeEach(() => {
TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
ContentTestingModule
],
imports: [TranslateModule.forRoot(), ContentTestingModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [{ provide: DocumentListService, useValue: documentListService }]
});
Expand All @@ -64,7 +60,7 @@ describe('DropdownBreadcrumb', () => {
};

const clickOnTheFirstOption = () => {
const option: any = document.querySelector('[id^="mat-option"]');
const option: any = document.querySelector(`[data-automation-class="dropdown-breadcrumb-path-option"]`);
option.click();
};

Expand All @@ -75,7 +71,6 @@ describe('DropdownBreadcrumb', () => {
triggerComponentChange(fakeNodeWithCreatePermissionInstance);

fixture.whenStable().then(() => {

openSelect();

const currentFolder = fixture.debugElement.query(By.css('[data-automation-id="current-folder"]'));
Expand All @@ -99,7 +94,6 @@ describe('DropdownBreadcrumb', () => {
triggerComponentChange(fakeNodeWithCreatePermissionInstance);

fixture.whenStable().then(() => {

openSelect();

const path = fixture.debugElement.query(By.css('[data-automation-id="dropdown-breadcrumb-path"]'));
Expand All @@ -110,7 +104,6 @@ describe('DropdownBreadcrumb', () => {
});
});


it('should update document list when clicking on an option', async () => {
component.target = documentList;
const fakeNodeWithCreatePermissionInstance = JSON.parse(JSON.stringify(fakeNodeWithCreatePermission));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,15 @@ describe('ContentMetadataComponent', () => {
it('should hide metadata fields if displayDefaultProperties is set to false', () => {
component.displayDefaultProperties = false;
fixture.detectChanges();
const metadataContainer = fixture.debugElement.query(By.css('mat-expansion-panel[data-automation-id="adf-metadata-group-properties"]'));
const metadataContainer = fixture.debugElement.query(By.css('[data-automation-id="adf-metadata-group-properties"]'));
fixture.detectChanges();
expect(metadataContainer).toBeNull();
});

it('should display metadata fields if displayDefaultProperties is set to true', () => {
component.displayDefaultProperties = true;
fixture.detectChanges();
const metadataContainer = fixture.debugElement.query(By.css('mat-expansion-panel[data-automation-id="adf-metadata-group-properties"]'));
const metadataContainer = fixture.debugElement.query(By.css('[data-automation-id="adf-metadata-group-properties"]'));
fixture.detectChanges();
expect(metadataContainer).toBeDefined();
});
Expand Down

0 comments on commit 93fd0be

Please sign in to comment.