Praman — Agent-First SAP UI5 Test Automation Plugin - v1.3.4
    Preparing search index...

    Interface WebStorageHelper

    Typed helper for a single Web Storage area (localStorage or sessionStorage).

    Wraps the Playwright 1.61+ storage area API with convenience methods for reading, writing, seeding bulk data, and introspecting the current state.

    webStorage.helper

    await webStorage.localStorage.seed({ token: 'abc', userId: '42' });
    const token = await webStorage.localStorage.getItem('token');
    interface WebStorageHelper {
        clear(): Promise<void>;
        getItem(key: string): Promise<string | null>;
        items(): Promise<Record<string, string>>;
        removeItem(key: string): Promise<void>;
        seed(data: Record<string, string>): Promise<void>;
        setItem(key: string, value: string): Promise<void>;
        size(): Promise<number>;
    }
    Index

    Methods

    • Removes all entries from the storage area.

      Returns Promise<void>

      Promise that resolves once the area is cleared.

      await webStorage.sessionStorage.clear();
      
    • Retrieves the value for a key, or null if the key does not exist.

      Parameters

      • key: string

        Storage key to look up.

      Returns Promise<string | null>

      Promise resolving to the stored string value or null.

      const lang = await webStorage.localStorage.getItem('lang');
      
    • Returns all current entries as a Record<string, string>.

      Returns Promise<Record<string, string>>

      Promise resolving to a plain object mapping all keys to their values.

      const all = await webStorage.localStorage.items();
      console.log(all['theme']); // 'dark'
    • Removes a single key from the storage area.

      Parameters

      • key: string

        Storage key to remove.

      Returns Promise<void>

      Promise that resolves once the key is removed.

      await webStorage.localStorage.removeItem('tempFlag');
      
    • Seeds multiple entries at once, equivalent to calling setItem for each pair.

      Parameters

      • data: Record<string, string>

        Key-value pairs to seed into storage.

      Returns Promise<void>

      Promise that resolves once all items are stored.

      await webStorage.localStorage.seed({ theme: 'dark', lang: 'en', userId: '42' });
      
    • Sets a single key-value pair in the storage area.

      Parameters

      • key: string

        Storage key.

      • value: string

        Storage value (string).

      Returns Promise<void>

      Promise that resolves once the item is stored.

      await webStorage.localStorage.setItem('theme', 'dark');
      
    • Returns the number of entries currently in the storage area.

      Returns Promise<number>

      Promise resolving to the entry count.

      const count = await webStorage.localStorage.size();