npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wtto00/karma-android-launcher

v1.0.0

Published

Launch System WebView on Android Emulator and Android Device. A Karma plugin.

Downloads

7

Readme

karma-android-launcher

Test

English | 简体中文

Launch System WebView on Android Emulator and Android Device. A Karma plugin.

Install

pnpm add @wtto00/karma-android-launcher -D
# yarn add @wtto00/karma-android-launcher -D
# npm i @wtto00/karma-android-launcher -D

Usage

karma.config.js

// use android emulator
module.exports = function (config) {
  config.set({
    // ...
    hostname: "10.0.2.2", // emulator can use a fixed IP: 10.0.2.2.
    browsers: ["AndroidEmulator"],
    captureTimeout: 1200000,
    browserDisconnectTimeout: 60000,
    browserNoActivityTimeout: 300000,
    plugins: [
      // ...
      require("@wtto00/karma-android-launcher"),
    ],
  });
};
// use connected device
const ip = require("ip");
module.exports = function (config) {
  config.set({
    // ...
    hostname: ip.address(), // The connected device needs to use a local network IP address.
    browsers: ["AndroidDevice"],
    captureTimeout: 1200000,
    browserDisconnectTimeout: 60000,
    browserNoActivityTimeout: 300000,
    plugins: [
      // ...
      require("@wtto00/karma-android-launcher"),
    ],
  });
};

You can also customize the Android version to use, but it is best to install the image in advance because the installation process is very time-consuming and may result in test timeouts and failure.

// Custom Android version emulator
const customLaunchers = {
  // Minimum support for Android 5.0.
  android_emulator_5: {
    base: "AndroidEmulator", // Here define the use of an Android emulator.
    avdName: "android_emulator_21", // The name of this custom emulator
    apiLevel: 21, // Define Android SDK version here.
    // ... More parameters can be found in the description below.
  },
};
module.exports = function (config) {
  config.set({
    // ...
    hostname: "10.0.2.2", // emulator can use a fixed IP: 10.0.2.2.
    browsers: ["android_emulator_5"],
    customLaunchers,
    captureTimeout: 1200000,
    browserDisconnectTimeout: 60000,
    browserNoActivityTimeout: 300000,
    plugins: [
      // ...
      require("@wtto00/karma-android-launcher"),
    ],
  });
};

Parameters for customize emulator

| Name | Type | Notes | | --------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | avdName | string | Name of the simulator to be created. | | apiLevel | number | The minimum supported Android SDK version is 21, which corresponds to Android 5.0. | | arch | string | The CPU architecture of the system image used by the simulator. It is default to the CPU architecture of the current system. | | target | string | The target of the system image is usually 'default' or 'google_apis'. The default is 'default'. | | image | string | The Android image to be used. For example: system-images;android-34;google_apis;x86_64. If this image parameter is present, the apiLevel, arch, and target parameters will be ignored. Otherwise, the value of this parameter will be constructed based on the apiLevel, arch, and target parameters. | | adb | string | adb executable file, relative to the ANDROID_HOME path. Default is: platform-tools/adb. | | avdmanager | string | avdmanager is an executable file relative to the ANDROID_HOME path. The default path is cmdline-tools/latest/bin/avdmanager. | | sdkmanager | string | sdkmanager executable file, relative to the ANDROID_HOME path. The default path is: cmdline-tools/latest/bin/sdkmanager. | | emulator | string | emulator is an executable file relative to the ANDROID_HOME path. The default value is emulator/emulator. | | emulatorOptions | object | Parameters for starting the emulator |

Parameters for starting the emulator

| Name | Type | Notes | | -------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | noWindow | boolean | disable graphical window display | | noSnapshot | boolean | perform a full boot and do not auto-save, but qemu vmload and vmsave operate on snapstorage | | noSnapstorage | boolean | do not mount a snapshot storage file (this disables all snapshot functionality) | | noSnapshotUpdateTime | boolean | do not try to correct snapshot time on restore | | noSnapshotSave | boolean | do not auto-save to snapshot on exit: abandon changed state | | noSnapshotLoad | boolean | do not auto-start from snapshot: perform a full boot | | cameraBack | "emulated""virtualscene""videoplayback""none""webcam" | set emulation mode for a camera facing back | | cameraFront | 'emulated''webcam''none' | set emulation mode for a camera facing front | | gpu | 'auto''auto-no-window''host''swiftshader_indirect''angle_indirect''guest' | set hardware OpenGLES emulation mode | | nocache | boolean | disable the cache partition | | noaudio | boolean | disable audio support | | noBootAnim | boolean | disable animation for faster boot | | lowram | boolean | device is a low ram device | | restartWhenStalled | boolean | Allows restarting guest when it is stalled. | | waitForDebugger | boolean | Pause on launch and wait for a debugger process to attach before resuming | | httpProxy | string | make TCP connections through a HTTP/HTTPS proxy | | cores | number | Set number of CPU cores to emulator | | wipeData | boolean | reset the user data image (copy it from initdata) | | noPassiveGps | boolean | disable passive gps updates | | ... | ... | use 'emulator --help' for more information. |

Usage for Github Action

You can refer to the configuration file of this project test.yml.

The browser name used in matrix.config.targetBrowser needs to be defined in your own karma configuration before it can be used.

Then you can use process.env[TARGET_BROWSER] in karma to get the currently used browser.

Notes

  1. The version of WebView in the Android system.
    • Android 5.0 Lollipop (WebView version 44)
    • Android 5.1 Lollipop (WebView version 45)
    • Android 6.0 Marshmallow (WebView version 46)
    • Android 7.0 Nougat (WebView version 51)
    • Android 7.1 Nougat (WebView version 52)
    • Android 8.0 Oreo (WebView version 60)
    • Android 8.1 Oreo (WebView version 61)
    • Android 9.0 Pie (WebView version 67)
    • Android 10 (WebView version 69)
    • Android 11 (WebView version 85)