graphdb-workbench-tests 4.0.0-TR2 → 4.0.0-TR21

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.
Files changed (118) hide show
  1. package/e2e-flaky/import/import-server-files-operations.spec.js +8 -30
  2. package/e2e-flaky/import/import-user-data-batch-operations.spec.js +7 -7
  3. package/e2e-flaky/import/import-user-data-url.spec.js +1 -1
  4. package/e2e-flaky/sparql-editor/lucene-connector.spec.js +1 -1
  5. package/e2e-legacy/cluster/cluster-configuration/cluster-configuration-multi-region.spec.js +27 -0
  6. package/e2e-legacy/cluster/edit-cluster-nodes-modal.spec.js +1 -1
  7. package/e2e-legacy/explore/graphs-overview/graphs.overview.spec.js +31 -2
  8. package/e2e-legacy/explore/visual-graph/visual.graph.spec.js +35 -4
  9. package/e2e-legacy/graph-navigator/graph-navigator-restrictions.spec.js +216 -0
  10. package/e2e-legacy/graph-navigator/graph-navigator.spec.js +447 -0
  11. package/e2e-legacy/guides/import-rdf-file/confirm-duplicate-rdf-file.spec.js +1 -1
  12. package/e2e-legacy/guides/main-menu/main-menu-guide.spec.js +6 -14
  13. package/e2e-legacy/guides/ttyg/configure-agent/configure-agent-guide.spec.js +26 -30
  14. package/e2e-legacy/guides/ttyg/edit-agent/edit-ttyg-agent-guide.spec.js +12 -20
  15. package/e2e-legacy/home/home-page-without-repositories.spec.js +3 -1
  16. package/e2e-legacy/home/home-page-without-selected-repository.spec.js +2 -1
  17. package/e2e-legacy/import/import-server-files-batch-operations.spec.js +38 -5
  18. package/e2e-legacy/import/import-server-files.spec.js +39 -23
  19. package/e2e-legacy/import/import-user-data-file-upload.spec.js +47 -22
  20. package/e2e-legacy/import/import-user-data-settings-dialog.spec.js +81 -10
  21. package/e2e-legacy/import/import-user-data-text-snippet.spec.js +6 -45
  22. package/e2e-legacy/import/import-user-data-url.spec.js +9 -5
  23. package/e2e-legacy/import/import-view.spec.js +2 -2
  24. package/e2e-legacy/monitor/global-operation-statuses-component.spec.js +13 -17
  25. package/e2e-legacy/rdf-version/rdf-version-accept-header.spec.js +145 -0
  26. package/e2e-legacy/repository/attach-remote-location.spec.js +7 -15
  27. package/e2e-legacy/repository/fedx-deprecation.spec.js +178 -0
  28. package/e2e-legacy/repository/ontop-repository.spec.js +25 -34
  29. package/e2e-legacy/repository/rename-repository-restrictions.spec.js +5 -1
  30. package/e2e-legacy/repository/repositories.spec.js +3 -3
  31. package/e2e-legacy/repository/repository-picker-tooltip.spec.js +72 -0
  32. package/e2e-legacy/repository/repository-selector-tooltip.spec.js +55 -0
  33. package/e2e-legacy/resource/resource.spec.js +177 -40
  34. package/e2e-legacy/setup/aclmanagement/create-rule.spec.js +14 -25
  35. package/e2e-legacy/setup/aclmanagement/delete-rule.spec.js +6 -6
  36. package/e2e-legacy/setup/aclmanagement/edit-rule.spec.js +15 -15
  37. package/e2e-legacy/setup/aclmanagement/render-rules.spec.js +1 -1
  38. package/e2e-legacy/setup/aclmanagement/reorder-rules.spec.js +2 -2
  39. package/e2e-legacy/setup/aclmanagement/revert-rules.spec.js +2 -2
  40. package/e2e-legacy/setup/aclmanagement/update-rules.spec.js +3 -3
  41. package/e2e-legacy/setup/aclmanagement/validate-uri.spec.js +152 -0
  42. package/e2e-legacy/setup/connectors/connectors-initial-state-with-selected-repository.spec.js +1 -1
  43. package/e2e-legacy/setup/plugins/plugins-without-repository.spec.js +1 -1
  44. package/e2e-legacy/setup/settings/my-settings.spec.js +25 -15
  45. package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +34 -25
  46. package/e2e-legacy/sparql-editor/saved-query/abort-query.spec.js +1 -1
  47. package/e2e-legacy/sparql-editor/sparql-editor-navigation.spec.js +219 -0
  48. package/e2e-legacy/sparql-editor/yasgui-tabs.spec.js +1 -1
  49. package/e2e-legacy/sparql-editor/yasr/download-as.spec.js +4 -7
  50. package/e2e-legacy/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +8 -8
  51. package/e2e-legacy/ttyg/chat-list.spec.js +1 -1
  52. package/e2e-legacy/ttyg/create-agent.spec.js +6 -4
  53. package/e2e-legacy/ttyg/create-chat.spec.js +1 -1
  54. package/e2e-legacy/ttyg/edit-agent.spec.js +57 -0
  55. package/e2e-legacy/ttyg/ttyg-initial-state-with-configured-api-key.spec.js +1 -1
  56. package/e2e-legacy/ttyg/ttyg-initial-state-with-selected-repository.spec.js +1 -1
  57. package/e2e-legacy/ttyg/ttyg-initial-state-without-repositories.spec.js +1 -1
  58. package/e2e-security/explore/visual-graph/graph-config-owner-actions.spec.js +52 -0
  59. package/e2e-security/setup/home/cookie-policy.spec.js +4 -0
  60. package/e2e-security/setup/license/license-loading.spec.js +57 -0
  61. package/e2e-security/setup/license/license-logout.spec.js +38 -0
  62. package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +1 -1
  63. package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +1 -1
  64. package/e2e-security/setup/users-and-access/user-and-access.spec.js +0 -1
  65. package/fixtures/cluster/3-nodes-cluster-group-status-no-leader.json +41 -0
  66. package/fixtures/cluster/cluster-config-with-tag.json +17 -0
  67. package/fixtures/connectors/get-connectors.json +0 -1
  68. package/fixtures/graph-navigator/graph-navigator-settings-invalid.ttl +149 -0
  69. package/fixtures/graph-navigator/graph-navigator-settings.ttl +148 -0
  70. package/fixtures/graphdb-import/wine.rdf +279 -285
  71. package/npm-shrinkwrap.json +1283 -1643
  72. package/package.json +10 -1
  73. package/steps/base-steps.js +4 -0
  74. package/steps/cluster/cluster-configuration-steps.js +4 -0
  75. package/steps/cookie-policy/cookie-consent-banner-steps.js +2 -2
  76. package/steps/error-steps.js +2 -2
  77. package/steps/explore/graphs-overview-steps.js +44 -0
  78. package/steps/graph-navigator-steps.js +145 -0
  79. package/steps/header-steps.js +5 -1
  80. package/steps/home-steps.js +3 -6
  81. package/steps/import/import-server-files-steps.js +8 -0
  82. package/steps/import/import-settings-dialog-steps.js +16 -0
  83. package/steps/import/import-steps.js +88 -17
  84. package/steps/import/import-test-constants.js +1 -1
  85. package/steps/import/import-user-data-steps.js +24 -24
  86. package/steps/language-selector-steps.js +4 -0
  87. package/steps/layout-steps.js +6 -0
  88. package/steps/login-steps.js +7 -3
  89. package/steps/main-menu-steps.js +14 -14
  90. package/steps/ontop-repository-steps.js +4 -0
  91. package/steps/page-restrictions-steps.js +24 -0
  92. package/steps/repositories/attach-repository-steps.js +2 -10
  93. package/steps/repository-picker-list-steps.js +58 -0
  94. package/steps/repository-selector-steps.js +20 -0
  95. package/steps/repository-steps.js +48 -9
  96. package/steps/resource/resource-steps.js +76 -9
  97. package/steps/setup/acl-management-steps.js +4 -24
  98. package/steps/setup/settings-steps.js +42 -0
  99. package/steps/setup/user-and-access-steps.js +18 -14
  100. package/steps/toaster-steps.js +4 -0
  101. package/steps/ttyg/ttyg-view-steps.js +1 -14
  102. package/steps/visual-graph-steps.js +8 -0
  103. package/steps/widgets/repository-errors-widget-steps.js +15 -2
  104. package/steps/yasgui/yasqe-steps.js +3 -1
  105. package/steps/yasgui/yasr-steps.js +8 -0
  106. package/stubs/browser-stubs.js +40 -0
  107. package/stubs/cluster/cluster-stubs.js +15 -1
  108. package/stubs/graph-navigator-stubs.js +27 -0
  109. package/stubs/license-stubs.js +11 -3
  110. package/stubs/repositories/repositories-stubs.js +44 -0
  111. package/stubs/yasgui/query-stubs.js +5 -0
  112. package/support/visual-graph-commands.js +19 -0
  113. package/e2e-legacy/home/solr-banner/solr-banner.spec.js +0 -137
  114. package/fixtures/graphdb-import/test-trigstar.trigs +0 -32
  115. package/fixtures/graphdb-import/test_turtlestar.ttls +0 -6
  116. package/fixtures/graphdb-import/turtlestar-data.ttls +0 -77
  117. package/steps/deprecation-banner/deprecation-banner-steps.js +0 -13
  118. package/steps/deprecation-steps.js +0 -13
