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)
//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();
const stable = fixture.whenStable();
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 { MatButtonHarness } from '@angular/material/button/testing';
import { MatIconHarness } from '@angular/material/icon/testing';
import { MatChipOptionHarness } from '@angular/material/chips/testing';
describe('SearchFacetChipComponent', () => {
let loader: HarnessLoader;
@ -85,14 +86,15 @@ describe('SearchFacetChipComponent', () => {
const icon = await loader.getHarness(MatIconHarness);
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
xit('should display remove icon and disable facet when no items are loaded', async () => {
const menu = await loader.getHarness(MatMenuHarness);
expect(await menu.isDisabled()).toBe(true);
it('should display remove icon and disable facet when no items are loaded', async () => {
const menu = await loader.getHarness(MatChipOptionHarness);
const disabled = await menu.isDisabled();
expect(disabled).toBe(true);
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 () => {

View File

@ -33,7 +33,8 @@ import {
TranslationMock,
TranslationService,
ViewUtilService,
ViewerComponent
ViewerComponent,
ViewerSidebarComponent
} from '@alfresco/adf-core';
import { NodesApiService } from '../../common/services/nodes-api.service';
import { UploadService } from '../../common/services/upload.service';
@ -163,7 +164,8 @@ describe('AlfrescoViewerComponent', () => {
ViewerWithCustomSidebarComponent,
ViewerWithCustomOpenWithComponent,
ViewerWithCustomMoreActionsComponent,
ViewerWithCustomToolbarActionsComponent
ViewerWithCustomToolbarActionsComponent,
ViewerSidebarComponent
],
providers: [
ContentService,
@ -389,8 +391,8 @@ describe('AlfrescoViewerComponent', () => {
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 customElement: HTMLElement = customFixture.nativeElement;
const escapeKeyboardEvent = new KeyboardEvent('keydown', { key: ESCAPE.toString() });
@ -403,8 +405,8 @@ describe('AlfrescoViewerComponent', () => {
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 customElement: HTMLElement = customFixture.nativeElement;
const escapeKeyboardEvent = new KeyboardEvent('keyup', { key: ESCAPE.toString() });
@ -769,21 +771,22 @@ describe('AlfrescoViewerComponent', () => {
component.overlayMode = true;
component.fileName = 'fake-test-file.pdf';
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', () => {
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();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf');
done();
});
await fixture.whenStable();
fixture.detectChanges();
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual('fake-test-file.pdf');
});
it('should Close button be present if overlay mode', (done) => {