Registry / testing / ember-cli-browser-navigation-button-test-helper

ember-cli-browser-navigation-button-test-helper

JSON →
library0.3.0jsnpmunverified

This package, `ember-cli-browser-navigation-button-test-helper`, provides critical test helpers for simulating browser back and forward button clicks within Ember.js acceptance tests. It exports `setupBrowserNavigationButtons()`, `backButton()`, and `forwardButton()`, enabling developers to thoroughly test navigation flows that involve browser history manipulation. The current stable version is v0.3.0, actively maintained, with releases typically aligning with Ember.js and Ember CLI compatibility updates. Its primary differentiation lies in offering a robust, standardized, and modern Ember-compatible solution for a common testing challenge, where manual DOM manipulation or less integrated approaches might be flaky or difficult to maintain. It specifically targets modern Ember testing paradigms (Ember.js v3.20+ and RFC #232/#268 acceptance tests), ensuring compatibility and best practices.

npm install ember-cli-browser-navigation-button-test-helper
INSTALL
IMPORT
SIG · EMBER-CLI-BROWSER-
E
ember-cli-browser-navigation-button-test-helper
testingjavascriptv0.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

setupBrowserNavigationButtons
import { setupBrowserNavigationButtons } from 'ember-cli-browser-navigation-button-test-helper/test-support';
const setupBrowserNavigationButtons = require('ember-cli-browser-navigation-button-test-helper/test-support');
This addon provides test helpers primarily for Ember's ESM-based testing environment. CommonJS `require` syntax is generally incorrect in modern Ember acceptance tests.
backButton
import { backButton } from 'ember-cli-browser-navigation-button-test-helper/test-support';
import backButton from 'ember-cli-browser-navigation-button-test-helper/test-support';
The addon uses named exports for all its helper functions. Importing as a default export will result in `undefined` or a `TypeError`.
forwardButton
import { forwardButton } from 'ember-cli-browser-navigation-button-test-helper/test-support';
import { forwardButton as fb } from 'ember-cli-browser-navigation-button-test-helper';
All helpers must be imported from the `/test-support` subpath, not the root package path. Aliasing is fine, but the path must be correct.

Demonstrates setting up the browser navigation test helpers and simulating back/forward actions within an Ember acceptance test.

import { module, test } from 'qunit'; import { visit, currentURL } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import { setupBrowserNavigationButtons, backButton, forwardButton } from 'ember-cli-browser-navigation-button-test-helper/test-support'; module('Acceptance | browser navigation', function(hooks) { setupApplicationTest(hooks); setupBrowserNavigationButtons(hooks); // Essential: registers the history service test('navigating and using back/forward buttons', async function(assert) { assert.expect(4); await visit('/'); assert.equal(currentURL(), '/', 'Starts at the root URL.'); await visit('/items'); assert.equal(currentURL(), '/items', 'Navigates to /items.'); await backButton(); assert.equal(currentURL(), '/', 'Goes back to the root URL.'); await forwardButton(); assert.equal(currentURL(), '/items', 'Goes forward to /items.'); }); });
Debug
Known issues
breakingVersion 0.3.0 drops support for Ember.js versions older than 3.20. Applications using older Ember versions must remain on v0.2.0 or earlier.
fix
Upgrade your Ember.js application to v3.20 or newer, or pin `ember-cli-browser-navigation-button-test-helper` to a version prior to 0.3.0.
affects: >=0.3.0
breakingVersion 0.3.0 includes an update to `ember-auto-import` v2. This may require changes in your Ember CLI build configuration if you were using specific `ember-auto-import` v1 settings.
fix
Consult the `ember-auto-import` v2 migration guide for any necessary configuration adjustments in your `ember-cli-build.js` or `package.json`.
affects: >=0.3.0
breakingSupport for 'old-style' acceptance tests (before RFC #232 and #268) was dropped in v0.1.0. If your application still uses this older testing pattern, you must use v0.0.5.
fix
Migrate your acceptance tests to the modern RFC #232 and #268 syntax and setup, or downgrade `ember-cli-browser-navigation-button-test-helper` to v0.0.5.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: backButton is not a function
The `setupBrowserNavigationButtons(hooks)` helper was not called at the beginning of your test module.
fix
Ensure `setupBrowserNavigationButtons(hooks);` is called immediately after `setupApplicationTest(hooks);` within your QUnit `module` setup.
Import path not found: ember-cli-browser-navigation-button-test-helper
Attempting to import helpers from the root package path instead of the specific test-support path.
fix
Correct the import statements to `from 'ember-cli-browser-navigation-button-test-helper/test-support';`
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
ember-cli-browser-navigation-button-test-helper — npm install ember-cli-browser-navigation-button-test-helper · libregistry