// Helpers for acceptance tests export default function() { registerAsyncHelper('selectChoose', function(_, cssPathOrTrigger, valueOrSelector, optionIndex) { deprecate( 'Using the implicit global async helper `selectChoose` is deprecated. Please, import it explicitly with `import { selectChoose } from "ember-power-select/test-support"`', true, { id: 'ember-power-select-global-select-choose', until: '2.0.0' } ); return _selectChoose(cssPathOrTrigger, valueOrSelector, optionIndex); }); registerAsyncHelper('selectSearch', async function(app, cssPathOrTrigger, value) { deprecate( 'Using the implicit global async helper `selectSearch` is deprecated. Please, import it explicitly with `import { selectSearch } from "ember-power-select/test-support"`', true, { id: 'ember-power-select-global-select-search', until: '2.0.0' } ); return _selectSearch(cssPathOrTrigger, value); }); registerAsyncHelper('removeMultipleOption', async function(app, cssPath, value) { deprecate( 'Using the implicit global async helper `removeMultipleOption` is deprecated. Please, import it explicitly with `import { removeMultipleOption } from "ember-power-select/test-support"`', true, { id: 'ember-power-select-global-remove-multiple-option', until: '2.0.0' } ); return _removeMultipleOption(cssPath, value); }); registerAsyncHelper('clearSelected', async function(app, cssPath) { deprecate( 'Using the implicit global async helper `clearSelected` is deprecated. Please, import it explicitly with `import { clearSelected } from "ember-power-select/test-support"`', true, { id: 'ember-power-select-global-clear-selected', until: '2.0.0' } ); return _clearSelected(cssPath); }); }
// // You can operate outside the AGPL restrictions by purchasing // Documize Enterprise Edition and obtaining a commercial license // by contacting <*****@*****.**>. // // https://documize.com import { Promise as EmberPromise } from 'rsvp'; import { registerAsyncHelper } from '@ember/test'; import { later } from '@ember/runloop'; function isVisible(selector) { return $(selector).length > 0; } function checkVisibility(selector, interval, resolve, visibility) { if (isVisible(selector) === visibility) { resolve($(selector)); } else { later(null, function () { checkVisibility(selector, interval, resolve, visibility); }, interval); } } export default registerAsyncHelper('waitToAppear', function (app, selector, interval = 200) { return new EmberPromise(function (resolve) { checkVisibility(selector, interval, resolve, true); }); });
import { registerAsyncHelper } from '@ember/test'; export default registerAsyncHelper('selectFile', function(app, selector, file) { return triggerEvent( selector, 'change', { testingFiles: [file] } ); });
import { run } from '@ember/runloop'; import { registerAsyncHelper } from '@ember/test'; export function pollCluster(owner) { const clusterRoute = owner.lookup('route:vault/cluster'); return run(() => { return clusterRoute.controller.model.reload(); }); } registerAsyncHelper('pollCluster', function(app) { pollCluster(app.__container__); });
import { run } from '@ember/runloop'; import $ from 'jquery'; import { registerAsyncHelper } from '@ember/test'; import Ember from 'ember'; /** * Adapted from https://www.snip2code.com/Snippet/94689/waitForElement-Ember-async-helper * Avoid use except on events outside Ember that aren’t handled by the built-in test helpers * as this slows down the tests. */ export function waitForElement(element) { return Ember.Test.promise(function (resolve) { Ember.Test.adapter.asyncStart(); var interval = setInterval(function () { if ($(element).length > 0) { clearInterval(interval); Ember.Test.adapter.asyncEnd(); run(null, resolve, true); } }, 10); }); } registerAsyncHelper('waitForElement', function (app, element) { waitForElement(element); });