`appium-test-support` is a collection of JavaScript test utilities designed for internal use across various Appium packages. It provides common testing patterns such as environment variable stubbing (`stubEnv`), log output capturing and manipulation (`stubLog`), and advanced Sinon-based testing with sandboxes and mocks (`withSandbox`, `withMocks`, `fakeTime`). The current stable version is 1.3.3. As an internal utility library, its release cadence is tied to the broader Appium project's needs and updates, typically seeing updates in line with major Appium releases or when internal testing needs evolve. It differentiates itself by offering pre-packaged solutions for common Appium testing scenarios, including specific support for Android emulator setup on Travis CI, streamlining testing workflows within the Appium ecosystem and reducing boilerplate in Appium's own tests.
npm install appium-test-supportVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `fakeTime` with a Sinon.js sandbox to control and fast-forward time in asynchronous tests, verifying the outcome of time-dependent operations. This setup requires `sinon` and a test runner like `mocha` with `chai` for assertions.
Review `sinon.js` migration guides for specific API changes and update your test code accordingly. Pin `sinon.js` version in your `package.json` if conflicts arise to ensure consistent behavior.
Always ensure `sandbox.restore()` is explicitly called in an `afterEach` hook or equivalent cleanup function provided by your test runner (e.g., `afterEach(() => sandbox.restore());`).
Always assume `stubEnv` provides local, test-scoped environment variable manipulation. For complex scenarios or interactions with external processes, consider explicit environment setup/teardown in hooks.
Verify the `stripColors` behavior with your specific logging library. If not working as expected, manually strip non-ANSI color codes or customize the `stubLog` output processing further before asserting.
Ensure the object being mocked is explicitly included in the `mocks` configuration object passed to `withMocks` or `withSandbox` and accessed via the provided `mocks` or `S.mocks` parameter, e.g., `withMocks({ myApi }, (mocks) => { mocks.myApi.expects(...) });`.Ensure `sinon.createSandbox()` is called in a `beforeEach` hook and the resulting sandbox instance is passed to `fakeTime`. Also, always call `sandbox.restore()` in an `afterEach` hook to clean up.
Verify that no other testing utilities or libraries are conflictingly stubbing `process.env` or `console` within the same test context. Ensure `stubEnv` is used within a clean context where its internal restoration mechanism can operate without interference.
No dependency data recorded yet.