Examples

Explore real-world Tomation test examples. Each card shows a snippet of TypeScript test code you can run in the browser with the Tomation Chrome Extension.

login.test.ts
Test('Login with valid credentials', () => {
  Login.fillCredentials({ username: 'admin', password: 'password123' })
  Login.submit()
  AssertHasText(Login.message, 'Login successful')
})

Login

Authentication flow with validation and error handling.

Open App
navigation.test.ts
Test('Full wizard navigation flow', () => {
  Navigate('navigation/index.html')
  Navigation.verifyStep1()
  Navigate('page2.html')
  Navigate('page3.html')
})

Navigation Wizard

Multi-step page transitions with cross-page assertions.

Open App
todo.test.ts
const todo = Data({ item: 'Buy groceries' })

Test('Add a todo item and verify it exists', () => {
  Todo.addItem({ text: todo.item })
  AssertExists(Todo.firstItem)
  AssertHasText(Todo.firstItemText, todo.item)
})

Todo List

Dynamic DOM interactions with highly readable tests.

Open App
user-form.test.ts
import user from '~/data/user.data'

Test('Register user with generated data', () => {
  UserForm.fillForm({
    name: user.name,
    email: user.email,
  })
})

User Form

Data-driven registration using Data() and Fake generators.

Open App
tables.test.ts
Test('Read cells by row and column', () => {
  AssertHasText(
    Orders.table.cell(2, OrdersColumn.Customer),
    'Ada Lovelace')
})

Orders Table

Validate values inside an HTML table with .cell(row, column) accessors.

Open App
network.test.ts
Test('POST request body is captured', () => {
  Network.createPost()
  AssertRequest(API + '/posts')
    .method('POST')
    .jsonBody({ title: 'Tomation' })
    .status(201)
})

Network Requests

Capture and assert real API calls with AssertRequest against JSONPlaceholder.

Open App

How to Run

Follow these steps to run the examples with the Tomation Chrome Extension:

  1. 1 Install and open the Tomation Chrome Extension
  2. 2 Visit this page — examples auto-load
  3. 3 Open one of the examples apps
  4. 4 Select a test from the list in the extension sidepanel and click Run

Note: Custom projects require compiling TypeScript before loading tests.