Skip to content

Commit

Permalink
EQMS-1202 Fix navigation in documents (#7630)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Onnikov <[email protected]>
  • Loading branch information
aonnikov authored Jan 13, 2025
1 parent 7702c5e commit ab28a62
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions plugins/controlled-documents-resources/src/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function generateDocumentLocation (

return {
loc: {
path: [appComponent, workspace, documentsId, doc.space],
path: [appComponent, workspace],
fragment: getPanelFragment(doc)
},
defaultLocation: {
Expand Down Expand Up @@ -86,7 +86,7 @@ async function generateProjectDocumentLocation (

return {
loc: {
path: [appComponent, workspace, documentsId, prjdoc.space],
path: [appComponent, workspace],
fragment: getPanelFragment(prjdoc)
},
defaultLocation: {
Expand Down
4 changes: 2 additions & 2 deletions plugins/document-resources/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ export async function generateLocation (loc: Location, id: Ref<Document>): Promi

return {
loc: {
path: [appComponent, workspace, documentId, doc.space],
path: [appComponent, workspace],
fragment: getPanelURI(document.component.EditDoc, doc._id, doc._class, 'content')
},
defaultLocation: {
path: [appComponent, workspace, documentId],
path: [appComponent, workspace],
fragment: getPanelURI(document.component.EditDoc, doc._id, doc._class, 'content')
}
}
Expand Down
5 changes: 4 additions & 1 deletion plugins/drive-resources/src/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ export async function generateFileLocation (loc: Location, id: Ref<File>): Promi

return {
loc: {
path: [appComponent, workspace, driveId],
path:
doc.parent !== undefined
? [appComponent, workspace, driveId, 'folder', doc.parent]
: [appComponent, workspace, driveId],
fragment: getPanelFragment(doc)
},
defaultLocation: {
Expand Down
16 changes: 9 additions & 7 deletions qms-tests/sanity/tests/model/documents/document-content-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DocumentHistoryPage } from './document-history-page'

export class DocumentContentPage extends DocumentCommonPage {
readonly page: Page
readonly panel: Locator
readonly buttonDocumentTitle: Locator
readonly buttonMoreActions: Locator
readonly textDocumentStatus: Locator
Expand Down Expand Up @@ -103,6 +104,7 @@ export class DocumentContentPage extends DocumentCommonPage {
constructor (page: Page) {
super(page)
this.page = page
this.panel = page.locator('.popupPanel-body')
this.buttonDocumentTitle = page.locator('button.version-item span.name')
this.buttonMoreActions = page.locator('.hulyHeader-buttonsGroup > .no-print > .antiButton').first()
this.textDocumentStatus = page.locator('button.version-item div.root span.label')
Expand Down Expand Up @@ -260,16 +262,16 @@ export class DocumentContentPage extends DocumentCommonPage {
}

async checkIfReviewersAndApproversAreVisible (): Promise<void> {
await expect(this.page.getByText('Appleseed John').first()).toBeVisible()
await expect(this.page.getByText('Dirak Kainin')).toBeVisible()
await expect(this.page.getByText('Appleseed John').nth(1)).toBeVisible()
await expect(this.panel.getByText('Appleseed John').first()).toBeVisible()
await expect(this.panel.getByText('Dirak Kainin')).toBeVisible()
await expect(this.panel.getByText('Appleseed John').nth(1)).toBeVisible()
}

async checkTheUserCantChangeReviewersAndApprovers (): Promise<void> {
await this.page.getByText('Appleseed John').first().click()
await expect(this.page.getByText('Dirak Kainin').nth(1)).not.toBeVisible()
await this.page.getByText('Dirak Kainin').click()
await expect(this.page.getByText('Dirak Kainin').nth(1)).not.toBeVisible()
await this.panel.getByText('Appleseed John').first().click()
await expect(this.panel.getByText('Dirak Kainin').nth(1)).not.toBeVisible()
await this.panel.getByText('Dirak Kainin').click()
await expect(this.panel.getByText('Dirak Kainin').nth(1)).not.toBeVisible()
}

async clickDocumentHeader (name: string): Promise<void> {
Expand Down

0 comments on commit ab28a62

Please sign in to comment.