How to use the @ember/test-helpers.waitFor function in @ember/test-helpers

To help you get started, we’ve selected a few @ember/test-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / ember__test-helpers / ember__test-helpers-tests.ts View on Github external
test('wait helpers', async (assert) => {
    await render(hbs`<div class="message">Hello</div>`);

    await waitFor('.message', { count: 1, timeout: 10, timeoutMessage: 'uh oh' });
    await waitUntil(() =&gt; 'hello', { timeout: 1000, timeoutMessage: 'boom' });

    await settled();
    assert.ok(isSettled());

    const {
        hasPendingRequests,
        hasPendingTimers,
        hasPendingWaiters,
        hasRunLoop,
        pendingRequestCount
    } = getSettledState();
});
github ember-codemods / ember-test-helpers-codemod / transforms / native-dom / __testfixtures__ / integration.output.js View on Github external
test('and yet again', async function(assert) {
  this.render(hbs`{{foo-bar}}`);

  await scrollTo(document, 10, 20);
  await selectFiles('input[type=file]', [new Blob(['texters'], { type: 'plain/text' })]);
  await waitUntil(() => find('.foo.active'));
  await waitFor('.bar.selected');
  assert.ok(true);
});
github cardstack / cardstack / packages / test-support / addon-test-support / card-ui-helpers.js View on Github external
export async function saveCard(mode, id) {
  await click(`[data-test-card-save-btn]`);

  if (mode === 'creator') {
    if (id) {
      await waitFor(`[data-test-card-schema="${id}"]`, { timeout });
    } else {
      await waitFor('[data-test-card-schema^="new-card-"]', { timeout });
    }
  } else {
    await waitFor(`[data-test-card-save-btn].saved`, { timeout });
  }
}
github cardstack / cardstack / packages / test-support / addon-test-support / card-ui-helpers.js View on Github external
export async function saveCard(mode, id) {
  await click(`[data-test-card-save-btn]`);

  if (mode === 'creator') {
    if (id) {
      await waitFor(`[data-test-card-schema="${id}"]`, { timeout });
    } else {
      await waitFor('[data-test-card-schema^="new-card-"]', { timeout });
    }
  } else {
    await waitFor(`[data-test-card-save-btn].saved`, { timeout });
  }
}
github cardstack / cardstack / packages / test-support / addon-test-support / card-ui-helpers.js View on Github external
export async function saveCard(mode, id) {
  await click(`[data-test-card-save-btn]`);

  if (mode === 'creator') {
    if (id) {
      await waitFor(`[data-test-card-schema="${id}"]`, { timeout });
    } else {
      await waitFor('[data-test-card-schema^="new-card-"]', { timeout });
    }
  } else {
    await waitFor(`[data-test-card-save-btn].saved`, { timeout });
  }
}