File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,33 @@ await expect(browser).toHaveClipboardText('some clipboard text')
245245await expect (browser).toHaveClipboardText (expect .stringContaining (' clipboard text' ))
246246```
247247
248+ ### toHaveLocalStorageItem
249+
250+ Checks if browser has a specific item in localStorage with an optional value.
251+
252+ ##### Usage
253+
254+ ``` js
255+ await browser .url (' https://webdriver.io/' )
256+ // Check if localStorage item exists
257+ await expect (browser).toHaveLocalStorageItem (' existingKey' )
258+
259+ // Check localStorage item with exact value
260+ await expect (browser).toHaveLocalStorageItem (' someLocalStorageKey' , ' someLocalStorageValue' )
261+
262+ // Check with case insensitive
263+ await expect (browser).toHaveLocalStorageItem (' key' , ' uppercase' , { ignoreCase: true })
264+
265+ // Check with trim
266+ await expect (browser).toHaveLocalStorageItem (' key' , ' value' , { trim: true })
267+
268+ // Check with containing
269+ await expect (browser).toHaveLocalStorageItem (' key' , ' long' , { containing: true })
270+
271+ // Check with regex
272+ await expect (browser).toHaveLocalStorageItem (' userId' , / ^ user_\d + $ / )
273+ ```
274+
248275## Element Matchers
249276
250277### toBeDisplayed
You can’t perform that action at this time.
0 commit comments