Re Enabling unit test removed

This commit is contained in:
Vito Albano 2024-04-09 16:13:11 +01:00 committed by VitoAlbano
parent d341e7f154
commit 42a02333bb
3 changed files with 26 additions and 21 deletions

View File

@ -124,7 +124,7 @@ describe('InfiniteScrollDatasource', () => {
}); });
// Disabling this test as it's flaky (fails 3 out of 4 on CI) // Disabling this test as it's flaky (fails 3 out of 4 on CI)
//eslint-disable-next-line //eslint-disable-next-line
xit('should load next batch when user scrolls towards the end of the list', fakeAsync(() => { it('should load next batch when user scrolls towards the end of the list', fakeAsync(() => {
fixture.autoDetectChanges(); fixture.autoDetectChanges();
const stable = fixture.whenStable(); const stable = fixture.whenStable();
const renderingDone = fixture.whenRenderingDone(); const renderingDone = fixture.whenRenderingDone();

View File

@ -25,6 +25,7 @@ import { MatMenuHarness } from '@angular/material/menu/testing';
import { HarnessLoader, TestKey } from '@angular/cdk/testing'; import { HarnessLoader, TestKey } from '@angular/cdk/testing';
import { MatButtonHarness } from '@angular/material/button/testing'; import { MatButtonHarness } from '@angular/material/button/testing';
import { MatIconHarness } from '@angular/material/icon/testing'; import { MatIconHarness } from '@angular/material/icon/testing';
import { MatChipOptionHarness } from '@angular/material/chips/testing';
describe('SearchFacetChipComponent', () => { describe('SearchFacetChipComponent', () => {
let loader: HarnessLoader; let loader: HarnessLoader;
@ -85,14 +86,15 @@ describe('SearchFacetChipComponent', () => {
const icon = await loader.getHarness(MatIconHarness); const icon = await loader.getHarness(MatIconHarness);
expect(await icon.getName()).toBe('keyboard_arrow_up'); expect(await icon.getName()).toBe('keyboard_arrow_up');
}); });
// This test is failing to get the disabled from the chip/menu even though the chip is correctly disabled
// eslint-disable-next-line it('should display remove icon and disable facet when no items are loaded', async () => {
xit('should display remove icon and disable facet when no items are loaded', async () => { const menu = await loader.getHarness(MatChipOptionHarness);
const menu = await loader.getHarness(MatMenuHarness); const disabled = await menu.isDisabled();
expect(await menu.isDisabled()).toBe(true); expect(disabled).toBe(true);
const icon = await loader.getHarness(MatIconHarness); const icon = await loader.getHarness(MatIconHarness);
expect(await icon.getName()).toBe('remove'); const iconName = await icon.getName();
expect(iconName).toBe('remove');
}); });
it('should not open context menu when no items are loaded', async () => { it('should not open context menu when no items are loaded', async () => {

View File

@ -33,7 +33,8 @@ import {
TranslationMock, TranslationMock,
TranslationService, TranslationService,
ViewUtilService, ViewUtilService,
ViewerComponent ViewerComponent,
ViewerSidebarComponent
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { NodesApiService } from '../../common/services/nodes-api.service'; import { NodesApiService } from '../../common/services/nodes-api.service';
import { UploadService } from '../../common/services/upload.service'; import { UploadService } from '../../common/services/upload.service';
@ -163,7 +164,8 @@ describe('AlfrescoViewerComponent', () => {
ViewerWithCustomSidebarComponent, ViewerWithCustomSidebarComponent,
ViewerWithCustomOpenWithComponent, ViewerWithCustomOpenWithComponent,
ViewerWithCustomMoreActionsComponent, ViewerWithCustomMoreActionsComponent,
ViewerWithCustomToolbarActionsComponent ViewerWithCustomToolbarActionsComponent,
ViewerSidebarComponent
], ],
providers: [ providers: [
ContentService, ContentService,
@ -389,8 +391,8 @@ describe('AlfrescoViewerComponent', () => {
done(); done();
}); });
}); });
// eslint-disable-next-line
xit('should stop propagation on sidebar keydown event [keydown]', fakeAsync(() => { it('should stop propagation on sidebar keydown event [keydown]', fakeAsync(() => {
const customFixture = TestBed.createComponent(ViewerWithCustomSidebarComponent); const customFixture = TestBed.createComponent(ViewerWithCustomSidebarComponent);
const customElement: HTMLElement = customFixture.nativeElement; const customElement: HTMLElement = customFixture.nativeElement;
const escapeKeyboardEvent = new KeyboardEvent('keydown', { key: ESCAPE.toString() }); const escapeKeyboardEvent = new KeyboardEvent('keydown', { key: ESCAPE.toString() });
@ -403,8 +405,8 @@ describe('AlfrescoViewerComponent', () => {
expect(stopPropagationSpy).toHaveBeenCalled(); expect(stopPropagationSpy).toHaveBeenCalled();
})); }));
// eslint-disable-next-line
xit('should stop propagation on sidebar keyup event [keyup]', fakeAsync(() => { it('should stop propagation on sidebar keyup event [keyup]', fakeAsync(() => {
const customFixture = TestBed.createComponent(ViewerWithCustomSidebarComponent); const customFixture = TestBed.createComponent(ViewerWithCustomSidebarComponent);
const customElement: HTMLElement = customFixture.nativeElement; const customElement: HTMLElement = customFixture.nativeElement;
const escapeKeyboardEvent = new KeyboardEvent('keyup', { key: ESCAPE.toString() }); const escapeKeyboardEvent = new KeyboardEvent('keyup', { key: ESCAPE.toString() });
@ -769,21 +771,22 @@ describe('AlfrescoViewerComponent', () => {
component.overlayMode = true; component.overlayMode = true;
component.fileName = 'fake-test-file.pdf'; component.fileName = 'fake-test-file.pdf';
fixture.detectChanges(); fixture.detectChanges();
spyOn(component.nodesApi, 'getNode').and.callFake(() => Promise.resolve(new NodeEntry({ entry: new Node() }))); spyOn(component.nodesApi, 'getNode').and.callFake(() =>
Promise.resolve(new NodeEntry({ entry: new Node({ name: 'fake-test-file.pdf' }) }))
);
}); });
it('should header be present if is overlay mode', () => { it('should header be present if is overlay mode', () => {
expect(element.querySelector('.adf-viewer-toolbar')).not.toBeNull(); expect(element.querySelector('.adf-viewer-toolbar')).not.toBeNull();
}); });
// eslint-disable-next-line
xit('should Name File be present if is overlay mode ', (done) => { it('should Name File be present if is overlay mode ', async () => {
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { await fixture.whenStable();
fixture.detectChanges(); fixture.detectChanges();
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf'); expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf');
done();
});
}); });
it('should Close button be present if overlay mode', (done) => { it('should Close button be present if overlay mode', (done) => {