From 9cb86c65b813db68edf5e501035780f0475a149b Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Thu, 23 Mar 2023 12:51:59 +0500 Subject: [PATCH] TSK-934: redirect to last location on opening main page (#2817) Signed-off-by: Vyacheslav Tumanov --- packages/ui/src/components/internal/Root.svelte | 5 ++++- tests/sanity/tests/workbench.spec.ts | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/components/internal/Root.svelte b/packages/ui/src/components/internal/Root.svelte index 67f19187fa..3ea670761b 100644 --- a/packages/ui/src/components/internal/Root.svelte +++ b/packages/ui/src/components/internal/Root.svelte @@ -35,7 +35,10 @@ } if (application === undefined) { - const last = localStorage.getItem(`platform_last_loc_${loc.path[1]}`) + let last = localStorage.getItem(`platform_last_loc_${loc.path[1]}`) + if (last === null) { + last = localStorage.getItem('platform_last_loc') + } if (last !== null) { navigate(JSON.parse(last)) } else { diff --git a/tests/sanity/tests/workbench.spec.ts b/tests/sanity/tests/workbench.spec.ts index a3faeefcc4..e8f6eb433c 100644 --- a/tests/sanity/tests/workbench.spec.ts +++ b/tests/sanity/tests/workbench.spec.ts @@ -51,4 +51,11 @@ test.describe('workbench tests', () => { // Click text=John Appleseed await expect(page.locator('text=Appleseed John')).toBeVisible() }) + test('check-for-last-loc', async ({ page }) => { + await page.click('[id="app-recruit\\:string\\:RecruitApplication"]') + await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit`) + const urlToCheck = page.url() + await page.goto(`${PlatformURI}`) + await expect(page).toHaveURL(urlToCheck) + }) })