Giter Club home page Giter Club logo

device-shaper's Introduction

device-shaper ๐Ÿ„โ€โ™‚๏ธ

JS/TS APIs to manipulate iOS and Android simulators


Installation

You'll have to figure it out yourself, this package is not ready for serious usage ๐Ÿ™‚.

Creating or modifying devices

import { shapeDevice } from "@devices/shaper";

// Just boot some emulator, not worrying about the details
await shapeDevice({
  platform: "android",
  state: "booted",
});

// Or be very specific, the device will be created if necessary
await shapeDevice({
  platform: "ios",
  model: "iPhone-13-Pro",
  osVersion: "17.0",
});

// Modify characteristics of an existing device by specifying its id
await shapeDevice({
  platform: "ios",
  uniqueId: "A1B2C3D4-1234-5678-9ABC-1234567890AB",
  locale: "fr-FR",
  approvedSchemes: {
    example: "com.example.app",
  },
  statusBar: {
    time: "12:34",
  },
});

Matching rules

The shapeDevice function will try to match the provided characteristics to an existing device

Some characteristics are "immutable": a mismatch will result in creating a new device:

  • platform
  • model
  • osVersion
  • uniqueId
  • name

The other characteristcs will be modified on the first matching device.

In any case, the resulting situation will be devices that match the input (or an error if you request something impossible).

Interacting with devices

// Example: take a screenshot of all booted devices

import { listDevices, interactWith } from "@devices/shaper";

const devices = await listDevices({ state: "booted" });

await Promise.all(
  devices.map((device) => interactWith(device).screenshot(`./${device.platform}.png`)),
);

Why?

There are already dozens of JS implementations of these features, so I figured "why not one more?".

More seriously, the difference is that this lib is focused on providing these APIs instead of including this code in some higher-level project (CLI, test runner, etc...). Maybe it will be used by those other projects one day.

Roadmap

There is no delivery date for any of these features, but reach out if you want to help!

  • A full test suite
  • Support for all the platforms you can imagine (browser, TV, watches, VR, etc.)
  • Physical devices when it makes sense (android for starters, it shouldn't be too complicated)
  • More characteristics to shape (network, GPS, sensors, etc.)
  • More interactions (swipe, tap, etc.)

device-shaper's People

Stargazers

Michael Demarais avatar

Watchers

Matthieu Gicquel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.