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

utam

v3.1.0

Published

UI Test Automation Model (UTAM)

Downloads

6,030

Readme

UTAM - UI Test Automation Model

UI Test Automation Model (UTAM) is based on the popular Page Object model design pattern commonly used in UI tests. Instead of using an object-oriented class to write a page object, a UTAM page object is authored in JSON, and described by an easy-to-understand UTAM grammar. The utam package is the entry point for generating JavaScript page objects.

Installation

Add utam as a devDependency in your package.json:

yarn add --dev utam
# or via npm
npm add --dev utam

Usage

This package exposes a CLI tool, utam, that

  • generates JavaScript page objects from declarative JSON files
  • generates UTAM JSON files from HTML

It's the main package that should be installed to use UTAM for page object authoring and generation.

Visit wdio-utam-service to learn how to use UTAM with WebDriverIO in your UI tests.

Configure and run the UTAM Compiler

Start by configuring the UTAM compiler to match your project structure and requirements.

Generate JavaScript page objects by running utam either via the cli:

npx utam -c utam.config.json

Or via a script in your package manifest:

// package.json
{
    // ...
    "scripts": {
        "build": "utam -c utam.config.json"
    }
    // ...
}

Invoke the script with:

yarn build

# or via npm
npm run build

Configure and run the UTAM Generator

Start by configuring the UTAM generator to match your requirements.

Generate UTAM JSON page objects by running utam-generate either via the cli:

npx utam-generate -c generator.config.json

Or via a script in your package manifest:

// package.json
{
    // ...
    "scripts": {
        "build": "utam-generate -c generator.config.js"
    }
    // ...
}

CLI

Use the utam command to run the UTAM compiler from the command line:

utam [options]

Note: You don't have to specify options.

--config

Use the --config option to specify the compiler configuration file path:

utam --config path/to/project/utam.config.json

Note: you don't need to specify that option if your project has a utam.config.js config file at the package root or if your package.json file has a utam configuration key.

--projects

Use the --projects option to specify projects to use in compilation:

# Project1 contains either a utam.config.js or has a `utam` key in `package.json`
utam --projects path/to/project1 path/to/project2/utam.config.json

A project is a folder that contains some configuration for the UTAM compiler. A valid project is a folder that contains either:

  1. A utam.config.js config file
  2. A utam.config.json config file
  3. A utam config object in the package manifest (package.json)

Note: A configuration file can have any name. The utam.config prefix is a convention.

--target

Use the --target option to specify the module system of default page objects. Options are (commonjs or module).

# Generate page objects that use ES Modules by default
utam --target module

# Generate page objects that use CommonJS by default
utam --target commonjs

Default page objects are the generated page objects with a .js file extension.

Generate UTAM Config via API

  1. Generate config with all values set to default, returns normalized config.
generateDefaultCompilerConfig(override: Partial<UtamProjectConfig>): NormalizedUtamProjectConfig
  • override is optional partial UTAM config if default values needs to be overridden
  1. Generate default config using previous method and write it to a file, returns absolute path to generated compiler config.
writeCompilerConfig(configOptions: ConfigFileOptions = {}, override: Partial<UtamProjectConfig> = {}): string
  • configOptions optional parameters related to config

    • rootDir root directory of the project with UTAM page objects, default is process.cwd()
    • configType type of the config: json or js, default is json
    • configName name of the file to write config to, default is utam.config.json or utam.config.js depending on config type
  • override is optional partial UTAM config if default values needs to be overridden

Generate UTAM Config from command line

Generate UTAM default config by running utam-config via the cli:

npx utam-config

By default it will create utam.config.json in current folder. Use the --config option to specify the compiler configuration file path:

utam-config --config path/to/project/utam.config.json
utam-config -c path/to/project/utam.config.js

If file name ends with js, generated config will be in JavaScript format.

Documentation

utam.dev has all the information you need to get started with UTAM, including guides, tutorials and the JSON grammar.