Farmer
A web client built to interact with AWS Device Farm's remote access API.
The client was designed to be imported as a dependency in beak to interact directly with our devices on Device Farm.
Local development
- Clone this repo locally
- Run
npm install
- Run
npm run start
to start a webpack dev server build, this should automatically open a browser tab at http://localhost:8080/
with example/index.html
as content
- In
Rainforest
repo run bundle exec rails console
to open rails console
- first create a device farm client:
device_farm = Aws::DeviceFarm::Client.new(region: 'us-west-2', credentials: Aws::Credentials.new(GetEnv['DEVICE_FARM_PUBLIC_KEY'], GetEnv['DEVICE_FARM_SECRET_KEY']))
remote = device_farm.create_remote_access_session({
project_arn: PROJECT_ARN,
device_arn: DEVICE_ARN,
name: "Remote Session Test",
configuration: {
billing_method: "METERED",
},
})
- to get our websocket session endpoint keep on running the following until
endpoint
is not nil
(status
should be RUNNING
). It will take ± 2min for the remote session to provision and this to return an endpoint.
access = device_farm.get_remote_access_session({arn: remote.remote_access_session.arn})
access["remote_access_session"]["endpoint"]
-
Open the tab with http://localhost:8080/
-
Paste the endpoint value into the input form at the top
-
Set the right device dimensions into the form fields, this is important for click events to end up on the right places, the dimensions are stored in the remote_access_session
attributes
-
Click 'Launch Farmer' button
-
Profit!
-
Remember to close the remote session after you're done testing
device_farm.stop_remote_access_session({arn: remote.remote_access_session.arn})
Deployment
A new version of the package has to be published to NPM. Depending projects have to update their package.json to use the latest version.
Publishing a new version to NPM is automated via CircleCI workflows that kick off when changes with a new package.json version are merged to the master branch.