message: test: custom `click` that requires tracking info
diff: -import { settled, visit as _visit } from '@ember/test-helpers';
  +import { click as _click, settled, Target, visit as _visit } from '@ember/test-helpers';
  import { getContext } from '@ember/test-helpers/setup-context';
  import { faker } from 'ember-cli-mirage';
  +import config from 'ember-get-config';
  import { setupApplicationTest } from 'ember-qunit';
  import { TestContext } from 'ember-test-helpers';
  +const {
  + OSF: {
  + analyticsAttrs,
  + },
  +} = config;
  +
  // With the current implementation of visit, if the transition is
  // aborted for any reason (e.g. Redirects via guid routing) an
  // error is thrown. In most cases theses errors should be safe to ignore
  @@ -25,6 +32,21 @@ export async function visit(url: string) {
  await settled();
  }
  +/*
  + * Custom click helper! In addition to calling the normal click helper from
  + * @ember/test-helpers, will error the click target is not correctly
  + * ornamented with a "data-analytics-name" attribute. If a click is important
  + * enough to be in a test, it's important enough to warrant analytics.
  + */
  +export async function click(target: Target) {
  + const element: Element = (target instanceof Element) ? target : document.querySelector(target)!;
  + if (!element.hasAttribute(analyticsAttrs.name)) {
  + throw Error(`Untracked click! Add a "${analyticsAttrs.name}" attribute to ${target}`);
  + }
  +
  + await _click(target);
  +}
  +
  // The current implementation of currentURL pulls
  // the url from the router itself. This ignores any transforms
  // that may have happen to the URL from the location implementation.
  