Skip to content

Instantly share code, notes, and snippets.

View ianjennings's full-sized avatar

Ian Jennings ianjennings

View GitHub Profile

Testing Todo Creation with Playwright

This tutorial demonstrates how to test a todo app using TodoMVC as an example. Each step shows how to drive the UI with Playwright and verify that new todos render and persist.

Loading TodoMVC

To begin validating todo creation, direct the Playwright page to the hosted demo and define the sample todo data that the flow will reuse.

const TODO_ITEMS = [
 'buy some cheese',
version: 5.5.5
steps:
- prompt: launch a calculator
commands:
- command: exec
lang: shell
windows:
start /B calc.exe
timeout /t 5
- command: wait-for-text

We hope you appreciate your demo of TestDriver.ai made by Dashcam.io.

Follow the directiosn below to merge your demo into your repository

  1. Create a Dashcam account here
  2. Copy the API key from the team page
  3. Add the API key as as a GitHub secret called DASHCAM_WORKSPACE_API. Guide here.
  4. Copy the files from the PR to your repo. The paths are important!

All TestDriver VMs are ephemeral and will be destroyed after the test completes.

# Define the path for the required directory
$directoryPath = "$env:USERPROFILE\AppData\Roaming\Dashcam"
# List of files to be created
$files = @(
".replayable--mainwindow-ever-launched",
".replayable--has-accepted-tos",
".replayable--segment-done",
".replayable--ever-launched",
".replayable--do-not-update",
# Install the desktop app
# Configure log tracking: https://docs.dashcam.io/dashcam/configure/logs
npm install dashcam
dashcam auth ${{ secrets.DASHCAM_API_KEY }}
dashcam track --name=test --type=application --pattern="C:\Users\Switc\OneDrive\Desktop\*.log*"
dashcam start
Get-ChildItem C:\Windows\System32 | Tee-Object -FilePath 'C:\Users\Switc\OneDrive\Desktop\test.log'
# run the test
dashcam -t "My Test Result" -p --md
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
➜ .waveterm /Applications/Wave.app/Contents/Resources/app/bin/wavesrv
2023/12/21 13:07:56 [wave] *** starting wavesrv version v0.5.2+202312182329
2023/12/21 13:07:56 [wave] homedir = "/Users/ianjennings/.waveterm"
2023/12/21 13:07:56 [base] acquiring lock on /Users/ianjennings/.waveterm/waveterm.lock
2023/12/21 13:07:56 [db] db version = 0
2023/12/21 13:07:56 [db] migrating from 0 to 26
2023/12/21 13:07:56 [db] backing up database waveterm.db to backup.waveterm.db
2023/12/21 13:07:56 [db] migration v1, elapsed 3.610208ms
2023/12/21 13:07:56 [db] migration v2, elapsed 2.288166ms
2023/12/21 13:07:56 [db] migration v3, elapsed 1.70675ms
This file has been truncated, but you can view the full file.
[2023-12-07 21:14:39.786] [debug] setting WORKING_DIR_ROOT as /Users/ec2-user/Movies/Dashcam
[2023-12-07 21:14:39.787] [debug] effect for WORKING_DIR_ROOT found
[2023-12-07 21:14:39.787] [debug] directory.js setup called
[2023-12-07 21:14:39.788] [debug] directory.js Problem encountered init WORKING_DIR_ROOT, attempting to recover
[2023-12-07 21:14:39.789] [debug] setting WORKING_DIR_ROOT as /Users/ec2-user/Movies/Dashcam
[2023-12-07 21:14:39.795] [debug] effect for WORKING_DIR_ROOT found
[2023-12-07 21:14:39.795] [debug] directory.js setup called
[2023-12-07 21:14:39.796] [debug] directory.js Problem encountered init WORKING_DIR_ROOT, attempting to recover
[2023-12-07 21:14:39.797] [debug] setting WORKING_DIR_ROOT as /Users/ec2-user/Movies/Dashcam
This file has been truncated, but you can view the full file.
Date/Time: 2023-12-07 21:20:04.834 +0000
End time: 2023-12-07 21:20:33.326 +0000
OS Version: macOS 14.1 (Build 23B74)
Architecture: arm64e
Report Version: 44
Incident Identifier: 922D970F-40E2-4E3C-AE40-2A0685356BEE
Data Source: Stackshots
Shared Cache: 43B9F010-3C81-318C-BA80-29C673A7757A slid base address 0x18b7bc000, slide 0xb7bc000 (System Primary)
Shared Cache: 3D4A3000-268A-3F91-8927-34F21C2873C2 slid base address 0x187b94000, slide 0x7b94000 (DriverKit)