Repository navigation
refactor(browserstack): extract the v2 provider plugin #4579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thymikee
wants to merge
8
commits into
0.22
Choose a base branch
from
fix/a1-extraction-unused-import-20261116
base: 0.22
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,369
−773
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3449c41
refactor(browserstack): extract BrowserStack into the @agent-device/b…
thymikee 78a3cf7
docs(browserstack): move BrowserStack to the plugin install flow
thymikee 085af9a
fix(browserstack): repair CI contracts and plugin review findings
thymikee 9e3fd0a
test(browserstack): repair packed export and HTTP fixture contracts
thymikee 181ab68
fix(build): give shared bundler config a private workspace owner
thymikee 094f6b9
fix(build): complete typed workspace declarations for bundler policy
thymikee 2d86e11
chore(gates): declare build configuration as a leaf owner
thymikee 7fce4ca
fix(build): classify Rolldown as a development dependency
thymikee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'agent-device': minor | ||
| --- | ||
|
|
||
| Extract BrowserStack out of the bundled WebDriver provider into the new `@agent-device/browserstack` plugin package. Install it with `agent-device plugins add @agent-device/browserstack`, then close your sessions and run `agent-device daemon stop --state-dir <path>` for your daemon before reconnecting. Commands for a saved BrowserStack connection keep working while the plugin is installed; without it, `connect browserstack` explains how to install the plugin. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "name": "@agent-device/build-config", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "description": "Shared repository bundler configuration.", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./src/index.ts", | ||
| "default": "./src/index.ts" | ||
| } | ||
| }, | ||
| "devDependencies": { | ||
| "rolldown": "1.2.5" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import type { InputOptions } from 'rolldown'; | ||
|
|
||
| export const strictBundlerInputOptions: InputOptions = { | ||
| onLog(level, log, handler) { | ||
| if (log.code === 'UNRESOLVED_IMPORT') throw new Error(log.message); | ||
| handler(level, log); | ||
| }, | ||
| }; | ||
|
|
||
| export const providerPluginBuildConfig = { | ||
| entry: { 'agent-device': 'src/index.ts' }, | ||
| outDir: 'dist', | ||
| format: 'esm' as const, | ||
| platform: 'node' as const, | ||
| target: 'es2022' as const, | ||
| minify: true, | ||
| dts: false, | ||
| hash: false, | ||
| deps: { alwaysBundle: [/^@agent-device\//] }, | ||
| inputOptions: strictBundlerInputOptions, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "extends": "../../tsconfig.json", | ||
| "compilerOptions": { | ||
| "composite": true, | ||
| "noEmit": false, | ||
| "emitDeclarationOnly": true, | ||
| "declaration": true, | ||
| "declarationDir": "./dist-types", | ||
| "rootDir": "./src", | ||
| "tsBuildInfoFile": "./dist-types/index.tsbuildinfo" | ||
| }, | ||
| "include": ["src"], | ||
| "references": [] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # @agent-device/browserstack | ||
|
|
||
| Use BrowserStack App Automate Android and iOS devices with [agent-device](https://agent-device.dev). | ||
| You need a BrowserStack account with App Automate access. | ||
|
|
||
| ```sh | ||
| npm install -g agent-device | ||
| agent-device plugins add @agent-device/browserstack | ||
| export BROWSERSTACK_USERNAME=your-username | ||
| export BROWSERSTACK_ACCESS_KEY=your-access-key | ||
| agent-device connect browserstack --session checkout-android --platform android --device "Google Pixel 8" --provider-os-version 14.0 --provider-app bs://app-id | ||
| ``` | ||
|
|
||
| See the [BrowserStack guide](https://agent-device.dev/docs/browserstack) for setup and supported operations. | ||
| To update the plugin, run `agent-device plugins update @agent-device/browserstack`. | ||
|
|
||
| After you add or update the plugin, close your sessions and run `agent-device daemon stop --state-dir <path>` for your daemon before reconnecting. | ||
|
|
||
| ## Use it from JavaScript | ||
|
|
||
| The package default-exports a plugin factory. Pass credentials as options, or leave them out to read `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` from the environment: | ||
|
|
||
| ```js | ||
| import { startAgentDevice } from 'agent-device'; | ||
| import browserstack from '@agent-device/browserstack'; | ||
|
|
||
| const host = await startAgentDevice({ | ||
| stateDir: './.my-app/agent-device-state', | ||
| plugins: [ | ||
| browserstack({ credentials: { username: 'your-username', accessKey: 'your-access-key' } }), | ||
| ], | ||
| }); | ||
| try { | ||
| console.log(await host.client.sessions.list()); | ||
| } finally { | ||
| await host.close(); | ||
| } | ||
| ``` | ||
|
|
||
| Each credential key passed as an option replaces its environment variable. A key left out uses the environment, and only that environment key participates in the credential fingerprint. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| { | ||
| "name": "@agent-device/browserstack", | ||
| "version": "0.22.0-dev", | ||
| "private": true, | ||
| "type": "module", | ||
| "description": "BrowserStack real-device cloud plugin for agent-device.", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsdown --config tsdown.config.ts", | ||
| "prepack": "pnpm build" | ||
| }, | ||
| "exports": { | ||
| ".": { | ||
| "types": "./src/index.ts", | ||
| "default": "./src/index.ts" | ||
| }, | ||
| "./agent-device": { | ||
| "types": "./src/index.ts", | ||
| "default": "./src/index.ts" | ||
| }, | ||
| "./connection-verification": { | ||
| "types": "./src/browserstack-connection-verification.ts", | ||
| "default": "./src/browserstack-connection-verification.ts" | ||
| }, | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "devDependencies": { | ||
| "@agent-device/contracts": "workspace:*", | ||
| "@agent-device/kernel": "workspace:*", | ||
| "@agent-device/provider-webdriver": "workspace:*", | ||
| "agent-device": "workspace:*", | ||
| "@agent-device/test-kit": "workspace:*", | ||
| "@agent-device/build-config": "workspace:*" | ||
| }, | ||
| "publishConfig": { | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/agent-device.mjs" | ||
| }, | ||
| "./agent-device": { | ||
| "import": "./dist/agent-device.mjs" | ||
| }, | ||
| "./connection-verification": { | ||
| "import": "./dist/connection-verification.mjs" | ||
| }, | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "access": "public" | ||
| }, | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/callstack/agent-device.git", | ||
| "directory": "packages/provider-browserstack" | ||
| }, | ||
| "homepage": "https://agent-device.dev/docs/browserstack" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.