TSK-934: redirect to last location on opening main page (#2817)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-03-23 12:51:59 +05:00 committed by GitHub
parent 8ffc0b683a
commit 9cb86c65b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -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 {

View File

@ -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)
})
})