Charlie Tran 843a6c5bbb
feat(frontend): update datahub-web client UI code (#1806)
* Releases updated version of datahub-web client UI code

* Fix typo in yarn lock

* Change yarn lock to match yarn registry directories

* Previous commit missed some paths

* Even more changes to yarnlock missing in previous commit

* Include codegen file for typings

* Add files to get parity for datahub-web and current OS datahub-midtier

* Add in typo fix from previous commit - change to proper license

* Implement proper OS fix for person entity picture url

* Workarounds for open source DH issues

* Fixes institutional memory api and removes unopensourced tabs for datasets

* Fixes search dataset deprecation and user search issue as a result of changes

* Remove internal only options in the avatar menu
2020-08-26 15:44:50 -07:00

37 lines
1.5 KiB
TypeScript

import { visit, click } from '@ember/test-helpers';
import { TestContext } from 'ember-test-helpers';
import { getQueue } from '@datahub/shared/test-helpers/tracking';
import { IBaseTrackingEvent } from '@datahub/shared/types/tracking/event-tracking';
import UnifiedTracking from '@datahub/shared/services/unified-tracking';
/**
* Asynchronously navigates to a url and clicks on a search result item
* @param {string} url
* @returns {Promise<void>}
*/
export const navigateToSearchAndClickResult = async (url: string): Promise<void> => {
await visit(url);
await click('[data-content-name="searchResult@1"]');
};
/**
* Stubs the tracking services trackEvent method to add received events to the tracking queue
* @param {TestContext} testContext the test cases `this` reference
* @param {ReturnType<typeof getQueue>} queue tracking activity queue
* @returns {ReturnType<typeof getQueue>}
*/
export const mockTrackingEventQueue = (
testContext: TestContext,
queue: ReturnType<typeof getQueue>
): ReturnType<typeof getQueue> => {
const trackingService: UnifiedTracking = testContext.owner.lookup('service:unified-tracking');
// Stub tracking service with trackEvent stub function that adds seen events to supplied queue
trackingService.trackEvent = ({ action, category, name = '' }: IBaseTrackingEvent): void => {
// Push new events onto the queue. The the same queue needs to be mutated as expectation by the implementation
queue.push([action, category, name]);
};
return queue;
};