From cf70a01836f57aa776bdbbd5c4da73b27b14eb8c Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 29 Jan 2024 19:22:33 +0100 Subject: [PATCH] test: should serialize storageState with lone surrogates (#29089) https://github.com/microsoft/playwright-dotnet/issues/2819 --- tests/library/browsercontext-storage-state.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/library/browsercontext-storage-state.spec.ts b/tests/library/browsercontext-storage-state.spec.ts index b7ed36c87d..2e4fa6b050 100644 --- a/tests/library/browsercontext-storage-state.spec.ts +++ b/tests/library/browsercontext-storage-state.spec.ts @@ -214,3 +214,11 @@ it('should handle malformed file', async ({ contextFactory }, testInfo) => { else expect(error.message).toContain(`Error reading storage state from ${file}:\nUnexpected token o in JSON at position 1`); }); + +it('should serialize storageState with lone surrogates', async ({ page, context, server }) => { + it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright-dotnet/issues/2819' }); + await page.goto(server.EMPTY_PAGE); + await page.evaluate(() => window.localStorage.setItem('foo', String.fromCharCode(55934))); + const storageState = await context.storageState(); + expect(storageState.origins[0].localStorage[0].value).toBe(String.fromCharCode(55934)); +});