From 5845745fd558f44f9ff9130be8a640bd2441ad2b Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Sat, 22 Oct 2022 22:06:38 +0530 Subject: [PATCH] feat(testing): Local storage is maintained after page reload --- scripts/playwright/setup/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/playwright/setup/index.ts b/scripts/playwright/setup/index.ts index 3dadf4ad76..18075dfe85 100644 --- a/scripts/playwright/setup/index.ts +++ b/scripts/playwright/setup/index.ts @@ -24,7 +24,14 @@ const setup = async ({page}: {page: Page}): Promise => { await page.addInitScript(async ({token}) => { try { + let initialLocalStorage = {}; + try { + initialLocalStorage = JSON.parse(localStorage.getItem('nocodb-gui-v2') || '{}'); + } catch(e) { + console.error('Failed to parse local storage', e); + } window.localStorage.setItem('nocodb-gui-v2', JSON.stringify({ + ...initialLocalStorage, token: token, })); } catch (e) {