graphdb-workbench-tests 4.0.0-TR10 → 4.0.0-TR11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import {LanguageSelectorSteps} from '../../steps/language-selector-steps.js';
3
3
  import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
4
4
  import {MainMenuSteps} from '../../steps/main-menu-steps.js';
5
5
  import {YasqeSteps} from '../../steps/yasgui/yasqe-steps.js';
6
+ import {YasrSteps} from '../../steps/yasgui/yasr-steps.js';
6
7
  import {ToasterSteps} from '../../steps/toaster-steps.js';
7
8
 
8
9
  const FILE_TO_IMPORT = 'resource-test-data.ttl';
@@ -57,6 +58,27 @@ describe('Graph Navigator', () => {
57
58
  GraphNavigatorSteps.getElement(CONSTRUCT_TARGET_LABEL).should('exist');
58
59
  });
59
60
 
61
+ it('should unmount and mount the diagram component without errors', () => {
62
+ // Given I have opened the Graph Navigator view, so its diagram component is already loaded.
63
+ GraphNavigatorSteps.visit();
64
+ GraphNavigatorSteps.getWorkspace().should('exist');
65
+ // And I have navigated to the SPARQL editor and executed a CONSTRUCT query.
66
+ MainMenuSteps.clickOnSparqlMenu();
67
+ YasqeSteps.getEditor().should('be.visible');
68
+ YasqeSteps.pasteQuery(CONSTRUCT_QUERY);
69
+ YasqeSteps.executeQuery();
70
+
71
+ // When I click on the "Graph Navigator" button.
72
+ YasrSteps.visualizeInGraphNavigator();
73
+
74
+ // Then I expect to be navigated to the Graph Navigator view, so it renders a second time
75
+ GraphNavigatorSteps.getComponent().should('exist');
76
+ // And I expect the computed graph to be seeded on the canvas: the subject and its related resource.
77
+ GraphNavigatorSteps.getElements().should('have.length', 2);
78
+ GraphNavigatorSteps.getElement(SEED_RESOURCE_LABEL).should('exist');
79
+ GraphNavigatorSteps.getElement(CONSTRUCT_TARGET_LABEL).should('exist');
80
+ });
81
+
60
82
  it('should keep the displayed resources when the language is switched', () => {
61
83
  // Given the Graph Navigator view is opened with a start resource that gets seeded on the canvas.
62
84
  GraphNavigatorSteps.visit(SEED_RESOURCE_ENCODED);
@@ -235,9 +257,35 @@ describe('Graph Navigator', () => {
235
257
  // When I switch to another repository.
236
258
  RepositorySelectorSteps.selectRepository(secondRepositoryId);
237
259
 
260
+ // Then I expect a confirmation that warns the diagram will be cleared.
261
+ GraphNavigatorSteps.getConfirmDialog().should('be.visible')
262
+ .and('contain', 'The diagram will be cleared.');
263
+
264
+ // When I cancel.
265
+ GraphNavigatorSteps.cancelDialog();
266
+
267
+ // Then I expect the repository, the canvas and the start resource in the URL to be kept.
268
+ GraphNavigatorSteps.getElements().should('have.length', 1);
269
+ GraphNavigatorSteps.verifyStartResourceUri(decodeURIComponent(SEED_RESOURCE_ENCODED));
270
+
271
+ // When I switch to another repository and confirm.
272
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
273
+ GraphNavigatorSteps.confirmDialog();
274
+
238
275
  // Then I expect the workspace to still be mounted, but the canvas to be cleared.
239
276
  GraphNavigatorSteps.getWorkspace().should('exist');
240
277
  GraphNavigatorSteps.getElements().should('not.exist');
278
+
279
+ // And I expect the URL to hold only the new repository.
280
+ GraphNavigatorSteps.verifyOnlyRepositoryParam(secondRepositoryId);
281
+
282
+ // When I refresh the page.
283
+ cy.reload();
284
+
285
+ // Then I expect the canvas to stay empty, because the start resource is no longer in the URL.
286
+ GraphNavigatorSteps.getWorkspace().should('exist');
287
+ GraphNavigatorSteps.getElements().should('not.exist');
288
+ GraphNavigatorSteps.verifyOnlyRepositoryParam(secondRepositoryId);
241
289
  });
242
290
  });
243
291
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "4.0.0-TR10",
3
+ "version": "4.0.0-TR11",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "4.0.0-TR10",
9
+ "version": "4.0.0-TR11",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "@bahmutov/cypress-code-coverage": "^2.7.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "4.0.0-TR10",
3
+ "version": "4.0.0-TR11",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -20,6 +20,10 @@ export class GraphNavigatorSteps extends BaseSteps {
20
20
  cy.getQueryParam('uri').should('eq', uri);
21
21
  }
22
22
 
23
+ static verifyOnlyRepositoryParam(repositoryId) {
24
+ cy.location('search').should('eq', `?repositoryId=${repositoryId}`);
25
+ }
26
+
23
27
  static getComponent() {
24
28
  return cy.get('graphwise-reactodia');
25
29
  }
@@ -142,4 +142,12 @@ export class YasrSteps extends BaseSteps {
142
142
  static toggleFullscreen() {
143
143
  YasrSteps.getFullscreenButton().click();
144
144
  }
145
+
146
+ static getGraphNavigatorButton() {
147
+ return YasrSteps.getYasr().find('.explore-graph-navigator');
148
+ }
149
+
150
+ static visualizeInGraphNavigator() {
151
+ YasrSteps.getGraphNavigatorButton().click();
152
+ }
145
153
  }