Back to Repositories

Testing Scratchpad Navigation and Access Flows in Insomnia

This test suite validates the Scratchpad functionality in Insomnia, focusing on user interaction and navigation flows. It ensures the scratch pad feature is accessible and displays correctly after user logout.

Test Coverage Overview

The test suite covers critical user interface interactions with the Scratchpad feature.

Key areas tested include:
  • User dropdown menu interaction
  • Logout functionality
  • Scratchpad access and navigation
  • Welcome message verification

Implementation Analysis

The test implementation utilizes Playwright’s page object model for UI automation. It follows a sequential flow pattern, validating each step of the user journey from logout to accessing the Scratchpad.

Technical implementation includes:
  • Data-testid selectors for reliable element targeting
  • Async/await pattern for handling UI interactions
  • Click event validations

Technical Details

Testing infrastructure includes:
  • Playwright test runner and assertion library
  • TypeScript for type safety
  • Custom test fixtures for page object handling
  • Element locators using data-testid and text content

Best Practices Demonstrated

The test demonstrates several quality testing practices including semantic selector usage, clear test case isolation, and straightforward flow validation. It employs reliable element selection strategies using data-testid attributes and follows a clear, single-responsibility principle in test organization.

Notable practices:
  • Descriptive test naming
  • Stable element selection strategies
  • Linear test flow structure
  • Clear action verification steps

kong/insomnia

packages/insomnia-smoke-test/tests/critical/scratchpad.test.ts

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

test('can open scratchpad', async ({ page }) => {
    await page.locator('[data-testid="user-dropdown"]').click();
    await page.getByText('Log Out').click();
    await page.getByLabel('Use the Scratch Pad').click();
    await page.getByText('Welcome to the Scratch Pad').click();
});