Skip to content

Commit

Permalink
[2133] Fix NPE in Related Elements view
Browse files Browse the repository at this point in the history
Since #2032, `self` is a single element, not a list.

Bug: #2133
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
  • Loading branch information
pcdavid authored and AxelRICHARD committed Jun 30, 2023
1 parent 587d2e3 commit 6027063
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -35,6 +35,7 @@ An absent/empty candidates expression now simply means the widget is empty.
- https://github.com/eclipse-sirius/sirius-components/issues/2067[#2064] [view] Enable completion support and other text field customizations for custom widgets
- https://github.com/eclipse-sirius/sirius-components/issues/2092[#2092] [form] Fix support for help expressions on the _FlexboxContainer_ widget
- https://github.com/eclipse-sirius/sirius-components/issues/2088[#2088] [tree] Fix initial value of the tree filter bar
- https://github.com/eclipse-sirius/sirius-components/issues/2133[#2133] [workbench] Fix NPE in Related Elements view

=== New Features

Expand Down
@@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright (c) 2023 Obeo.
* This program and the accompanying materials
* are made available under the erms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/

/**
* This test suite will be used to validate the proper lifecycle of our application.
*
* For that, we will open and close in various ways several representations and we will evaluate if we have
* the proper number of representations and if they behave properly.
*/
describe('/projects/:projectId/edit - Related ELements View', () => {
beforeEach(() => {
cy.deleteAllProjects();
cy.createProject('Cypress Project').then((res) => {
const projectId = res.body.data.createProject.project.id;
cy.wrap(projectId).as('projectId');
const robot_flow_id = 'c26b6086-b444-3ee6-b8cd-9a4fde5956a7';

cy.createDocument(projectId, robot_flow_id, 'robot').then(() => {
cy.visit(`/projects/${projectId}/edit`);
});
});
});

it('can open the related elements view', function () {
cy.getByTestId('robot').dblclick();
cy.getByTestId('Robot').dblclick();
cy.getByTestId('viewselector-Related Elements').click();
cy.getByTestId('view-Related Elements').within(() => {
cy.getByTestId('form').should('exist');
});
});
});
Expand Up @@ -62,9 +62,6 @@ public FormDescription getFormDescription() {

// @formatter:off
Function<VariableManager, String> targetObjectIdProvider = variableManager -> variableManager.get(VariableManager.SELF, Object.class)
.filter(self -> self instanceof List<?>)
.map(self -> (List<?>) self)
.flatMap(self -> self.stream().findFirst())
.map(this.objectService::getId)
.orElse(null);

Expand Down

0 comments on commit 6027063

Please sign in to comment.