Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk5 min

How to Test a Single-Page AngularJS Application

Test AngularJS apps with a layered strategy: fast unit tests, focused integration tests, and a few browser journeys. Learn how to approach legacy Jasmine, Karma, and Protractor setups safely.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test an existing AngularJS single-page application at three levels: fast unit tests for pure logic and isolated services, focused integration tests for AngularJS wiring and rendered behavior, and a small end-to-end suite for important user journeys. First inspect the repository and run its existing tests; setup details vary by app and version. AngularJS support ended in January 2022, and Protractor reached end of life in August 2023, so treat Jasmine/Karma and Protractor as historical conventions—not a default toolchain for a new suite.

Identify the app and its existing test setup

AngularJS, also called Angular 1, is distinct from the current Angular framework. Confirm which one the repository uses before following a guide: inspect its package manifest and lockfile, AngularJS dependency version, test scripts, test configuration, and supported browsers. Then run the test command already defined by the project and note whether it starts a watch process locally or is intended for a one-time CI run.

The AngularJS project historically documented Jasmine and Karma for unit and integration tests, and Protractor for end-to-end tests. That convention can help explain an inherited repository, but it does not establish a version-matched setup recipe for every app. Avoid copying commands or configuration from current Angular documentation into AngularJS: those are different frameworks, and current Angular’s testing defaults do not automatically apply here.

Choose the right test level

Unit tests: functions and isolated services

Use unit tests for deterministic logic: input validation, formatting, calculations, and service behavior that can be examined through its inputs and outputs. Cover meaningful edge cases as well as the ordinary path. These tests should be the quickest layer to run and the easiest to diagnose.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Integration tests: AngularJS wiring and rendered behavior

Use focused integration tests when the behavior depends on multiple pieces working together—for example, a directive or component, its template, and an injected service. Keep the scope narrow enough that a failure points to a specific interaction, rather than reproducing an entire browser journey.

The precise setup and mocking APIs depend on the AngularJS version and the project’s test stack. Check documentation matching the installed version before using APIs for HTTP mocking, routes, directives, or components. Do not substitute current Angular’s HttpTestingController patterns into an AngularJS test.

End-to-end tests: a few high-value user journeys

Run a small number of browser-level tests against the rendered app. A useful test follows a meaningful user path—open a route, enter valid information, submit, and verify the visible success state. Assert what a user can observe rather than private framework internals. Choose an actively maintained end-to-end tool that fits the app’s browser and operating-system needs; no single replacement is right for every legacy project.

Write a browser test around user-visible behavior

Protractor’s archived tutorial demonstrates the basic shape of a browser journey: navigate, locate controls, type, click, and assert rendered text. The following is an illustrative fragment for a repository that already has a compatible Protractor setup; it is not a recommendation to install Protractor for a new suite. Adapt route and selectors to the application, and verify the syntax against that repository’s installed version and configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
describe('application form', function () {
  it('shows confirmation after a valid submission', function () {
    browser.get('/application');

    element(by.id('email')).sendKeys('[email protected]');
    element(by.id('submit')).click();

    expect(element(by.id('confirmation')).getText())
      .toContain('Application received');
  });
});

Prefer stable selectors associated with meaningful controls or visible content. IDs can work when maintained deliberately; where the app supports dedicated test attributes, use them consistently. Avoid selectors tied to incidental DOM structure or CSS classes that change during redesigns. Keep the assertion focused on the outcome, such as a confirmation message or changed page state.

Make asynchronous work and external dependencies predictable

Tests become flaky when their result depends on an uncontrolled network response, timing assumption, or external service. Arrange tests so that expected responses and asynchronous outcomes are predictable, and wait for observable application state rather than relying on arbitrary delays. The exact AngularJS APIs for HTTP, routes, and directive setup are version-dependent, so consult the documentation that matches the app before implementing mocks. Do not copy modern Angular testing examples as though they were AngularJS APIs.

Rank #4
AngularJS
  • Used Book in Good Condition

Run the suite in CI and use coverage carefully

Have CI run the repository’s existing test command and provide the browser environment expected by its tests. Check that the browser and operating-system combination in CI matches the application’s supported targets; a passing run in one environment is not proof of coverage in every supported browser. Use coverage to find code that may be untested, not as a substitute for assertions that verify meaningful behavior.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What to do about Protractor

Protractor reached end of life in August 2023, and its project discourages new adoption and recommends that existing users migrate to another end-to-end solution. If an inherited suite still uses it, inventory the tests and prioritize the journeys that protect important user outcomes before choosing a replacement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Compare candidates against the constraints of the app rather than selecting one solely because it appears in a current Angular guide. Current Angular documentation discusses Playwright and WebdriverIO in its own browser-testing context; that does not establish that either is automatically compatible with every AngularJS app.

  • Does the tool support the browsers and operating systems the app must serve?
  • Can it run the legacy app reliably in the project’s CI environment?
  • Are selectors stable and understandable to the team?
  • Can failures be debugged efficiently, and is the tool actively maintained?
  • Can the team migrate the most valuable journeys incrementally?

Or skip the browser setup

For capturing a rendered page as an artifact, ScreenshotNeo is a website screenshot API and MCP server; it does not replace unit, integration, or end-to-end tests. A single GET request can capture a deployed page as an image or PDF. See the ScreenshotNeo API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://your-app.example.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides screenshot, page-info, and PDF-capture tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for 1,000 free screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Should I start a new AngularJS test suite with Protractor?

No. Protractor reached end of life in August 2023 and its project discourages new adoption.

Can I use current Angular testing commands for AngularJS?

Not without verifying compatibility. Angular and AngularJS are distinct frameworks, and current Angular instructions are not a drop-in AngularJS setup.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.