Back to Repositories

Testing Design Document Management Workflow in Insomnia

This test suite validates document naming and management operations in Insomnia’s design documents feature. It focuses on creating and deleting design documents with specific naming conventions and handling confirmation modals.

Test Coverage Overview

The test suite covers essential document management operations in Insomnia.

Key areas tested include:
  • Document creation with custom naming
  • Test suite deletion workflow
  • Modal confirmation handling
  • Workspace interaction patterns

Implementation Analysis

Tests utilize Playwright’s page object model for UI interaction testing. The implementation follows an event-driven approach, simulating user actions through button clicks, form fills, and modal interactions.

Technical patterns include:
  • Role-based element selection
  • Placeholder text targeting
  • TestID-based element location
  • Modal dialog handling

Technical Details

Testing stack components:
  • Playwright test runner
  • TypeScript for type safety
  • Page object interactions
  • Role and label-based selectors
  • Async/await pattern for operations

Best Practices Demonstrated

The test suite exemplifies robust UI testing practices with clear interaction patterns and reliable element selection strategies.

Notable practices:
  • Descriptive test naming
  • Atomic test cases
  • Consistent selector strategy
  • Modal confirmation handling
  • Workspace state management

kong/insomnia

packages/insomnia-smoke-test/tests/smoke/design-document-naming.test.ts

            
import { test } from '../../playwright/test';

test.describe('design document operations', async () => {
    test('can name design documents', async ({ page }) => {
        await page.getByRole('button', { name: ' New Document' }).click();
        await page.getByPlaceholder('my-spec.yaml').fill('jurassic park');
        await page.getByPlaceholder('my-spec.yaml').press('Enter');
        await page.getByTestId('project').click();
        await page.getByLabel('jurassic park').click();
    });

    test('can delete a test suite with confirmation modal', async ({ page }) => {
        await page.getByRole('button', { name: ' New Document' }).click();
        await page.getByPlaceholder('my-spec.yaml').fill('jurassic park');
        await page.getByPlaceholder('my-spec.yaml').press('Enter');
        await page.getByTestId('workspace-test').click();
        await page.getByText('New test suite').click();
        await page.getByLabel('Test Suites').getByLabel('Unit Test Actions').click();
        await page.getByRole('menuitemradio', { name: 'Delete suite' }).click();
        await page.locator('.modal__content').getByRole('button', { name: 'Delete' }).click();
    });
});