visit()

Navigates the application to a URL during an acceptance test.

Since Ember 4/5 (Octane) Spec ↗

Syntax

await visit(url)

Parameters

NameTypeRequiredDescription
url string No The route URL to navigate to.

Returns

Promise<void> — Resolves once the route has fully loaded.

Examples

import { visit, currentURL } from '@ember/test-helpers';

test('renders the dashboard', async function (assert) {
  await visit('/dashboard');
  assert.equal(currentURL(), '/dashboard');
  assert.dom('[data-test-widget]').exists({ count: 3 });
});

Notes

Requires setupApplicationTest. visit() boots routing and waits for model hooks and rendering to settle, so assertions can run immediately after.