@@ -245,49 +245,43 @@ describe('Ontop repositories', () => {
245
245
  context('Repository maintenance permission', () => {
246
246
 
247
247
  const PASSWORD = 'root';
248
- const REPOSITORY_MAINTAINER_USERNAME = 'repoMaintainer';
249
- const REPOSITORY_MANAGER_USERNAME = 'repoManager';
248
+ let repositoryMaintainerUsername;
250
249
 
251
250
  beforeEach(() => {
252
- cy.createUser({
253
- username: REPOSITORY_MAINTAINER_USERNAME,
254
- password: PASSWORD,
255
- grantedAuthorities: [
256
- `READ_REPO_${repositoryId}`,
257
- `MAINTAIN_REPO_${repositoryId}`,
258
- `WRITE_REPO_${repositoryId}`
259
- ]
260
- });
261
- cy.createUser({
262
- username: REPOSITORY_MANAGER_USERNAME,
263
- password: PASSWORD,
264
- grantedAuthorities: [
265
- 'ROLE_USER',
266
- 'ROLE_MONITORING',
267
- 'ROLE_REPO_MANAGER'
268
- ]
269
- });
270
- cy.switchOnSecurity();
251
+ repositoryMaintainerUsername = 'repo-maintainer-' + Date.now();
271
252
  });
272
253
 
273
254
  afterEach(() => {
274
255
  cy.loginAsAdmin()
275
256
  .then(() => {
276
- cy.deleteUser(REPOSITORY_MAINTAINER_USERNAME, true);
277
- cy.deleteUser(REPOSITORY_MANAGER_USERNAME, true);
257
+ cy.deleteUser(repositoryMaintainerUsername, true);
278
258
  cy.switchOffSecurity(true);
279
259
  });
280
260
  });
281
261
  it('should allow a repository maintainer to edit an Ontop repository', () => {
282
262
  RepositoryStubs.spyGetJDBCProperties();
283
263
  // GIVEN: An Ontop repository exists
284
- cy.loginAs(REPOSITORY_MANAGER_USERNAME, PASSWORD);
285
264
  OntopRepositorySteps.visitCreate();
286
265
  createOntopRepository(repositoryId);
266
+ RepositorySteps.waitUntilRepositoriesPageIsLoaded();
267
+ RepositorySteps.getRepositoryFromList(repositoryId).should('exist');
268
+
269
+ // AND: A user with maintenance permission for it is created after the repository,
270
+ // because creating a repository removes the permissions already granted for its ID.
271
+ cy.createUser({
272
+ username: repositoryMaintainerUsername,
273
+ password: PASSWORD,
274
+ grantedAuthorities: [
275
+ `READ_REPO_${repositoryId}`,
276
+ `MAINTAIN_REPO_${repositoryId}`,
277
+ `WRITE_REPO_${repositoryId}`
278
+ ]
279
+ });
280
+ cy.switchOnSecurity();
287
281
 
288
282
  // WHEN: I log in as a user with maintenance permission
289
- cy.loginAs(REPOSITORY_MAINTAINER_USERNAME, PASSWORD);
290
- RepositorySteps.visit(false);
283
+ cy.loginAs(repositoryMaintainerUsername, PASSWORD);
284
+ RepositorySteps.visit();
291
285
 
292
286
  // THEN: The repository is visible because the user can maintain it
293
287
  RepositorySteps.getRepositoryFromList(repositoryId).should('exist');
@@ -312,7 +306,7 @@ describe('Ontop repositories', () => {
312
306
  ModalDialogSteps.clickOnConfirmButton();
313
307
 
314
308
  // THEN: The changes are persisted
315
- RepositorySteps.visit(false);
309
+ RepositorySteps.visit();
316
310
  RepositorySteps.getRepositoryFromList(repositoryId).should('exist');
317
311
  RepositorySteps.editRepository(repositoryId);
318
312
  cy.wait('@getJDBCProperties');
@@ -326,8 +320,7 @@ describe('Ontop repositories', () => {
326
320
  .should('contain.value', 'ontop.cardinalityMode=LOOSE');
327
321
  // Saving of the OBDA file verifies that the repository maintainer can access rest/repositories/file/upload
328
322
  OntopRepositorySteps.editOBDAFile();
329
- ModalDialogSteps.getDialogBody()
330
- .find('textarea')
323
+ OntopRepositorySteps.getFileContentEditor()
331
324
  .invoke('val')
332
325
  .should('include', 'edited ODBA file');
333
326
  ModalDialogSteps.close();
@@ -339,8 +332,7 @@ describe('Ontop repositories', () => {
339
332
  ModalDialogSteps.getDialogHeader()
340
333
  .should('contain', 'Edit "OBDA or R2RML file" contents');
341
334
 
342
- ModalDialogSteps.getDialogBody()
343
- .find('textarea')
335
+ OntopRepositorySteps.getFileContentEditor()
344
336
  .type('{moveToStart}Add commentary for testing purpose');
345
337
 
346
338
  ModalDialogSteps.clickOKButton();
@@ -348,14 +340,13 @@ describe('Ontop repositories', () => {
348
340
  ModalDialogSteps.clickOnConfirmButton();
349
341
 
350
342
  // THEN: The OBDA file changes are persisted
351
- RepositorySteps.visit(false);
343
+ RepositorySteps.visit();
352
344
  RepositorySteps.getRepositoryFromList(repositoryId).should('exist');
353
345
  RepositorySteps.editRepository(repositoryId);
354
346
  cy.wait('@getJDBCProperties');
355
347
  OntopRepositorySteps.editOBDAFile();
356
348
 
357
- ModalDialogSteps.getDialogBody()
358
- .find('textarea')
349
+ OntopRepositorySteps.getFileContentEditor()
359
350
  .invoke('val')
360
351
  .should('include', 'Add commentary for testing purpose');
361
352
  });
@@ -2,6 +2,7 @@ import {RepositorySteps} from "../../steps/repository-steps";
2
2
  import {OntopRepositorySteps} from "../../steps/ontop-repository-steps";
3
3
  import {ToasterSteps} from "../../steps/toaster-steps";
4
4
  import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
5
+ import {RepositoriesStubs} from '../../stubs/repositories/repositories-stubs.js';
5
6
 
6
7
  describe('Repository rename restrictions', () => {
7
8
 
@@ -34,13 +35,14 @@ describe('Repository rename restrictions', () => {
34
35
  });
35
36
 
36
37
  it('should not allow renaming of an Ontop repository', () => {
38
+ RepositoriesStubs.spyGetRepository(repositoryId);
37
39
  // Given there is an Ontop repository.
38
40
  createOntopRepository(repositoryId);
39
41
 
40
42
  // When I open its edit page.
41
43
  RepositorySteps.visit();
42
44
  RepositorySteps.editRepository(repositoryId);
43
-
45
+ cy.wait('@getRepository');
44
46
  // Then the repository id should be rendered as read only,
45
47
  RepositorySteps.getGDBIdInput()
46
48
  .should('have.value', repositoryId)
@@ -62,6 +64,7 @@ describe('Repository rename restrictions', () => {
62
64
  });
63
65
 
64
66
  it('should not allow renaming of a FedX repository', () => {
67
+ RepositoriesStubs.spyGetRepository(repositoryId);
65
68
  // Given there is a FedX repository.
66
69
  cy.createRepository({id: memberRepositoryId});
67
70
  createFedxRepository(repositoryId, memberRepositoryId);
@@ -69,6 +72,7 @@ describe('Repository rename restrictions', () => {
69
72
  // When I open its edit page.
70
73
  RepositorySteps.visit();
71
74
  RepositorySteps.editRepository(repositoryId);
75
+ cy.wait('@getRepository');
72
76
 
73
77
  // Then the repository id should be rendered as read only,
74
78
  RepositorySteps.getGDBIdInput()
@@ -452,7 +452,7 @@ describe('Repositories', () => {
452
452
  .selectRDFFormat("TriG")
453
453
  .clickImportTextSnippetButton();
454
454
  ImportSettingsDialogSteps.import();
455
- ImportUserDataSteps.checkImportedResource(0, 'Text snippet');
455
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'Text snippet');
456
456
  // Import data that conforms with the shape - import is successfully
457
457
  // The newly imported file is first in the list
458
458
  ImportUserDataSteps
@@ -461,7 +461,7 @@ describe('Repositories', () => {
461
461
  .selectRDFFormat("Turtle")
462
462
  .clickImportTextSnippetButton();
463
463
  ImportSettingsDialogSteps.import();
464
- ImportUserDataSteps.checkImportedResource(0, 'Text snippet');
464
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'Text snippet');
465
465
  // Import data that does not conform with the shape - GraphDBShaclSailValidationException
466
466
  // The newly imported file is first in the list
467
467
  ImportUserDataSteps
@@ -470,7 +470,7 @@ describe('Repositories', () => {
470
470
  .selectRDFFormat("Turtle")
471
471
  .clickImportTextSnippetButton();
472
472
  ImportSettingsDialogSteps.import();
473
- ImportUserDataSteps.checkImportedResource(0, 'Text snippet', 'org.eclipse.rdf4j.sail.shacl.GraphDBShaclSailValidationException: Failed SHACL validation');
473
+ ImportUserDataSteps.checkImportedResourceByIndex(0, 'Text snippet', 'org.eclipse.rdf4j.sail.shacl.GraphDBShaclSailValidationException: Failed SHACL validation');
474
474
  });
475
475
 
476
476
  it('should allow editing of repository name if repository is in cluster', () => {
@@ -0,0 +1,72 @@
1
+ import {GraphNavigatorSteps} from '../../steps/graph-navigator-steps.js';
2
+ import {RepositoryPickerListSteps} from '../../steps/repository-picker-list-steps.js';
3
+ import {RepositoriesStubs} from '../../stubs/repositories/repositories-stubs.js';
4
+
5
+ describe('Repository picker repository information', () => {
6
+ let runningRepositoryId;
7
+ let notRunningRepositoryId;
8
+
9
+ beforeEach(() => {
10
+ runningRepositoryId = 'picker-tooltip-running-' + Date.now();
11
+ notRunningRepositoryId = 'picker-tooltip-not-running-' + Date.now();
12
+ cy.createRepository({id: runningRepositoryId});
13
+ cy.createRepository({id: notRunningRepositoryId});
14
+ // A new repository is not running. Requesting its size starts it.
15
+ cy.initializeRepository(runningRepositoryId);
16
+ RepositoriesStubs.spyGetRepositorySize(runningRepositoryId, 'runningRepositorySize');
17
+ RepositoriesStubs.spyGetRepositorySizeCalls(notRunningRepositoryId, 'notRunningRepositorySize');
18
+ // No repository is selected, so the view shows the repository picker with both repositories.
19
+ GraphNavigatorSteps.visit();
20
+ });
21
+
22
+ afterEach(() => {
23
+ cy.deleteRepository(runningRepositoryId);
24
+ cy.deleteRepository(notRunningRepositoryId);
25
+ });
26
+
27
+ it('should show the repository id and the statement counts of a running repository', () => {
28
+ // When I move the keyboard focus to a running repository in the picker
29
+ RepositoryPickerListSteps.focusRepository(runningRepositoryId);
30
+
31
+ // Then I expect the repository information to show the repository id
32
+ RepositoryPickerListSteps.getRepositoryInfoPart('title').should('have.text', runningRepositoryId);
33
+ // And the statement counts, loaded from the server
34
+ cy.wait('@runningRepositorySize');
35
+ RepositoryPickerListSteps.getRepositoryInfoPart('total').should('contain.text', 'Total statements');
36
+ RepositoryPickerListSteps.getRepositoryInfoPart('explicit').should('be.visible');
37
+ RepositoryPickerListSteps.getRepositoryInfoPart('inferred').should('be.visible');
38
+ RepositoryPickerListSteps.getRepositoryInfoPart('expansion-ratio').should('be.visible');
39
+ RepositoryPickerListSteps.getRepositoryInfoPart('inactive').should('not.exist');
40
+ });
41
+
42
+ it('should show that the statement counts are not available when the size request fails', () => {
43
+ // Given the server fails to return the size of the running repository
44
+ RepositoriesStubs.stubGetRepositorySizeError(runningRepositoryId, 'runningRepositorySizeError');
45
+
46
+ // When I move the keyboard focus to the running repository in the picker
47
+ RepositoryPickerListSteps.focusRepository(runningRepositoryId);
48
+
49
+ // Then I expect the repository information to show the repository id
50
+ RepositoryPickerListSteps.getRepositoryInfoPart('title').should('have.text', runningRepositoryId);
51
+ // And, after the request has failed, that the statement counts are not available
52
+ cy.wait('@runningRepositorySizeError');
53
+ RepositoryPickerListSteps.getRepositoryInfoPart('not-available')
54
+ .should('contain.text', 'Size info not available.');
55
+ // And neither the spinner nor the statement counts
56
+ RepositoryPickerListSteps.getRepositoryInfoPart('loading').should('not.exist');
57
+ RepositoryPickerListSteps.getRepositoryInfoPart('total').should('not.exist');
58
+ });
59
+
60
+ it('should show the activation message and not request the size of a repository that is not running', () => {
61
+ // When I move the keyboard focus to a repository that is not running in the picker
62
+ RepositoryPickerListSteps.focusRepository(notRunningRepositoryId);
63
+
64
+ // Then I expect the repository information to show the repository id and the activation message
65
+ RepositoryPickerListSteps.getRepositoryInfoPart('title').should('have.text', notRunningRepositoryId);
66
+ RepositoryPickerListSteps.getRepositoryInfoPart('inactive')
67
+ .should('contain.text', 'Activate the repository to view statement information');
68
+ RepositoryPickerListSteps.getRepositoryInfoPart('total').should('not.exist');
69
+ // And the size of the repository is not requested, because that would start the repository
70
+ cy.get('@notRunningRepositorySize').should('not.have.been.called');
71
+ });
72
+ });
@@ -0,0 +1,55 @@
1
+ import HomeSteps from '../../steps/home-steps.js';
2
+ import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
3
+ import {RepositoriesStubs} from '../../stubs/repositories/repositories-stubs.js';
4
+
5
+ describe('Repository selector tooltip', () => {
6
+ let runningRepositoryId;
7
+ let notRunningRepositoryId;
8
+
9
+ beforeEach(() => {
10
+ runningRepositoryId = 'selector-tooltip-running-' + Date.now();
11
+ notRunningRepositoryId = 'selector-tooltip-not-running-' + Date.now();
12
+ cy.createRepository({id: runningRepositoryId});
13
+ cy.createRepository({id: notRunningRepositoryId});
14
+ // A new repository is not running. Requesting its size starts it.
15
+ cy.initializeRepository(runningRepositoryId);
16
+ RepositoriesStubs.spyGetRepositorySize(runningRepositoryId, 'runningRepositorySize');
17
+ RepositoriesStubs.spyGetRepositorySizeCalls(notRunningRepositoryId, 'notRunningRepositorySize');
18
+ // No repository is selected, so both repositories are in the menu of the selector.
19
+ HomeSteps.visit();
20
+ RepositorySelectorSteps.openRepositorySelectors();
21
+ });
22
+
23
+ afterEach(() => {
24
+ cy.deleteRepository(runningRepositoryId);
25
+ cy.deleteRepository(notRunningRepositoryId);
26
+ });
27
+
28
+ it('should show the repository id and the statement counts of a running repository', () => {
29
+ // When I hover a running repository in the selector
30
+ RepositorySelectorSteps.hoverRepositoryItem(runningRepositoryId);
31
+
32
+ // Then I expect the tooltip to show the repository id
33
+ RepositorySelectorSteps.getRepositoryTooltipPart('title').should('have.text', runningRepositoryId);
34
+ // And the statement counts, loaded from the server
35
+ cy.wait('@runningRepositorySize');
36
+ RepositorySelectorSteps.getRepositoryTooltipPart('total').should('contain.text', 'Total statements');
37
+ RepositorySelectorSteps.getRepositoryTooltipPart('explicit').should('be.visible');
38
+ RepositorySelectorSteps.getRepositoryTooltipPart('inferred').should('be.visible');
39
+ RepositorySelectorSteps.getRepositoryTooltipPart('expansion-ratio').should('be.visible');
40
+ RepositorySelectorSteps.getRepositoryTooltipPart('inactive').should('not.exist');
41
+ });
42
+
43
+ it('should show the activation message and not request the size of a repository that is not running', () => {
44
+ // When I hover a repository that is not running in the selector
45
+ RepositorySelectorSteps.hoverRepositoryItem(notRunningRepositoryId);
46
+
47
+ // Then I expect the tooltip to show the repository id and the activation message
48
+ RepositorySelectorSteps.getRepositoryTooltipPart('title').should('have.text', notRunningRepositoryId);
49
+ RepositorySelectorSteps.getRepositoryTooltipPart('inactive')
50
+ .should('contain.text', 'Activate the repository to view statement information');
51
+ RepositorySelectorSteps.getRepositoryTooltipPart('total').should('not.exist');
52
+ // And the size of the repository is not requested, because that would start the repository
53
+ cy.get('@notRunningRepositorySize').should('not.have.been.called');
54
+ });
55
+ });
@@ -1,5 +1,5 @@
1
1
  import HomeSteps from "../../steps/home-steps";
2
- import {ResourceSteps} from "../../steps/resource/resource-steps";
2
+ import {ResourceSteps, TRIPLE_TERM_ROLE_LABEL} from "../../steps/resource/resource-steps";
3
3
  import {QueryStubs} from "../../stubs/yasgui/query-stubs";
4
4
  import {VisualGraphSteps} from "../../steps/visual-graph-steps";
5
5
  import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
@@ -9,6 +9,7 @@ import {YasguiSteps} from "../../steps/yasgui/yasgui-steps";
9
9
  import {JsonLdModalSteps} from "../../steps/json-ld-modal-steps";
10
10
  import {GraphConfigStubs} from '../../stubs/graph-config-stubs.js';
11
11
  import {VisualGraphSplitButtonSteps} from '../../steps/visual-graph-split-button-steps.js';
12
+ import {GraphNavigatorSteps} from '../../steps/graph-navigator-steps.js';
12
13
 
13
14
  const FILE_TO_IMPORT = 'resource-test-data.ttl';
14
15
  const SUBJECT_RESOURCE_ENCODED = 'http:%2F%2Fexample.com%2Fontology%23CustomerLoyalty';
@@ -17,7 +18,36 @@ const PREDICATE_SOURCE = 'http:%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23subCl
17
18
  const CONTEXT_EXPLICIT = 'http://www.ontotext.com/explicit';
18
19
  const OBJECT_RESOURCE = 'http:%2F%2Fexample.com%2Fontology%23Metric';
19
20
  const IMPLICIT_EXPLICIT_RESOURCE = 'http:%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type';
20
- const TRIPLE_RESOURCE = '%3C%3C%3Chttp:%2F%2Fexample.com%2Fresource%2Fperson%2FW6J1827%3E%20%3Chttp:%2F%2Fexample.com%2Fontology%23hasAddress%3E%20%3Chttp:%2F%2Fexample.com%2Fresource%2Fperson%2FW6J1827%2Faddress%3E%3E%3E';
21
+ // A triple term in the SPARQL 1.2 syntax. The resource view expects it wrapped in <<( )>>.
22
+ const TRIPLE_RESOURCE_DECODED = '<<(<http://example.com/resource/person/W6J1827> <http://example.com/ontology#hasAddress> <http://example.com/resource/person/W6J1827/address>)>>';
23
+ const TRIPLE_RESOURCE_ENCODED = encodeURIComponent(TRIPLE_RESOURCE_DECODED);
24
+ const TRIPLE_RESOURCE_LOCAL_NAMES = '<<(<W6J1827> <hasAddress> <address>)>>';
25
+ // A triple term whose object is a literal. It is deliberately not part of the test data, because it is
26
+ // used only to verify that shortening the IRIs of a triple term leaves its literals untouched.
27
+ const LITERAL_TRIPLE_RESOURCE_DECODED = '<<(<http://example.com/resource/person/W6J1827> <http://example.com/ontology#firstName> "Burgunda")>>';
28
+ const LITERAL_TRIPLE_RESOURCE_ENCODED = encodeURIComponent(LITERAL_TRIPLE_RESOURCE_DECODED);
29
+ const LITERAL_TRIPLE_RESOURCE_LOCAL_NAMES = '<<(<W6J1827> <firstName> "Burgunda")>>';
30
+ // The number of statements the resource view lists for the triple term - the four statements which
31
+ // annotate it in the test data plus the "rdf:reifies" statement which binds its reifier to it.
32
+ const TRIPLE_RESOURCE_STATEMENTS_COUNT = 5;
33
+ // The query which the resource view builds for a triple term - it looks up all statements having the triple term as an object.
34
+ const TRIPLE_TERM_LOOKUP_QUERY = `SELECT ?s ?p ?tt
35
+ WHERE {
36
+ VALUES ?tt {
37
+ ${TRIPLE_RESOURCE_DECODED}
38
+ }
39
+ ?s ?p ?tt .
40
+ }`;
41
+ // The link which both the header and the target link of a triple term point to.
42
+ const TRIPLE_TERM_LOOKUP_HREF = `sparql?query=${encodeURIComponent(TRIPLE_TERM_LOOKUP_QUERY)}`;
43
+ // The statement counts of the test data. The data annotates eleven triples with the RDF 1.2 reification
44
+ // syntax (<<s p o>>), and GraphDB expands each of them to a reifier plus an "rdf:reifies" statement
45
+ // pointing at the triple term. Those eleven extra statements are the reason why these counts are higher
46
+ // than the ones expected before the SPARQL 1.2 support was added.
47
+ const EXPLICIT_TYPE_STATEMENTS_COUNT = 24;
48
+ const IMPLICIT_TYPE_STATEMENTS_COUNT = 68;
49
+ const ALL_TYPE_STATEMENTS_COUNT = EXPLICIT_TYPE_STATEMENTS_COUNT + IMPLICIT_TYPE_STATEMENTS_COUNT;
50
+ const EXPLICIT_GRAPH_STATEMENTS_COUNT = 97;
21
51
 
22
52
  describe('Resource view', () => {
23
53
  let repositoryId;
@@ -34,7 +64,7 @@ describe('Resource view', () => {
34
64
  });
35
65
 
36
66
  it('should open resource view with active role tab depend on url role parameter', () => {
37
- ResourceSteps.getAllRoles().forEach((role) => {
67
+ ResourceSteps.getPlainResourceRoles().forEach((role) => {
38
68
  ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}&role=${role}`);
39
69
  ResourceSteps.verifyActiveRoleTab(role);
40
70
  });
@@ -58,7 +88,7 @@ describe('Resource view', () => {
58
88
  YasrSteps.getResults().should('have.length', 6);
59
89
 
60
90
  // When I turn off showing of blank nodes.
61
- ResourceSteps.clickOnShowBlankNodesButton();
91
+ ResourceSteps.clickOnShowBlankNodesCheckbox();
62
92
 
63
93
  // Then I expect to see all triples including this with blank node.
64
94
  YasrSteps.getResults().should('have.length', 5);
@@ -75,6 +105,18 @@ describe('Resource view', () => {
75
105
  VisualGraphSteps.verifyUrl();
76
106
  });
77
107
 
108
+ it('should open the Graph Navigator view when click on the "Graph Navigator" button', () => {
109
+ // When I am on resource view and page loaded a resource.
110
+ ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}`);
111
+
112
+ // When I click on "Graph Navigator" button.
113
+ ResourceSteps.clickOnVisualizeGraphNavigatorButton();
114
+
115
+ // Then I expect to be redirected to the Graph Navigator view with the resource as the start uri.
116
+ GraphNavigatorSteps.verifyUrl();
117
+ GraphNavigatorSteps.verifyStartResourceUri(SUBJECT_RESOURCE);
118
+ });
119
+
78
120
  it('should open graphs-visualizations view when select a graph configuration', () => {
79
121
  // When I am on resource view and page loaded a resource.
80
122
  ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}&role=subject`);
@@ -98,29 +140,29 @@ describe('Resource view', () => {
98
140
  ResourceSteps.visit(`uri=${IMPLICIT_EXPLICIT_RESOURCE}&role=all`);
99
141
 
100
142
  // Then I expect to see all triples of explicit context, because default value of the dropdown is "Explicit only".
101
- YasrSteps.getResults().should('have.length', 24);
143
+ YasrSteps.getResults().should('have.length', EXPLICIT_TYPE_STATEMENTS_COUNT);
102
144
  YasrSteps.getResultLink(0, 4).should('contain', CONTEXT_EXPLICIT);
103
145
 
104
146
  // When I chose to display implicit only.
105
147
  ResourceSteps.selectImplicitOnlyInference();
106
148
 
107
149
  // Then I expect triples of implicit context to be displayed only.
108
- YasrSteps.getResults().should('have.length', 67);
150
+ YasrSteps.getResults().should('have.length', IMPLICIT_TYPE_STATEMENTS_COUNT);
109
151
 
110
152
  // When I chose to display both context.
111
153
  ResourceSteps.selectExplicitAndImplicitInference();
112
154
 
113
155
  // Then I expect the triples of both context to be displayed.
114
- YasrSteps.getResults().should('have.length', 91);
156
+ YasrSteps.getResults().should('have.length', ALL_TYPE_STATEMENTS_COUNT);
115
157
 
116
158
  // When I chose to display explicit context only.
117
159
  ResourceSteps.selectExplicitOnlyInference();
118
160
 
119
161
  // Then I expect triples of explicit context to be displayed only.
120
- YasrSteps.getResults().should('have.length', 24);
162
+ YasrSteps.getResults().should('have.length', EXPLICIT_TYPE_STATEMENTS_COUNT);
121
163
  });
122
164
 
123
- context('Same as', () => {
165
+ describe('Same as', () => {
124
166
 
125
167
  it('should display sameAs button when is enabled by user settings', () => {
126
168
  // When I am on resource view and page loaded a resource that has triplets in explicit and implicit context,
@@ -190,7 +232,7 @@ describe('Resource view', () => {
190
232
  });
191
233
  });
192
234
 
193
- context('Role tabs', () => {
235
+ describe('Role tabs', () => {
194
236
 
195
237
  it('should list the triples of a resource used as subject', () => {
196
238
  // When I am on resource view,
@@ -330,7 +372,7 @@ describe('Resource view', () => {
330
372
  ResourceSteps.selectContextRole();
331
373
 
332
374
  // Then I expect to see all triples of resource without mater of its role,
333
- YasrSteps.getResults().should('have.length', 86);
375
+ YasrSteps.getResults().should('have.length', EXPLICIT_GRAPH_STATEMENTS_COUNT);
334
376
  // and inference dropdown should be disabled.
335
377
  ResourceSteps.getInferenceSelectElement().should('be.disabled');
336
378
 
@@ -338,50 +380,145 @@ describe('Resource view', () => {
338
380
  ResourceSteps.selectAllRole();
339
381
 
340
382
  // Then I expect to see all triples of resource without mater of its role.
341
- YasrSteps.getResults().should('have.length', 86);
383
+ YasrSteps.getResults().should('have.length', EXPLICIT_GRAPH_STATEMENTS_COUNT);
384
+ });
385
+
386
+ it('should keep all role tabs enabled when the resource is not a triple term', () => {
387
+ // When I load a resource which is not a triple term.
388
+ ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}&role=subject`);
389
+
390
+ // Then I expect all role tabs to be enabled,
391
+ ResourceSteps.getPlainResourceRoles().forEach((role) => ResourceSteps.verifyRoleTabEnabled(role));
392
+
393
+ // and the triple term links to not be rendered,
394
+ ResourceSteps.getTripleResourceLink().should('not.exist');
395
+ ResourceSteps.getTargetLink().should('not.exist');
396
+
397
+ // but the source link of a plain resource to be rendered instead.
398
+ ResourceSteps.getSourceLink().should('exist');
399
+ });
400
+
401
+ it('should not offer the "triple term" role tab when the resource is not a triple term', () => {
402
+ // When I load a resource which is not a triple term.
403
+ ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}&role=subject`);
404
+
405
+ // Then I expect the "triple term" tab to not be rendered at all, because that role
406
+ // applies to triple terms only,
407
+ ResourceSteps.verifyRoleTabMissing(TRIPLE_TERM_ROLE_LABEL);
408
+ // and only the roles of a plain resource to be offered.
409
+ ResourceSteps.getRoleTabs().should('have.length', ResourceSteps.getPlainResourceRoles().length);
410
+ });
411
+
412
+ it('should fall back to the subject role when the url asks for the "triple term" role of a plain resource', () => {
413
+ // When I load a resource which is not a triple term with the triple term role.
414
+ ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}&role=triple-term`);
415
+
416
+ // Then I expect the role to fall back to the default one,
417
+ ResourceSteps.verifyActiveRoleTab('subject');
418
+ // and the role url parameter to be corrected as well.
419
+ cy.getQueryParam('role').should('eq', 'subject');
420
+
421
+ // And I expect the triples of the resource as subject to be listed.
422
+ YasrSteps.getResults().should('have.length', 1);
423
+ YasrSteps.getResultLink(0, 1).should('contain', SUBJECT_RESOURCE);
342
424
  });
343
425
  });
344
426
 
345
- context('Triple resource', () => {
346
- it('should show triple resource', () => {
427
+ describe('Triple resource', () => {
428
+ it('should show triple resource shortened in the header and in full as a target', () => {
347
429
  // When I visit resource view with triple resource.
348
- ResourceSteps.visit(`triple=${TRIPLE_RESOURCE}&role=subject`);
430
+ ResourceSteps.visit(`triple=${TRIPLE_RESOURCE_ENCODED}&role=subject`);
431
+
432
+ // Then I expect the header link to show the triple term with shortened IRIs,
433
+ ResourceSteps.verifyTrimmedText(ResourceSteps.getTripleResourceLink(), TRIPLE_RESOURCE_LOCAL_NAMES);
434
+ // and the full triple term to be shown as a tooltip.
435
+ ResourceSteps.getTripleResourceLink().should('have.attr', 'gdb-tooltip', TRIPLE_RESOURCE_DECODED);
349
436
 
350
- // Then I expect resource link to exist.
351
- ResourceSteps.getTripleResourceLink().should('contain.text', '<<<W6J1827> <hasAddress> <address>>>');
437
+ // And I expect the target link to show the triple term with its full IRIs.
438
+ ResourceSteps.verifyTrimmedText(ResourceSteps.getTargetLink(), TRIPLE_RESOURCE_DECODED);
352
439
 
353
- // And I expect to see data table
440
+ // And I expect the source link of a plain resource to not be rendered.
441
+ ResourceSteps.getSourceLink().should('not.exist');
442
+
443
+ // And I expect to see data table with the statements annotating the triple term.
354
444
  ResourceSteps.getDataTable().should('exist').and('be.visible');
355
- // When I click on the link.
356
- ResourceSteps.clickOnTripleResourceLink();
445
+ YasrSteps.getResults().should('have.length', TRIPLE_RESOURCE_STATEMENTS_COUNT);
446
+ });
357
447
 
358
- // Then I expect to see sparql query view,
359
- SparqlEditorSteps.verifyUrl();
360
- YasguiSteps.getTabs().should('have.length', 2);
361
- // and a describe query to be present
362
- YasqeSteps.getActiveTabQuery().should('contain', 'describe <<<http://example.com/resource/person/W6J1827> <http://example.com/ontology#hasAddress> <http://example.com/resource/person/W6J1827/address>>>');
448
+ it('should shorten only the IRIs of a triple term and leave its literals unchanged', () => {
449
+ // When I visit resource view with a triple term whose object is a literal.
450
+ ResourceSteps.visit(`triple=${LITERAL_TRIPLE_RESOURCE_ENCODED}&role=subject`);
363
451
 
452
+ // Then I expect the header link to show the IRIs shortened and the literal as it is,
453
+ ResourceSteps.verifyTrimmedText(ResourceSteps.getTripleResourceLink(), LITERAL_TRIPLE_RESOURCE_LOCAL_NAMES);
454
+ // and the target link to show the whole triple term as it is.
455
+ ResourceSteps.verifyTrimmedText(ResourceSteps.getTargetLink(), LITERAL_TRIPLE_RESOURCE_DECODED);
456
+ });
457
+
458
+ it('should point both the header and the target link to the triple term lookup query', () => {
364
459
  // When I visit resource view with triple resource.
365
- ResourceSteps.visit(`triple=${TRIPLE_RESOURCE}&role=subject`);
460
+ ResourceSteps.visit(`triple=${TRIPLE_RESOURCE_ENCODED}&role=subject`);
366
461
 
367
- // Then I expect target link to exist.
368
- ResourceSteps.getTargetLink().should('contain.text', '<<<http://example.com/resource/person/W6J1827> <http://example.com/ontology#hasAddress> <http://example.com/resource/person/W6J1827/address>>>');
462
+ // Then I expect both links to point to the sparql editor with the triple term lookup query.
463
+ ResourceSteps.getTripleResourceLink().should('have.attr', 'href', TRIPLE_TERM_LOOKUP_HREF);
464
+ ResourceSteps.getTargetLink().should('have.attr', 'href', TRIPLE_TERM_LOOKUP_HREF);
465
+ });
369
466
 
370
- // And I expect to see data table
371
- ResourceSteps.getDataTable().should('exist').and('be.visible');
372
- // When I click on the link.
373
- ResourceSteps.clickOnTripleResourceLink();
374
-
375
- // Then I expect to see sparql query view,
376
- SparqlEditorSteps.verifyUrl();
377
- YasguiSteps.getTabs().should('have.length', 2);
378
- // and a describe query to be present
379
- YasqeSteps.getActiveTabQuery().should('contain', 'describe <<<http://example.com/resource/person/W6J1827> <http://example.com/ontology#hasAddress> <http://example.com/resource/person/W6J1827/address>>>');
380
- YasguiSteps.getCurrentTab().should('contain', 'Unnamed 1');
467
+ it('should activate the "triple term" role tab and disable all other role tabs', () => {
468
+ // When I visit resource view with triple resource.
469
+ ResourceSteps.visit(`triple=${TRIPLE_RESOURCE_ENCODED}&role=subject`);
470
+
471
+ // Then I expect the "triple term" tab to be the active one, regardless of the role url parameter,
472
+ ResourceSteps.verifyActiveRoleTab(TRIPLE_TERM_ROLE_LABEL);
473
+ // and the role url parameter to be corrected to the triple term role.
474
+ cy.getQueryParam('role').should('eq', 'triple-term');
475
+
476
+ // And I expect all other role tabs to be disabled.
477
+ ResourceSteps.getRoleTabs().should('have.length', ResourceSteps.getAllRoles().length);
478
+ ResourceSteps.getPlainResourceRoles().forEach((role) => ResourceSteps.verifyRoleTabDisabled(role));
479
+
480
+ // When I click on a disabled role tab.
481
+ ResourceSteps.selectSubjectRole();
482
+
483
+ // Then I expect the role to remain unchanged.
484
+ ResourceSteps.verifyActiveRoleTab(TRIPLE_TERM_ROLE_LABEL);
485
+ cy.getQueryParam('role').should('eq', 'triple-term');
486
+ });
487
+
488
+ it('should activate the "triple term" role tab when the role url parameter is missing', () => {
489
+ // When I visit resource view with a triple resource and without a role parameter.
490
+ ResourceSteps.visit(`triple=${TRIPLE_RESOURCE_ENCODED}`);
491
+
492
+ // Then I expect the "triple term" tab to be the active one,
493
+ ResourceSteps.verifyActiveRoleTab(TRIPLE_TERM_ROLE_LABEL);
494
+ // and the role url parameter to be set to the triple term role.
495
+ cy.getQueryParam('role').should('eq', 'triple-term');
496
+ });
497
+
498
+ // The header link and the target link render the same triple term, so both of them have to lead
499
+ // to the same lookup query in the sparql editor.
500
+ [
501
+ {label: 'header', click: () => ResourceSteps.clickOnTripleResourceLink()},
502
+ {label: 'target', click: () => ResourceSteps.clickOnTargetLink()}
503
+ ].forEach(({label, click}) => {
504
+ it(`should open the sparql editor with a triple term lookup query when the ${label} link is clicked`, () => {
505
+ // When I visit resource view with triple resource.
506
+ ResourceSteps.visit(`triple=${TRIPLE_RESOURCE_ENCODED}&role=subject`);
507
+
508
+ // When I click on the link.
509
+ click();
510
+
511
+ // Then I expect to see sparql query view,
512
+ SparqlEditorSteps.verifyUrl();
513
+ YasguiSteps.getTabs().should('have.length', 2);
514
+ YasguiSteps.getCurrentTab().should('contain', 'Unnamed 1');
515
+ // and the triple term lookup query to be present.
516
+ YasqeSteps.getActiveTabQuery().should('eq', TRIPLE_TERM_LOOKUP_QUERY);
517
+ });
381
518
  });
382
519
  });
383
520
 
384
- context('Download as', () => {
521
+ describe('Download as', () => {
385
522
  it('should download as JSON-LD and then restore defaults', () => {
386
523
  // Given I am in the Resource view
387
524
  ResourceSteps.visit(`uri=${SUBJECT_RESOURCE_ENCODED}&role=subject`);