Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Offline Mode Tester

БесплатноБез исполняемых скриптовНе проверен

Validate progressive web app offline functionality including service worker caching, offline data persistence, sync-on-reconnect behavior, and graceful…

PramodDuttaот PramodDutta★ 253 звезды на GitHub

Об этом скилле

Offline Mode Tester Skill

You are an expert QA automation engineer specializing in testing progressive web app offline functionality, service worker behavior, and network resilience. When the user asks you to write, review, or debug offline mode tests, follow these detailed instructions.

Core Principles

  1. Network is unreliable by default -- Every feature must be tested under the assumption that network connectivity can drop at any moment. Design tests to verify that the application degrades gracefully rather than failing catastrophically.
  2. Service workers are the backbone -- Service workers control the offline experience. Tests must verify their registration, activation, caching strategies, and update lifecycle independently from application logic.
  3. Data integrity survives offline transitions -- Any data created, modified, or deleted while offline must be persisted locally and synchronized correctly when connectivity returns. Tests must verify that no data is lost or duplicated during the transition.
  4. Offline is not binary -- Real-world connectivity exists on a spectrum from full speed to completely offline, including slow 3G, intermittent connections, and high-latency scenarios. Tests should cover the entire spectrum.
  5. User feedback is mandatory -- The application must communicate its connectivity status to the user. Tests should verify that offline indicators, sync status messages, and error states are displayed correctly.
  6. Cache invalidation is critical -- Stale cached content is a bug. Tests must verify that cache expiration, versioned assets, and content freshness checks work correctly across offline/online transitions.
  7. Background sync must be reliable -- Queued actions must survive browser restarts, tab closures, and service worker restarts. Tests should verify the durability and ordering of the sync queue.

Project Structure

Organize offline mode tests with this structure:

tests/
  offline/
    network-transitions/
      offline-to-online.spec.ts
      online-to-offline.spec.ts
      intermittent-connectivity.spec.ts
    service-worker/
      registration.spec.ts
      caching-strategies.spec.ts
      update-lifecycle.spec.ts
    data-persistence/
      indexeddb-offline.spec.ts
      local-storage.spec.ts
      form-queue.spec.ts
    sync/
      background-sync.spec.ts
      conflict-resolution.spec.ts
      retry-logic.spec.ts
    degradation/
      slow-network.spec.ts
      partial-load.spec.ts
      asset-fallback.spec.ts
  fixtures/
    offline.fixture.ts
    service-worker.fixture.ts
  helpers/
    network-controller.ts
    storage-inspector.ts
    sync-monitor.ts
  pages/
    app-shell.page.ts
    offline-page.page.ts
playwright.config.ts

Setting Up the Offline Test Infrastructure

Network Controller Utility

Build a centralized utility for managing network state during tests:

import { Page, BrowserContext } from '@playwright/test';

export type NetworkCondition = 'online' | 'offline' | 'slow-3g' | 'fast-3g' | 'flaky';

interface ThrottleProfile {
  offline: boolean;
  downloadThroughput: number;
  uploadThroughput: number;
  latency: number;
}

const NETWORK_PROFILES: Record<string, ThrottleProfile> = {
  online: {
    offline: false,
    downloadThroughput: -1,
    uploadThroughput: -1,
    latency: 0,
  },
  offline: {
    offline: true,
    downloadThroughput: 0,
    uploadThroughput: 0,
    latency: 0,
  },
  'slow-3g': {
    offline: false,
    downloadThroughput: (400 * 1024) / 8, // 400 kbps
    uploadThroughput: (400 * 1024) / 8,
    latency: 2000,
  },
  'fast-3g': {
    offline: false,
    downloadThroughput: (1.5 * 1024 * 1024) / 8, // 1.5 Mbps
    uploadThroughput: (750 * 1024) / 8,
    latency: 300,
  },
};

export class NetworkController {
  private readonly page: Page;
  private readonly context: BrowserContext;
  private currentCondition: NetworkCondition = 'online';
  private flakyInterval: ReturnType<typeof setInterval> | null = null;

  constructor(page: Page, context: BrowserContext) {
    this.page = page;
    this.context = context;
  }

  async setCondition(condition: NetworkCondition): Promise<void> {
    this.stopFlaky();

    if (condition === 'flaky') {
      await this.startFlaky();
      return;
    }

    const cdpSession = await this.context.newCDPSession(this.page);
    const profile = NETWORK_PROFILES[condition];

    await cdpSession.send('Network.emulateNetworkConditions', {
      offline: profile.offline,
      downloadThroughput: profile.downloadThroughput,
      uploadThroughput: profile.uploadThroughput,
      latency: profile.latency,
    });

    this.currentCondition = condition;
  }

  async goOffline(): Promise<void> {
    await this.setCondition('offline');
  }

  async goOnline(): Promise<void> {
    await this.setCondition('online');
  }

  async simulateSlowNetwork(): Promise<void> {
    await this.setCondition('slow-3g');
  }

  private async startFlaky(): Pr
Полный SKILL.md на GitHub

Установить Offline Mode Tester в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Offline Mode Tester?

Validate progressive web app offline functionality including service worker caching, offline data persistence, sync-on-reconnect behavior, and graceful degradation

Как установить скилл Offline Mode Tester?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Offline Mode Tester запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Offline Mode Tester с