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

appwright

v0.1.40

Published

E2E mobile app testing done right, with the Playwright test runner

Downloads

3,286

Readme

Appwright

NPM Version

Appwright is a test framework for e2e testing of mobile apps. Appwright builds on top of Appium, and can run tests on local devices, emulators, and remote device farms — for both iOS and Android.

Appwright is one integrated package that combines an automation driver, test runner and test reporter. To achieve this, Appwright uses the Playwright test runner internally, which is purpose-built for the e2e testing workflow.

Appwright exposes an ergonomic API to automate user actions. These actions auto-wait and auto-retry for UI elements to be ready and interactable, which makes your tests easier to read and maintain.

import { test, expect } from "appwright";

test("User can login", async ({ device }) => {
  await device.getByText("Username").fill("admin");
  await device.getByText("Password").fill("password");
  await device.getByText("Login").tap();
});

Links to help you get started.

Usage

Minimum requirements

  • Node 18.20.4 or higher

Install

npm i --save-dev appwright
touch appwright.config.ts

Configure

// In appwright.config.ts
import { defineConfig, Platform } from "appwright";
export default defineConfig({
  projects: [
    {
      name: "android",
      use: {
        platform: Platform.ANDROID,
        device: {
          provider: "emulator", // or 'local-device' or 'browserstack'
        },
        buildPath: "app-release.apk",
      },
    },
    {
      name: "ios",
      use: {
        platform: Platform.IOS,
        device: {
          provider: "emulator", // or 'local-device' or 'browserstack'
        },
        buildPath: "app-release.app", // Path to your .app file
      },
    },
  ],
});

Configuration Options

  • platform: The platform you want to test on, such as 'android' or 'ios'.

  • provider: The device provider where you want to run your tests. You can choose between browserstack, lambdatest, emulator, or local-device.

  • buildPath: The path to your build file. For Android, it should be an APK file. For iOS, if you are running tests on real device, it should be an .ipa file. For running tests on an emulator, it should be a .app file.

Run tests

To run tests, you need to specify the project name with --project flag.

npx appwright test --project android
npx appwright test --project ios

Run tests on BrowserStack

Appwright supports BrowserStack out of the box. To run tests on BrowserStack, configure the provider in your config.

{
  name: "android",
  use: {
    platform: Platform.ANDROID,
    device: {
      provider: "browserstack",
      // Specify device to run the tests on
      // See supported devices: https://www.browserstack.com/list-of-browsers-and-platforms/app_automate
      name: "Google Pixel 8",
      osVersion: "14.0",
    },
    buildPath: "app-release.apk",
  },
},

Run tests on LambdaTest

Appwright supports LambdaTest out of the box. To run tests on LambdaTest, configure the provider in your config.

{
  name: "android",
  use: {
    platform: Platform.ANDROID,
    device: {
      provider: "lambdatest",
      // Specify device to run the tests on
      // See supported devices: https://www.lambdatest.com/list-of-real-devices
      name: "Pixel 8",
      osVersion: "14",
    },
    buildPath: "app-release.apk",
  },
},

Run the sample project

To run the sample project:

  • Navigate to the example directory.
cd example
  • Install dependencies.
npm install
  • Run the tests

Run the following command to execute tests on an Android emulator:

npx appwright test --project android

To run the tests on iOS simulator:

  • Unzip the wikipedia.zip file
npm run extract:app
  • Run the following command:
npx appwright test --project ios

Docs