Skip to content

Commit 63db330

Browse files
pcdavidsbegaudeau
authored andcommitted
[5737] Fix workbench sharing URL to include all the opened representations
Bug: #5737 Signed-off-by: Pierre-Charles David <[email protected]>
1 parent 1aedfe1 commit 63db330

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Use `org.eclipse.emf.ecore.util.ECrossReferenceAdapter.getCrossReferenceAdapter(
121121
- https://github.com/eclipse-sirius/sirius-web/issues/5695[#5695] [diagram] Correctly update the selection when opening or closing the palette
122122
- https://github.com/eclipse-sirius/sirius-web/issues/5694[#5694] [trees] Ensure that expand all is available in read only workbenches
123123
- https://github.com/eclipse-sirius/sirius-web/issues/5245[#5245] [sirius-web] Ensure that representations cannot be forked in read only workbenches
124+
- https://github.com/eclipse-sirius/sirius-web/issues/5737[#5737] [sirius-web] Fix a regression where sharing a workbench URL did not include all the opened representations
124125

125126

126127
=== New Features

integration-tests-cypress/cypress/e2e/project/workbench/workbench-configuration.cy.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,23 @@ describe('Workbench Configuration Resolution', () => {
172172
workbench = new Workbench();
173173
});
174174

175+
it('Then the share URL contains the workbench configuration', () => {
176+
// Wait for the diagram to be actually loaded, otherwise if we start interacting
177+
// with the project menu and *then* the diagram appears, the menu does not open.
178+
cy.getByTestId('FreeForm - Motion_Engine').should('be.visible');
179+
cy.getByTestId(`navbar-title`).should('be.visible');
180+
cy.getByTestId('navigation-bar').findByTestId('more').should('exist').click();
181+
cy.getByTestId('share-project').should('exist').click();
182+
cy.getByTestId('share-path')
183+
.should('exist')
184+
.should(
185+
'include.text',
186+
encodeURIComponent(
187+
`"representationEditors":[{"representationId":"${topography2Id}","isActive":true},{"representationId":"${topography1Id}","isActive":false}]`
188+
)
189+
);
190+
});
191+
175192
it('Then, in the URL, the "workbenchConfiguration" search param is removed', () => {
176193
cy.url().should('not.include', 'workbenchConfiguration=');
177194
});

integration-tests-cypress/cypress/pages/Project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ProjectNavigationBar {
7777
}
7878

7979
public getShareButton(): Cypress.Chainable<JQuery<HTMLElement>> {
80-
return cy.getByTestId('share');
80+
return cy.getByTestId('share-project');
8181
}
8282

8383
public getShareDialog(): ShareProjectDialog {

packages/core/frontend/sirius-components-core/src/workbench/Workbench.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ export const Workbench = forwardRef<WorkbenchHandle | null, WorkbenchProps>(
293293
representations={state.representationsMetadata}
294294
displayedRepresentation={displayedRepresentationMetadata}
295295
onRepresentationClick={onRepresentationClick}
296+
ref={refRepresentationNavigationHandle}
296297
onClose={onClose}
297298
/>
298299
<RepresentationComponent

packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/navbar/context-menu/ShareProjectMenuItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const ShareProjectMenuItem = ({ workbenchHandle }: ShareProjectMenuItemPr
2626

2727
return (
2828
<>
29-
<MenuItem onClick={() => setState((prevState) => ({ ...prevState, isOpen: true }))} data-testid="share">
29+
<MenuItem onClick={() => setState((prevState) => ({ ...prevState, isOpen: true }))} data-testid="share-project">
3030
<ListItemIcon>
3131
<ShareIcon />
3232
</ListItemIcon>

0 commit comments

Comments
 (0)