Skip to content

Instantly share code, notes, and snippets.

@didmar
Created July 13, 2025 15:09
Show Gist options
  • Select an option

  • Save didmar/3fde6501347d1a6595a013b05d746180 to your computer and use it in GitHub Desktop.

Select an option

Save didmar/3fde6501347d1a6595a013b05d746180 to your computer and use it in GitHub Desktop.
Starter README.md for an AI assistant with Convex + Playwright BDD

AI Assistant Application

This is an AI assistant application built with Convex and Convex Auth.

Tech Stack

  • Backend: Convex (database, server logic)
  • Frontend: React with Vite
  • UI: Tailwind CSS
  • Authentication: Convex Auth
  • Testing: Playwright-BDD for end-to-end testing

Development Workflow

This project follows a Behavior-Driven Development (BDD) approach using Playwright-BDD. Every new feature follows this workflow:

1. Write a Gherkin User Story

Create a feature file in features/<feature-name>.feature describing the user story:

Feature: [name of the feature]
  As a [type of user]
  I want to [goal]
  So that I can [reason]

  Scenario: [name of the scenario]
    Given I [initial context]
    When I [action performed]
    Then I should [expected outcome]

Stop here to let the user validate and possibly modify the feature file. Only continue when they given them permission to.

2. Generate Test Skeleton

Run the following command to generate a test skeleton:

npm run bddgen

This will create a skeleton test file in tests/steps/<feature-name>.steps.ts.

3. Implement the Test (TDD)

Following Test-Driven Development principles, implement the test steps using Playwright:

import { createBdd } from 'playwright-bdd';
import { expect } from '@playwright/test';

const { Given, When, Then } = createBdd();

Given('I am on the login page', async ({ page }) => {
  await page.goto('/login');
  await expect(page.locator('text=Log in')).toBeVisible();
});

// ... implement remaining steps

4. Run the Test (Should Fail)

npm run test

The test should fail since the feature hasn't been implemented yet.

5. Implement the Feature

Build the actual feature to make the test pass.

6. Validate

Run both linting and tests to ensure code quality:

npm run lint
npm run test

Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • npm

Installation

npm install

Development

npm run dev

Running Tests

# Run all tests
npm run test

# Lint code
npm run lint

Project Structure

├── features/              # Gherkin feature files
├── tests/
│   └── steps/            # Playwright-BDD step definitions
├── convex/               # Convex backend functions
├── src/                  # React frontend code
└── package.json

Contributing

When adding new features:

  1. Always start with a Gherkin feature file
  2. Use BDD to drive the implementation
  3. Ensure all tests pass before committing
  4. Follow the existing code style and conventions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment