Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
detox-copilot
Advanced tools
A flexible plugin that drives your tests with human-written commands, enhanced by the power of large language models (LLMs)
A flexible plugin that drives your tests with human-written commands, enhanced by the power of large language models (LLMs). While originally designed for Detox, Detox Copilot can be extended to any other testing frameworks.
It provides clear APIs to perform actions and assertions within your tests while interfacing with an LLM service to enhance the testing process.
Here's an example of how Copilot runs over a Detox test case:
The test case is written in a human-readable format, and Copilot translates it into Detox actions on the fly.
Not just Detox! Copilot can be extended to any other testing frameworks.
High-level overview of the API that Detox Copilot exposes:
/**
* Initializes the Copilot with the given configuration.
* Must be called before any other Copilot methods.
* @param config The configuration for the Copilot.
*/
init: (config: Config) => void;
/**
* Resets the Copilot instance.
* Must be called before each test to ensure a clean state (the Copilot uses the operations history as part of
* its context).
*/
reset: () => void;
/**
* Performs a testing operation or series of testing operations in the app based on the given `steps`.
* @returns The result of the operation(s), which can be a single value or an array of values for each step.
* @example Tap on the login button
* @example Scroll down to the 7th item in the Events list
* @example The welcome message should be visible
* @example The welcome message text should be "Hello, world!"
* @example [
* 'Tap on the login button',
* 'A login form should be visible',
* ]
*/
perform: (steps: string | string[]) => Promise<any | any[]>;
In addition to the operations history, Copilot maintains a repository-level cache. If you need to ignore the current cache for any reason (e.g., when adding an action to the testing framework driver), you can set the environment variable COPILOT_OVERRIDE_CACHE
to "true" before running your tests. This will ensure that the current cache is not taken into consideration and will override the existing one.
export COPILOT_OVERRIDE_CACHE=true
If you want to disable the override after setting it to "true" and revert to using the cache, you can set COPILOT_OVERRIDE_CACHE
to "false"
export COPILOT_OVERRIDE_CACHE=false
Detox Copilot requires two main components to work:
An adapter that interfaces with the LLM service to generate actions based on the provided prompts. For example, GPT, Gemini, Sonnet or any other LLM service.
PromptHandler
Interface/**
* Sends a prompt to the AI service and returns the response.
* @param prompt The prompt to send to the AI service.
* @param image Optional path to the image to upload to the AI service that captures the current UI state.
* @returns The response from the AI service.
*/
runPrompt: (prompt: string, image?: string) => Promise<string>;
/**
* Checks if the AI service supports snapshot images for context.
*/
isSnapshotImageSupported: () => boolean;
An adapter that interfaces with the testing framework to execute the generated actions. For example, Detox, Appium, Espresso, XCTest or any other testing framework.
In order for Copilot to work with the testing framework, the driver provides the API catalog and the JS context to execute the generated actions.
TestingFrameworkDriver
Interface/**
* Takes a snapshot of the current screen and returns the path to the saved image.
* If the driver does not support image, return undefined.
*/
captureSnapshotImage: () => Promise<string | undefined>;
/**
* Returns the current view hierarchy in a string representation.
*/
captureViewHierarchyString: () => Promise<string>;
/**
* The available API methods of the testing framework.
*/
apiCatalog: TestingFrameworkAPICatalog;
FAQs
A flexible plugin that drives your tests with human-written commands, enhanced by the power of large language models (LLMs)
The npm package detox-copilot receives a total of 31,952 weekly downloads. As such, detox-copilot popularity was classified as popular.
We found that detox-copilot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.