setupApplicationTest()

Configures a full acceptance test that boots the app and exercises routes.

Since Ember 4/5 (Octane) Spec ↗

Syntax

setupApplicationTest(hooks)

Parameters

NameTypeRequiredDescription
hooks NestedHooks No The QUnit module hooks object.

Returns

void — Boots the app and enables visit() and navigation helpers.

Examples

import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { visit, click, currentURL } from '@ember/test-helpers';

module('Acceptance | posts', function (hooks) {
  setupApplicationTest(hooks);

  test('navigating to a post', async function (assert) {
    await visit('/posts');
    await click('[data-test-post="1"]');
    assert.equal(currentURL(), '/posts/1');
  });
});

Notes

Acceptance tests run the real router and templates end to end. Use visit() to navigate and currentURL() to assert location. Pair with a mock backend (e.g. Mirage) for network requests.