Back to Repositories

Testing Collaborator Invitation Workflow in Insomnia

This test suite validates the user invitation functionality in the Insomnia application using Playwright. It focuses on testing the collaborative features by verifying invitation workflows and handling edge cases in the user management system.

Test Coverage Overview

The test suite covers essential user invitation functionality in Insomnia.

Key areas tested include:
  • Invitation dialog interaction
  • Member count verification
  • Email input handling
  • Error state validation
The test specifically verifies the presence of 5 existing members and attempts to add a new collaborator through email invitation.

Implementation Analysis

The test implementation utilizes Playwright’s modern testing patterns with async/await syntax and page object interactions.

Notable technical aspects include:
  • Label-based element selection
  • Role-based element querying
  • Placeholder text targeting
  • Expectation assertions for counts and content

Technical Details

Testing tools and configuration:
  • Playwright test runner
  • Custom test extensions
  • Element interaction methods
  • Async operation handling
  • Dialog content verification

Best Practices Demonstrated

The test exemplifies robust testing practices through:

  • Clear test scenario isolation
  • Meaningful element selection strategies
  • Explicit wait handling
  • Error scenario coverage
  • Readable test structure

kong/insomnia

packages/insomnia-smoke-test/tests/smoke/invite.test.ts

            
import { expect } from '@playwright/test';

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

test('Can invite users in app', async ({ page }) => {
  await page.getByLabel('Invite collaborators').click();
  // have 5 members
  await expect(page.getByLabel('Invitation list').getByRole('option')).toHaveCount(5);
  // invite a new member
  await page.getByPlaceholder('Enter emails, separated by').click();
  await page.getByPlaceholder('Enter emails, separated by').fill('[email protected]');
  await page.getByRole('button', { name: 'Invite', exact: true }).click();
  await expect(page.getByRole('dialog')).toContainText('Failed to fetch available seats');
});