From 67d1d92e2449e286b84c1b6598c11323752c4fd8 Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Wed, 6 Jul 2022 13:02:01 +0600 Subject: [PATCH] Workspace in url (#2214) Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> --- packages/presentation/src/connect.ts | 30 ++++++++++++------- packages/ui/src/utils.ts | 21 ++++++++----- .../src/components/BoardHeader.svelte | 4 +-- .../src/components/ChannelView.svelte | 2 +- .../EditChannelDescriptionAttachments.svelte | 2 +- .../src/components/Message.svelte | 8 ++--- .../src/components/ThreadView.svelte | 2 +- plugins/chunter-resources/src/index.ts | 4 +-- plugins/chunter-resources/src/utils.ts | 16 +++++----- .../src/components/OrganizationCard.svelte | 4 +-- .../src/components/CreateWorkspaceForm.svelte | 18 +++++++---- .../src/components/Join.svelte | 10 ++++--- .../src/components/LoginApp.svelte | 7 +++-- .../src/components/LoginForm.svelte | 4 +-- .../src/components/SelectWorkspace.svelte | 28 ++++++++++++----- .../src/components/SignupForm.svelte | 4 +-- plugins/login-resources/src/utils.ts | 22 +++++++------- plugins/login/src/index.ts | 2 +- .../src/components/SkillsView.svelte | 4 +-- .../src/components/VacancyCard.svelte | 4 +-- .../src/components/VacancyPresenter.svelte | 4 +-- .../src/components/Settings.svelte | 17 +++++++---- .../src/components/WorkspaceSettings.svelte | 6 ++-- .../src/components/AccountPopup.svelte | 26 ++++++++++++---- .../projects/ProjectPresenter.svelte | 4 +-- .../src/components/projects/Projects.svelte | 3 +- plugins/tracker-resources/src/issues.ts | 12 ++++---- .../src/components/ClassAttributeBar.svelte | 8 ++--- .../src/components/AccountPopup.svelte | 24 +++++++++------ .../src/components/NavHeader.svelte | 7 +++-- .../src/components/SpaceBrowser.svelte | 2 +- .../src/components/Workbench.svelte | 24 +++++++-------- .../src/components/navigator/SpacesNav.svelte | 2 +- plugins/workbench-resources/src/utils.ts | 28 ++++++++--------- tests/sanity/storage-dev.json | 8 ++--- tests/sanity/storage.json | 8 ++--- tests/sanity/tests/actions.spec.ts | 12 ++++---- tests/sanity/tests/contact.duplicate.spec.ts | 2 +- tests/sanity/tests/contacts.spec.ts | 2 +- tests/sanity/tests/org.members.spec.ts | 2 +- tests/sanity/tests/recruit.review.spec.ts | 2 +- tests/sanity/tests/recruit.spec.ts | 2 +- tests/sanity/tests/settings.spec.ts | 18 +++++------ tests/sanity/tests/tags.spec.ts | 20 ++++++------- tests/sanity/tests/tracker.projects.spec.ts | 6 ++-- tests/sanity/tests/tracker.spec.ts | 4 +-- tests/sanity/tests/workbench.spec.ts | 14 ++++----- 47 files changed, 261 insertions(+), 202 deletions(-) diff --git a/packages/presentation/src/connect.ts b/packages/presentation/src/connect.ts index 461f3915e1..99fb197453 100644 --- a/packages/presentation/src/connect.ts +++ b/packages/presentation/src/connect.ts @@ -2,21 +2,25 @@ import client from '@anticrm/client' import contact from '@anticrm/contact' import core, { Client, setCurrentAccount, Version } from '@anticrm/core' import login from '@anticrm/login' -import { getMetadata, getResource } from '@anticrm/platform' +import { getMetadata, getResource, setMetadata } from '@anticrm/platform' import { fetchMetadataLocalStorage, getCurrentLocation, navigate, setMetadataLocalStorage } from '@anticrm/ui' import presentation from './plugin' export let versionError: string | undefined = '' export async function connect (title: string): Promise { - const token = fetchMetadataLocalStorage(login.metadata.LoginToken) + const loc = getCurrentLocation() + const ws = loc.path[1] + const tokens: Record = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {} + const token = tokens[ws] + setMetadata(login.metadata.LoginToken, token) const endpoint = fetchMetadataLocalStorage(login.metadata.LoginEndpoint) const email = fetchMetadataLocalStorage(login.metadata.LoginEmail) - if (token === null || endpoint === null || email === null) { + if (token === undefined || endpoint === null || email === null) { navigate({ path: [login.component.LoginApp], - query: { navigateUrl: encodeURIComponent(JSON.stringify(getCurrentLocation())) } + query: { navigateUrl: encodeURIComponent(JSON.stringify(loc)) } }) return } @@ -29,7 +33,7 @@ export async function connect (title: string): Promise { location.reload() }, () => { - clearMetadata() + clearMetadata(ws) navigate({ path: [login.component.LoginApp], query: {} @@ -44,7 +48,7 @@ export async function connect (title: string): Promise { setCurrentAccount(me) } else { console.error('WARNING: no employee account found.') - clearMetadata() + clearMetadata(ws) navigate({ path: [login.component.LoginApp], query: { navigateUrl: encodeURIComponent(JSON.stringify(getCurrentLocation())) } @@ -77,13 +81,19 @@ export async function connect (title: string): Promise { } // Update window title - document.title = [fetchMetadataLocalStorage(login.metadata.CurrentWorkspace), title].filter((it) => it).join(' - ') + document.title = [ws, title].filter((it) => it).join(' - ') return instance } -function clearMetadata (): void { - setMetadataLocalStorage(login.metadata.LoginToken, null) +function clearMetadata (ws: string): void { + const tokens = fetchMetadataLocalStorage(login.metadata.LoginTokens) + if (tokens !== null) { + const loc = getCurrentLocation() + // eslint-disable-next-line + delete tokens[loc.path[1]] + setMetadataLocalStorage(login.metadata.LoginTokens, tokens) + } + setMetadata(login.metadata.LoginToken, null) setMetadataLocalStorage(login.metadata.LoginEndpoint, null) setMetadataLocalStorage(login.metadata.LoginEmail, null) - setMetadataLocalStorage(login.metadata.CurrentWorkspace, null) } diff --git a/packages/ui/src/utils.ts b/packages/ui/src/utils.ts index f373fe6a8d..98effa7cf1 100644 --- a/packages/ui/src/utils.ts +++ b/packages/ui/src/utils.ts @@ -16,19 +16,26 @@ import type { Metadata } from '@anticrm/platform' import { setMetadata } from '@anticrm/platform' -export function setMetadataLocalStorage (id: Metadata, value: string | null): void { +export function setMetadataLocalStorage (id: Metadata, value: T | null): void { if (value != null) { - localStorage.setItem(id, value) + localStorage.setItem(id, typeof value === 'string' ? value : JSON.stringify(value)) } else { localStorage.removeItem(id) } setMetadata(id, value) } -export function fetchMetadataLocalStorage (id: Metadata): string | null { - const value = localStorage.getItem(id) - if (value !== null) { - setMetadata(id, value) +export function fetchMetadataLocalStorage (id: Metadata): T | null { + const data = localStorage.getItem(id) + if (data === null) { + return null + } + try { + const value = JSON.parse(data) + setMetadata(id, value) + return value + } catch { + setMetadata(id, data as unknown as T) + return data as unknown as T } - return value } diff --git a/plugins/board-resources/src/components/BoardHeader.svelte b/plugins/board-resources/src/components/BoardHeader.svelte index 6ebb58c615..31b297b8db 100644 --- a/plugins/board-resources/src/components/BoardHeader.svelte +++ b/plugins/board-resources/src/components/BoardHeader.svelte @@ -20,10 +20,10 @@ function showMenu () { const loc = getCurrentLocation() - loc.path[3] = space._id + loc.path[4] = space._id navigate(loc) } - $: showMenuButton = $location.path[3] === undefined + $: showMenuButton = $location.path[4] === undefined $: viewslist = viewlets.map((views) => { return { diff --git a/plugins/chunter-resources/src/components/ChannelView.svelte b/plugins/chunter-resources/src/components/ChannelView.svelte index 7edf823ba3..db60564f0d 100644 --- a/plugins/chunter-resources/src/components/ChannelView.svelte +++ b/plugins/chunter-resources/src/components/ChannelView.svelte @@ -79,7 +79,7 @@ function openThread (_id: Ref) { const loc = getCurrentLocation() - loc.path[3] = _id + loc.path[4] = _id navigate(loc) } diff --git a/plugins/chunter-resources/src/components/EditChannelDescriptionAttachments.svelte b/plugins/chunter-resources/src/components/EditChannelDescriptionAttachments.svelte index 8e36c43503..a819c1893e 100644 --- a/plugins/chunter-resources/src/components/EditChannelDescriptionAttachments.svelte +++ b/plugins/chunter-resources/src/components/EditChannelDescriptionAttachments.svelte @@ -96,7 +96,7 @@ class="showMoreAttachmentsButton" on:click={() => { const loc = getCurrentLocation() - loc.path[2] = 'fileBrowser' + loc.path[3] = 'fileBrowser' loc.query = channel ? { spaceId: channel._id } : {} navigate(loc) }} diff --git a/plugins/chunter-resources/src/components/Message.svelte b/plugins/chunter-resources/src/components/Message.svelte index 3444820441..0c406c4445 100644 --- a/plugins/chunter-resources/src/components/Message.svelte +++ b/plugins/chunter-resources/src/components/Message.svelte @@ -113,13 +113,13 @@ const location = getCurrentLocation() location.fragment = message._id - location.path[2] = message.space + location.path[3] = message.space if (message.attachedToClass === chunter.class.Message) { - location.path.length = 4 - location.path[3] = message.attachedTo + location.path.length = 5 + location.path[4] = message.attachedTo } else { - location.path.length = 3 + location.path.length = 4 } await navigator.clipboard.writeText(`${window.location.origin}${locationToUrl(location)}`) } diff --git a/plugins/chunter-resources/src/components/ThreadView.svelte b/plugins/chunter-resources/src/components/ThreadView.svelte index 3ff60d0856..6ae52076d0 100644 --- a/plugins/chunter-resources/src/components/ThreadView.svelte +++ b/plugins/chunter-resources/src/components/ThreadView.svelte @@ -82,7 +82,7 @@ if (!message) { const loc = getCurrentLocation() - loc.path.length = 3 + loc.path.length = 4 navigate(loc) } }, diff --git a/plugins/chunter-resources/src/index.ts b/plugins/chunter-resources/src/index.ts index c5c21d88f1..a1c8bba82f 100644 --- a/plugins/chunter-resources/src/index.ts +++ b/plugins/chunter-resources/src/index.ts @@ -123,8 +123,8 @@ export async function ArchiveChannel (channel: Channel, evt: any, afterArchive?: if (afterArchive != null) afterArchive() const loc = getCurrentLocation() - if (loc.path[2] === channel._id) { - loc.path.length = 2 + if (loc.path[3] === channel._id) { + loc.path.length = 3 navigate(loc) } } diff --git a/plugins/chunter-resources/src/utils.ts b/plugins/chunter-resources/src/utils.ts index ce313a2fb5..0b6ecfd18f 100644 --- a/plugins/chunter-resources/src/utils.ts +++ b/plugins/chunter-resources/src/utils.ts @@ -58,9 +58,9 @@ export async function getDmName (client: Client, dm: Space): Promise { export function getSpaceLink (id: Ref): string { const loc = getCurrentLocation() - loc.path[1] = chunterId - loc.path[2] = id - loc.path.length = 3 + loc.path[2] = chunterId + loc.path[3] = id + loc.path.length = 4 loc.fragment = undefined return locationToUrl(loc) @@ -76,19 +76,19 @@ export function openMessageFromSpecial (message: ChunterMessage): void { const loc = getCurrentLocation() if (message.attachedToClass === chunter.class.ChunterSpace) { - loc.path.length = 3 - loc.path[2] = message.attachedTo - } else if (message.attachedToClass === chunter.class.Message) { loc.path.length = 4 - loc.path[2] = message.space loc.path[3] = message.attachedTo + } else if (message.attachedToClass === chunter.class.Message) { + loc.path.length = 5 + loc.path[3] = message.space + loc.path[4] = message.attachedTo } navigate(loc) } export function navigateToSpecial (specialId: string): void { const loc = getCurrentLocation() - loc.path[2] = specialId + loc.path[3] = specialId navigate(loc) } diff --git a/plugins/contact-resources/src/components/OrganizationCard.svelte b/plugins/contact-resources/src/components/OrganizationCard.svelte index 532993ea2a..610601118a 100644 --- a/plugins/contact-resources/src/components/OrganizationCard.svelte +++ b/plugins/contact-resources/src/components/OrganizationCard.svelte @@ -37,8 +37,8 @@ closePopup() closePanel() const loc = getCurrentLocation() - loc.path[2] = organization._id - loc.path.length = 3 + loc.path[3] = organization._id + loc.path.length = 4 navigate(loc) } }} diff --git a/plugins/login-resources/src/components/CreateWorkspaceForm.svelte b/plugins/login-resources/src/components/CreateWorkspaceForm.svelte index 51a32e4764..84b92a302d 100644 --- a/plugins/login-resources/src/components/CreateWorkspaceForm.svelte +++ b/plugins/login-resources/src/components/CreateWorkspaceForm.svelte @@ -14,11 +14,17 @@ // limitations under the License. --> diff --git a/plugins/recruit-resources/src/components/VacancyCard.svelte b/plugins/recruit-resources/src/components/VacancyCard.svelte index 99d5663f1f..0364875a24 100644 --- a/plugins/recruit-resources/src/components/VacancyCard.svelte +++ b/plugins/recruit-resources/src/components/VacancyCard.svelte @@ -52,8 +52,8 @@ closePopup() closePanel() const loc = getCurrentLocation() - loc.path[2] = vacancy._id - loc.path.length = 3 + loc.path[3] = vacancy._id + loc.path.length = 4 navigate(loc) } }} diff --git a/plugins/recruit-resources/src/components/VacancyPresenter.svelte b/plugins/recruit-resources/src/components/VacancyPresenter.svelte index 0e94f709af..fcc2acf306 100644 --- a/plugins/recruit-resources/src/components/VacancyPresenter.svelte +++ b/plugins/recruit-resources/src/components/VacancyPresenter.svelte @@ -36,8 +36,8 @@ function getLoc (): Location { const loc = getCurrentLocation() - loc.path[2] = value._id - loc.path.length = 3 + loc.path[3] = value._id + loc.path.length = 4 return loc } diff --git a/plugins/setting-resources/src/components/Settings.svelte b/plugins/setting-resources/src/components/Settings.svelte index 89941c95f4..11e7acb11a 100644 --- a/plugins/setting-resources/src/components/Settings.svelte +++ b/plugins/setting-resources/src/components/Settings.svelte @@ -17,6 +17,7 @@ import setting, { SettingsCategory } from '@anticrm/setting' import { Component, + fetchMetadataLocalStorage, getCurrentLocation, Label, location, @@ -29,6 +30,7 @@ import login from '@anticrm/login' import { AccountRole, getCurrentAccount } from '@anticrm/core' import { EmployeeAccount } from '@anticrm/contact' + import { setMetadata } from '@anticrm/platform' let category: SettingsCategory | undefined let categoryId: string = '' @@ -49,7 +51,7 @@ onDestroy( location.subscribe(async (loc) => { - categoryId = loc.path[2] + categoryId = loc.path[3] category = findCategory(categoryId) }) ) @@ -59,15 +61,20 @@ } function selectCategory (id: string): void { const loc = getCurrentLocation() - loc.path[2] = id - loc.path.length = 3 + loc.path[3] = id + loc.path.length = 4 navigate(loc) } function signOut (): void { - setMetadataLocalStorage(login.metadata.LoginToken, null) + const tokens = fetchMetadataLocalStorage(login.metadata.LoginTokens) + if (tokens !== null) { + const loc = getCurrentLocation() + delete tokens[loc.path[1]] + setMetadataLocalStorage(login.metadata.LoginTokens, tokens) + } + setMetadata(login.metadata.LoginToken, null) setMetadataLocalStorage(login.metadata.LoginEndpoint, null) setMetadataLocalStorage(login.metadata.LoginEmail, null) - setMetadataLocalStorage(login.metadata.CurrentWorkspace, null) navigate({ path: [login.component.LoginApp] }) } function selectWorkspace (): void { diff --git a/plugins/setting-resources/src/components/WorkspaceSettings.svelte b/plugins/setting-resources/src/components/WorkspaceSettings.svelte index b94c6f2c25..1ba9866b8e 100644 --- a/plugins/setting-resources/src/components/WorkspaceSettings.svelte +++ b/plugins/setting-resources/src/components/WorkspaceSettings.svelte @@ -44,15 +44,15 @@ onDestroy( location.subscribe(async (loc) => { - categoryId = loc.path[3] + categoryId = loc.path[4] category = findCategory(categoryId) }) ) function selectCategory (id: string): void { const loc = getCurrentLocation() - loc.path[3] = id - loc.path.length = 4 + loc.path[4] = id + loc.path.length = 5 navigate(loc) } diff --git a/plugins/tracker-resources/src/components/AccountPopup.svelte b/plugins/tracker-resources/src/components/AccountPopup.svelte index c54d47e104..4661cc7d8b 100644 --- a/plugins/tracker-resources/src/components/AccountPopup.svelte +++ b/plugins/tracker-resources/src/components/AccountPopup.svelte @@ -16,9 +16,18 @@ import contact, { Employee, EmployeeAccount, formatName } from '@anticrm/contact' import { getCurrentAccount } from '@anticrm/core' import login from '@anticrm/login' + import { setMetadata } from '@anticrm/platform' import { Avatar, createQuery } from '@anticrm/presentation' import setting, { SettingsCategory, settingId } from '@anticrm/setting' - import { closePopup, getCurrentLocation, Icon, Label, navigate, setMetadataLocalStorage } from '@anticrm/ui' + import { + closePopup, + fetchMetadataLocalStorage, + getCurrentLocation, + Icon, + Label, + navigate, + setMetadataLocalStorage + } from '@anticrm/ui' // const client = getClient() async function getItems (): Promise { @@ -43,17 +52,22 @@ function selectCategory (sp: SettingsCategory): void { closePopup() const loc = getCurrentLocation() - loc.path[1] = settingId - loc.path[2] = sp.name - loc.path.length = 3 + loc.path[2] = settingId + loc.path[3] = sp.name + loc.path.length = 4 navigate(loc) } function signOut (): void { - setMetadataLocalStorage(login.metadata.LoginToken, null) + const tokens = fetchMetadataLocalStorage(login.metadata.LoginTokens) + if (tokens !== null) { + const loc = getCurrentLocation() + delete tokens[loc.path[1]] + setMetadataLocalStorage(login.metadata.LoginTokens, tokens) + } + setMetadata(login.metadata.LoginToken, null) setMetadataLocalStorage(login.metadata.LoginEndpoint, null) setMetadataLocalStorage(login.metadata.LoginEmail, null) - setMetadataLocalStorage(login.metadata.CurrentWorkspace, null) navigate({ path: [login.component.LoginApp] }) } diff --git a/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte b/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte index 7312e3bff7..0f5d377bcc 100644 --- a/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte +++ b/plugins/tracker-resources/src/components/projects/ProjectPresenter.svelte @@ -20,8 +20,8 @@ export let value: WithLookup function navigateToProject () { const loc = getCurrentLocation() - loc.path[4] = value._id - loc.path.length = 5 + loc.path[5] = value._id + loc.path.length = 6 navigate(loc) } diff --git a/plugins/tracker-resources/src/components/projects/Projects.svelte b/plugins/tracker-resources/src/components/projects/Projects.svelte index e2a3ba033c..b7f58a4b9d 100644 --- a/plugins/tracker-resources/src/components/projects/Projects.svelte +++ b/plugins/tracker-resources/src/components/projects/Projects.svelte @@ -37,8 +37,7 @@ closeTooltip() closePopup() - projectId = loc.path[4] as Ref - console.log('PROJECT SELECTED', projectId) + projectId = loc.path[5] as Ref }) ) diff --git a/plugins/tracker-resources/src/issues.ts b/plugins/tracker-resources/src/issues.ts index 82588863dd..4a7b0cea99 100644 --- a/plugins/tracker-resources/src/issues.ts +++ b/plugins/tracker-resources/src/issues.ts @@ -1,7 +1,7 @@ import { Doc, Ref, TxOperations } from '@anticrm/core' import { getClient } from '@anticrm/presentation' import { Issue, Team, trackerId } from '@anticrm/tracker' -import { getPanelURI, Location } from '@anticrm/ui' +import { getCurrentLocation, getPanelURI, Location } from '@anticrm/ui' import { workbenchId } from '@anticrm/workbench' import tracker from './plugin' @@ -47,7 +47,8 @@ export async function copyToClipboard (object: Issue, ev: Event, { type }: { typ } export function generateIssueShortLink (issueId: string): string { - return `${window.location.host}/${workbenchId}/${trackerId}/${issueId}` + const location = getCurrentLocation() + return `${window.location.host}/${workbenchId}/${location.path[1]}/${trackerId}/${issueId}` } export async function generateIssueLocation (loc: Location, issueId: string): Promise { @@ -71,19 +72,20 @@ export async function generateIssueLocation (loc: Location, issueId: string): Pr return undefined } const appComponent = loc.path[0] ?? '' + const workspace = loc.path[1] ?? '' return { - path: [appComponent, trackerId, team._id, 'issues'], + path: [appComponent, workspace, trackerId, team._id, 'issues'], fragment: generateIssuePanelUri(issue) } } export async function resolveLocation (loc: Location): Promise { - const app = loc.path.length > 1 ? loc.path[1] : undefined + const app = loc.path.length > 2 ? loc.path[2] : undefined if (app !== trackerId) { return undefined } - const shortLink = loc.path.length > 2 ? loc.path[2] : undefined + const shortLink = loc.path.length > 3 ? loc.path[3] : undefined if (shortLink === undefined || shortLink === null) { return undefined } diff --git a/plugins/view-resources/src/components/ClassAttributeBar.svelte b/plugins/view-resources/src/components/ClassAttributeBar.svelte index 9bf57b4157..a4fe9fb24a 100644 --- a/plugins/view-resources/src/components/ClassAttributeBar.svelte +++ b/plugins/view-resources/src/components/ClassAttributeBar.svelte @@ -65,10 +65,10 @@ on:click={(ev) => { ev.stopPropagation() const loc = getCurrentLocation() - loc.path[1] = settingId - loc.path[2] = 'setting' - loc.path[3] = 'classes' - loc.path.length = 4 + loc.path[2] = settingId + loc.path[3] = 'setting' + loc.path[4] = 'classes' + loc.path.length = 5 loc.query = { _class } loc.fragment = undefined navigate(loc) diff --git a/plugins/workbench-resources/src/components/AccountPopup.svelte b/plugins/workbench-resources/src/components/AccountPopup.svelte index 69011aa5d3..e997383349 100644 --- a/plugins/workbench-resources/src/components/AccountPopup.svelte +++ b/plugins/workbench-resources/src/components/AccountPopup.svelte @@ -16,9 +16,10 @@ import contact, { Employee, EmployeeAccount, formatName } from '@anticrm/contact' import { AccountRole, getCurrentAccount } from '@anticrm/core' import login from '@anticrm/login' + import { setMetadata } from '@anticrm/platform' import { Avatar, createQuery } from '@anticrm/presentation' import setting, { settingId, SettingsCategory } from '@anticrm/setting' - import type { Action } from '@anticrm/ui' + import { Action, fetchMetadataLocalStorage } from '@anticrm/ui' import { closePanel, closePopup, @@ -62,17 +63,22 @@ closePopup() closePanel() const loc = getCurrentLocation() - loc.path[1] = settingId - loc.path[2] = sp.name - loc.path.length = 3 + loc.path[2] = settingId + loc.path[3] = sp.name + loc.path.length = 4 navigate(loc) } function signOut (): void { - setMetadataLocalStorage(login.metadata.LoginToken, null) + const tokens = fetchMetadataLocalStorage(login.metadata.LoginTokens) + if (tokens !== null) { + const loc = getCurrentLocation() + delete tokens[loc.path[1]] + setMetadataLocalStorage(login.metadata.LoginTokens, tokens) + } + setMetadata(login.metadata.LoginToken, null) setMetadataLocalStorage(login.metadata.LoginEndpoint, null) setMetadataLocalStorage(login.metadata.LoginEmail, null) - setMetadataLocalStorage(login.metadata.CurrentWorkspace, null) navigate({ path: [login.component.LoginApp] }) } @@ -98,9 +104,9 @@ function getURLCategory (sp: SettingsCategory): string { const loc = getCurrentLocation() - loc.path[1] = settingId - loc.path[2] = sp.name - loc.path.length = 3 + loc.path[2] = settingId + loc.path[3] = sp.name + loc.path.length = 4 return locationToUrl(loc) } diff --git a/plugins/workbench-resources/src/components/NavHeader.svelte b/plugins/workbench-resources/src/components/NavHeader.svelte index 4b0d9db18e..dd7ef79cce 100644 --- a/plugins/workbench-resources/src/components/NavHeader.svelte +++ b/plugins/workbench-resources/src/components/NavHeader.svelte @@ -14,18 +14,19 @@ -->
- {fetchMetadataLocalStorage(login.metadata.CurrentWorkspace)} + {loc.path[1]}
diff --git a/plugins/workbench-resources/src/components/SpaceBrowser.svelte b/plugins/workbench-resources/src/components/SpaceBrowser.svelte index 359c040ee8..c8a8bfecd9 100644 --- a/plugins/workbench-resources/src/components/SpaceBrowser.svelte +++ b/plugins/workbench-resources/src/components/SpaceBrowser.svelte @@ -107,7 +107,7 @@ async function view (space: Space): Promise { const loc = getCurrentLocation() - loc.path[2] = space._id + loc.path[3] = space._id navigate(loc) } diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 9a195b6722..49aac17ff9 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -26,7 +26,6 @@ closeTooltip, Component, DatePickerPopup, - fetchMetadataLocalStorage, getCurrentLocation, Label, location, @@ -39,7 +38,6 @@ showPopup, TooltipInstance } from '@anticrm/ui' - import login from '@anticrm/login' import view from '@anticrm/view' import { ActionContext, ActionHandler } from '@anticrm/view-resources' import type { Application, NavigatorModel, SpecialNavModel, ViewConfiguration } from '@anticrm/workbench' @@ -147,7 +145,7 @@ async function updateWindowTitle (loc: Location) { const title = (await getWindowTitle(loc)) ?? getMetadata(workbench.metadata.PlatformTitle) ?? 'Platform' - const ws = fetchMetadataLocalStorage(login.metadata.CurrentWorkspace) + const ws = loc.path[1] document.title = ws == null ? title : `${ws} - ${title}` } async function getWindowTitle (loc: Location) { @@ -169,9 +167,9 @@ } async function syncLoc (loc: Location): Promise { - const app = loc.path.length > 1 ? loc.path[1] : undefined - const space = loc.path.length > 2 ? (loc.path[2] as Ref) : undefined - const special = loc.path.length > 3 ? loc.path[3] : undefined + const app = loc.path.length > 2 ? loc.path[2] : undefined + const space = loc.path.length > 3 ? (loc.path[3] as Ref) : undefined + const special = loc.path.length > 4 ? loc.path[4] : undefined if (currentAppAlias !== app) { clear(1) @@ -195,13 +193,13 @@ const last = localStorage.getItem(`platform_last_loc_${app}`) if (last !== null) { const newLocation: Location = JSON.parse(last) - if (newLocation.path[2] != null) { - loc.path[2] = newLocation.path[2] as Ref - loc.path[3] = newLocation.path[3] - if (loc.path[3] == null) { - loc.path.length = 3 - } else { + if (newLocation.path[3] != null) { + loc.path[3] = newLocation.path[3] as Ref + loc.path[4] = newLocation.path[4] + if (loc.path[4] == null) { loc.path.length = 4 + } else { + loc.path.length = 5 } navigate(loc) return @@ -282,7 +280,7 @@ function closeAside (): void { const loc = getCurrentLocation() - loc.path.length = 3 + loc.path.length = 4 checkOnHide() navigate(loc) } diff --git a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte index c659809bfe..833f065d52 100644 --- a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte +++ b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte @@ -63,7 +63,7 @@ icon: IconSearch, action: async (_id: Ref): Promise => { const loc = getCurrentLocation() - loc.path[2] = 'spaceBrowser' + loc.path[3] = 'spaceBrowser' dispatch('open') navigate(loc) } diff --git a/plugins/workbench-resources/src/utils.ts b/plugins/workbench-resources/src/utils.ts index f2272ee92a..d4ea54a635 100644 --- a/plugins/workbench-resources/src/utils.ts +++ b/plugins/workbench-resources/src/utils.ts @@ -72,44 +72,44 @@ export async function doNavigate ( const client = getClient() switch (props.mode) { case 'app': - loc.path[1] = props.application ?? '' + loc.path[2] = props.application ?? '' if (props.special !== undefined) { - loc.path[2] = props.special - loc.path.length = 3 + loc.path[3] = props.special + loc.path.length = 4 } else { - loc.path.length = 2 + loc.path.length = 3 } navigate(loc) break case 'special': - if (props.application !== undefined && loc.path[1] !== props.application) { - loc.path[1] = props.application + if (props.application !== undefined && loc.path[2] !== props.application) { + loc.path[2] = props.application } - loc.path[2] = props.special ?? '' - loc.path.length = 3 + loc.path[3] = props.special ?? '' + loc.path.length = 4 navigate(loc) break case 'space': { if (props.space !== undefined) { - loc.path[2] = props.space + loc.path[3] = props.space } else { if (doc !== undefined && !Array.isArray(doc) && client.getHierarchy().isDerived(doc._class, core.class.Space)) { - loc.path[2] = doc._id + loc.path[3] = doc._id } } if (props.spaceSpecial !== undefined) { - loc.path[3] = props.spaceSpecial + loc.path[4] = props.spaceSpecial } if (props.spaceClass !== undefined) { - const ex = await client.findOne(props.spaceClass, { _id: loc.path[2] as Ref }) + const ex = await client.findOne(props.spaceClass, { _id: loc.path[3] as Ref }) if (ex === undefined) { const r = await client.findOne(props.spaceClass, {}) if (r !== undefined) { - loc.path[2] = r._id + loc.path[3] = r._id } } } - loc.path.length = 4 + loc.path.length = 5 navigate(loc) break diff --git a/tests/sanity/storage-dev.json b/tests/sanity/storage-dev.json index ff935e8a2f..f5a27d1f51 100644 --- a/tests/sanity/storage-dev.json +++ b/tests/sanity/storage-dev.json @@ -9,12 +9,8 @@ "value": "user1" }, { - "name": "login:metadata:LoginToken", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4" - }, - { - "name": "login:metadata:CurrentWorkspace", - "value": "sanity-ws" + "name": "login:metadata:LoginTokens", + "value": "{\"sanity-ws\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4\"}" }, { "name": "login:metadata:LoginEndpoint", diff --git a/tests/sanity/storage.json b/tests/sanity/storage.json index 0490446901..fac0839a45 100644 --- a/tests/sanity/storage.json +++ b/tests/sanity/storage.json @@ -9,12 +9,8 @@ "value": "user1" }, { - "name": "login:metadata:LoginToken", - "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4" - }, - { - "name": "login:metadata:CurrentWorkspace", - "value": "sanity-ws" + "name": "login:metadata:LoginTokens", + "value": "{\"sanity-ws\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4\"}" }, { "name": "login:metadata:LoginEndpoint", diff --git a/tests/sanity/tests/actions.spec.ts b/tests/sanity/tests/actions.spec.ts index 321c909dcc..f9490553f8 100644 --- a/tests/sanity/tests/actions.spec.ts +++ b/tests/sanity/tests/actions.spec.ts @@ -8,13 +8,13 @@ test.use({ test.describe('actions tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/sanity-ws`) }) test('action-new-candidate', async ({ page }) => { await page.click('[id="app-recruit\\:string\\:RecruitApplication"]') await page.click('text=Talents') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`) await page.click('td:has-text("Frontend Engineer")') @@ -29,26 +29,26 @@ test.describe('actions tests', () => { await page.click('[id="app-recruit\\:string\\:RecruitApplication"]') await page.click('text=Talents') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`) await page.press('body', 'Meta+k') await page.fill('[placeholder="type\\ to\\ filter\\.\\.\\."]', 'go to') expect(await page.locator('div.selectPopup :text("Go To Vacancies")').count()).toBe(1) await page.click('div.selectPopup :text("Go To Vacancies")') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/vacancies`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/vacancies`) }) test('action-switch-applications', async ({ page }) => { await page.click('[id="app-recruit\\:string\\:RecruitApplication"]') await page.click('text=Talents') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`) await page.press('body', 'Meta+k') await page.fill('[placeholder="type\\ to\\ filter\\.\\.\\."]', 'go to') expect(await page.locator('div.selectPopup :text("Go To Applications")').count()).toBe(1) await page.click('div.selectPopup :text("Go To Applications")') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/candidates`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/candidates`) }) }) diff --git a/tests/sanity/tests/contact.duplicate.spec.ts b/tests/sanity/tests/contact.duplicate.spec.ts index f0253dcc06..a50587c4dc 100644 --- a/tests/sanity/tests/contact.duplicate.spec.ts +++ b/tests/sanity/tests/contact.duplicate.spec.ts @@ -8,7 +8,7 @@ test.use({ test.describe('duplicate-org-test', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('test', async ({ page }) => { await page.click('[id="app-lead\\:string\\:LeadApplication"]') diff --git a/tests/sanity/tests/contacts.spec.ts b/tests/sanity/tests/contacts.spec.ts index b70d2658ef..16930735a4 100644 --- a/tests/sanity/tests/contacts.spec.ts +++ b/tests/sanity/tests/contacts.spec.ts @@ -8,7 +8,7 @@ test.use({ test.describe('contact tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('create-contact', async ({ page }) => { // Create a new context with the saved storage state. diff --git a/tests/sanity/tests/org.members.spec.ts b/tests/sanity/tests/org.members.spec.ts index d34f0b914a..a4e8123a0e 100644 --- a/tests/sanity/tests/org.members.spec.ts +++ b/tests/sanity/tests/org.members.spec.ts @@ -8,7 +8,7 @@ test.use({ test.describe('recruit tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('org-add-member', async ({ page }) => { diff --git a/tests/sanity/tests/recruit.review.spec.ts b/tests/sanity/tests/recruit.review.spec.ts index fcf52ec7e0..8029233a86 100644 --- a/tests/sanity/tests/recruit.review.spec.ts +++ b/tests/sanity/tests/recruit.review.spec.ts @@ -8,7 +8,7 @@ test.use({ test.describe('recruit review tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('create-review', async ({ page, context }) => { await page.click('[id="app-recruit\\:string\\:RecruitApplication"]') diff --git a/tests/sanity/tests/recruit.spec.ts b/tests/sanity/tests/recruit.spec.ts index 273d2e40c7..5137cbeaaf 100644 --- a/tests/sanity/tests/recruit.spec.ts +++ b/tests/sanity/tests/recruit.spec.ts @@ -8,7 +8,7 @@ test.use({ test.describe('recruit tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('create-candidate', async ({ page, context }) => { await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click() diff --git a/tests/sanity/tests/settings.spec.ts b/tests/sanity/tests/settings.spec.ts index c98c6ed65e..6430fed38c 100644 --- a/tests/sanity/tests/settings.spec.ts +++ b/tests/sanity/tests/settings.spec.ts @@ -7,18 +7,18 @@ test.use({ test.describe('contact tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('update-profile', async ({ page, context }) => { - // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) // Click #profile-button await page.click('#profile-button') await page.click('text=John Appleseed') - // await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting/setting`) + // await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/setting/setting`) // Click text=Edit profile // await page.click('text=Edit profile') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting/profile`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/setting/profile`) // Click [placeholder="Location"] await page.click('[placeholder="Location"]') // Fill [placeholder="Location"] @@ -37,8 +37,8 @@ test.describe('contact tests', () => { await page.click('.editor-container button:nth-child(3)') }) test('create-template', async ({ page }) => { - // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) // Click #profile-button await page.click('#profile-button') // Click button:has-text("Settings") @@ -70,8 +70,8 @@ test.describe('contact tests', () => { }) test('manage-status-templates', async ({ page }) => { - // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) // Click #profile-button await page.click('#profile-button') // await page.click('text=Workspace') diff --git a/tests/sanity/tests/tags.spec.ts b/tests/sanity/tests/tags.spec.ts index 6804f3509a..8f9609be90 100644 --- a/tests/sanity/tests/tags.spec.ts +++ b/tests/sanity/tests/tags.spec.ts @@ -8,17 +8,17 @@ test.use({ test.describe('recruit tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('create-candidate-with-skill', async ({ page }) => { - // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) // Click [id="app-recruit\:string\:RecruitApplication"] await page.click('[id="app-recruit\\:string\\:RecruitApplication"]') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit`) // Click text=Talents await page.click('text=Talents') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`) // Click button:has-text("Talent") await page.click('button:has-text("Talent")') // Fill [placeholder="John"] @@ -48,14 +48,14 @@ test.describe('recruit tests', () => { }) test('create-tag-candidate', async ({ page }) => { - // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + // Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) // Click [id="app-recruit\:string\:RecruitApplication"] await page.click('[id="app-recruit\\:string\\:RecruitApplication"]') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit`) // Click text=Skills await page.click('text=Skills') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/skills`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/skills`) // Click button:has-text("Skill") await page.click('button:has-text("Skill")') // Click [placeholder="Please\ type\ skill\ title"] @@ -78,7 +78,7 @@ test.describe('recruit tests', () => { await page.click('button:has-text("Create")') // Click text=Talents await page.click('text=Talents') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`) // Click button:has-text("Talent") await page.click('button:has-text("Talent")') // Click #add-tag div div diff --git a/tests/sanity/tests/tracker.projects.spec.ts b/tests/sanity/tests/tracker.projects.spec.ts index 7a5f6d4df0..2a177a9d2a 100644 --- a/tests/sanity/tests/tracker.projects.spec.ts +++ b/tests/sanity/tests/tracker.projects.spec.ts @@ -8,7 +8,7 @@ test.use({ test.describe('project tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('create-project-issue', async ({ page }) => { await page.click('[id="app-tracker\\:string\\:TrackerApplication"]') @@ -16,7 +16,7 @@ test.describe('project tests', () => { // Click text=Projects await page.click('text=Projects') await expect(page).toHaveURL( - `${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/tracker/tracker%3Ateam%3ADefaultTeam/projects` + `${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/tracker/tracker%3Ateam%3ADefaultTeam/projects` ) await page.click('button:has-text("Project")') await page.click('[placeholder="Project\\ name"]') @@ -39,7 +39,7 @@ test.describe('project tests', () => { await page.click('[id="app-tracker\\:string\\:TrackerApplication"]') await page.click('text=Projects') await expect(page).toHaveURL( - `${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/tracker/tracker%3Ateam%3ADefaultTeam/projects` + `${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/tracker/tracker%3Ateam%3ADefaultTeam/projects` ) await page.click('button:has-text("Project")') const prjId = 'project-' + generateId() diff --git a/tests/sanity/tests/tracker.spec.ts b/tests/sanity/tests/tracker.spec.ts index 1c9f708212..df96d29fd3 100644 --- a/tests/sanity/tests/tracker.spec.ts +++ b/tests/sanity/tests/tracker.spec.ts @@ -5,9 +5,9 @@ test.use({ }) async function navigate (page: Page): Promise { - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) await page.click('[id="app-tracker\\:string\\:TrackerApplication"]') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/tracker`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/tracker`) } interface IssueProps { diff --git a/tests/sanity/tests/workbench.spec.ts b/tests/sanity/tests/workbench.spec.ts index b354f3a633..0e620abb92 100644 --- a/tests/sanity/tests/workbench.spec.ts +++ b/tests/sanity/tests/workbench.spec.ts @@ -7,28 +7,28 @@ test.use({ test.describe('workbench tests', () => { test.beforeEach(async ({ page }) => { // Create user and workspace - await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`) + await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`) }) test('navigator', async ({ page }) => { // Click [id="app-recruit\:string\:RecruitApplication"] await page.click('[id="app-recruit\\:string\\:RecruitApplication"]') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit`) // Click text=Applications await page.click('text=Applications') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/candidates`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/candidates`) // Click text=Applications Application >> span await expect(page.locator('text=Applications Filter')).toBeVisible() await expect(page.locator('text="APP-1')).toBeDefined() // Click text=Talents await page.click('text=Talents') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`) await expect(page.locator('text=Andrey P.')).toBeVisible() // Click text=Vacancies await page.click('text=Vacancies') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/vacancies`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/vacancies`) // Click text=Software Engineer await page.click('text=Software Engineer') await expect(page.locator('text=Software Engineer')).toBeVisible() @@ -38,7 +38,7 @@ test.describe('workbench tests', () => { // Click [id="app-chunter\:string\:ApplicationLabelChunter"] await page.click('[id="app-chunter\\:string\\:ApplicationLabelChunter"]') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/chunter`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/chunter`) await page.click('text=general') @@ -46,7 +46,7 @@ test.describe('workbench tests', () => { await expect(page.locator('.textInput')).toBeVisible() await page.click('[id="app-contact\\:string\\:Contacts"]') - await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/contact`) + await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/contact`) // Click text=John Appleseed await expect(page.locator('text=John Appleseed')).toBeVisible() })