graphdb-workbench-tests 3.5.3 → 4.0.0-RC1

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 (136) hide show
  1. package/cypress-guides.config.js +45 -0
  2. package/e2e-flaky/import/import-server-files-operations.spec.js +8 -30
  3. package/e2e-flaky/import/import-user-data-batch-operations.spec.js +7 -7
  4. package/e2e-flaky/import/import-user-data-url.spec.js +1 -1
  5. package/e2e-flaky/sparql-editor/lucene-connector.spec.js +1 -1
  6. package/e2e-legacy/explore/graphs-overview/graphs.overview.spec.js +31 -2
  7. package/e2e-legacy/explore/visual-graph/visual.graph.spec.js +35 -4
  8. package/e2e-legacy/graph-navigator/graph-navigator-restrictions.spec.js +216 -0
  9. package/e2e-legacy/graph-navigator/graph-navigator.spec.js +520 -0
  10. package/e2e-legacy/guides/import-rdf-file/confirm-duplicate-rdf-file.spec.js +1 -1
  11. package/e2e-legacy/guides/main-menu/main-menu-guide.spec.js +6 -14
  12. package/e2e-legacy/guides/ttyg/configure-agent/configure-agent-guide.spec.js +27 -32
  13. package/e2e-legacy/guides/ttyg/edit-agent/edit-ttyg-agent-guide.spec.js +12 -20
  14. package/e2e-legacy/help/rest-api-documentatio/rest-api-documentation-theme.spec.js +50 -0
  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 +83 -23
  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-user-data.spec.js +8 -8
  24. package/e2e-legacy/import/import-view.spec.js +2 -2
  25. package/e2e-legacy/import/initial-state/import-page-with-selected-repositor.js +1 -1
  26. package/e2e-legacy/import/initial-state/import-page-with-selected-repository-without-imported-files.js +1 -1
  27. package/e2e-legacy/monitor/global-operation-statuses-component.spec.js +13 -17
  28. package/e2e-legacy/monitor/query-and-updates/queries-and-updates-with-repository.spec.js +16 -0
  29. package/e2e-legacy/rdf-version/rdf-version-accept-header.spec.js +145 -0
  30. package/e2e-legacy/repository/attach-remote-location.spec.js +7 -15
  31. package/e2e-legacy/repository/fedx-deprecation.spec.js +178 -0
  32. package/e2e-legacy/repository/ontop-repository.spec.js +25 -34
  33. package/e2e-legacy/repository/rename-repository-restrictions.spec.js +129 -0
  34. package/e2e-legacy/repository/repositories.spec.js +27 -10
  35. package/e2e-legacy/repository/repository-picker-tooltip.spec.js +72 -0
  36. package/e2e-legacy/repository/repository-selector-tooltip.spec.js +55 -0
  37. package/e2e-legacy/resource/resource.spec.js +177 -40
  38. package/e2e-legacy/setup/aclmanagement/create-rule.spec.js +14 -25
  39. package/e2e-legacy/setup/aclmanagement/delete-rule.spec.js +6 -6
  40. package/e2e-legacy/setup/aclmanagement/edit-rule.spec.js +15 -15
  41. package/e2e-legacy/setup/aclmanagement/render-rules.spec.js +1 -1
  42. package/e2e-legacy/setup/aclmanagement/reorder-rules.spec.js +2 -2
  43. package/e2e-legacy/setup/aclmanagement/revert-rules.spec.js +2 -2
  44. package/e2e-legacy/setup/aclmanagement/update-rules.spec.js +3 -3
  45. package/e2e-legacy/setup/aclmanagement/validate-uri.spec.js +152 -0
  46. package/e2e-legacy/setup/connectors/connectors-initial-state-with-selected-repository.spec.js +1 -1
  47. package/e2e-legacy/setup/plugins/plugins-without-repository.spec.js +1 -1
  48. package/e2e-legacy/setup/settings/my-settings.spec.js +25 -15
  49. package/e2e-legacy/setup/users-and-access/user-and-access.spec.js +34 -24
  50. package/e2e-legacy/sparql-editor/actions/expand-results-over-sameas.spec.js +8 -8
  51. package/e2e-legacy/sparql-editor/actions/include-inferred-statements.spec.js +4 -4
  52. package/e2e-legacy/sparql-editor/actions/inferred-sameas.spec.js +2 -2
  53. package/e2e-legacy/sparql-editor/saved-query/abort-query.spec.js +1 -1
  54. package/e2e-legacy/sparql-editor/sparql-editor-navigation.spec.js +219 -0
  55. package/e2e-legacy/sparql-editor/yasgui-tabs.spec.js +1 -1
  56. package/e2e-legacy/sparql-editor/yasr/download-as.spec.js +4 -7
  57. package/e2e-legacy/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +8 -8
  58. package/e2e-legacy/ttyg/chat-list.spec.js +16 -1
  59. package/e2e-legacy/ttyg/chat-panel.spec.js +14 -0
  60. package/e2e-legacy/ttyg/chat-template-injection.spec.js +49 -0
  61. package/e2e-legacy/ttyg/create-chat.spec.js +1 -1
  62. package/e2e-legacy/ttyg/delete-agent.spec.js +14 -0
  63. package/e2e-legacy/ttyg/edit-agent.spec.js +8 -0
  64. package/e2e-legacy/ttyg/ttyg-initial-state-with-configured-api-key.spec.js +1 -1
  65. package/e2e-legacy/ttyg/ttyg-initial-state-with-selected-repository.spec.js +1 -1
  66. package/e2e-legacy/ttyg/ttyg-initial-state-without-repositories.spec.js +1 -1
  67. package/e2e-security/explore/visual-graph/graph-config-owner-actions.spec.js +52 -0
  68. package/e2e-security/repository/url-with-repository-id-parameter.spec.js +17 -0
  69. package/e2e-security/setup/home/cookie-policy.spec.js +4 -0
  70. package/e2e-security/setup/license/license-loading.spec.js +57 -0
  71. package/e2e-security/setup/license/license-logout.spec.js +38 -0
  72. package/e2e-security/setup/users-and-access/create-user-permissions.spec.js +1 -1
  73. package/e2e-security/setup/users-and-access/repo-admin-role.spec.js +1 -1
  74. package/e2e-security/setup/users-and-access/user-and-access.spec.js +0 -1
  75. package/eslint.config.js +5 -0
  76. package/fixtures/connectors/get-connectors.json +0 -1
  77. package/fixtures/graph-navigator/graph-navigator-settings-invalid.ttl +149 -0
  78. package/fixtures/graph-navigator/graph-navigator-settings.ttl +148 -0
  79. package/fixtures/graphdb-import/wine.rdf +279 -285
  80. package/fixtures/monitoring/get-active-queries-cluster-replicating.json +15 -0
  81. package/fixtures/ttyg/agent/get-agent-list-with-html-in-names.json +77 -0
  82. package/fixtures/ttyg/chats/get-chat-list-with-html-in-name.json +22 -0
  83. package/fixtures/ttyg/chats/get-chat-with-template-injection.json +27 -0
  84. package/npm-shrinkwrap.json +1264 -1265
  85. package/package.json +12 -2
  86. package/steps/application-steps.js +4 -0
  87. package/steps/base-steps.js +4 -0
  88. package/steps/cookie-policy/cookie-consent-banner-steps.js +2 -2
  89. package/steps/error-steps.js +2 -2
  90. package/steps/explore/graphs-overview-steps.js +44 -0
  91. package/steps/graph-navigator-steps.js +159 -0
  92. package/steps/header-steps.js +5 -1
  93. package/steps/home-steps.js +3 -6
  94. package/steps/import/import-server-files-steps.js +8 -0
  95. package/steps/import/import-settings-dialog-steps.js +16 -0
  96. package/steps/import/import-steps.js +94 -23
  97. package/steps/import/import-test-constants.js +1 -1
  98. package/steps/import/import-user-data-steps.js +26 -26
  99. package/steps/language-selector-steps.js +4 -0
  100. package/steps/layout-steps.js +6 -0
  101. package/steps/login-steps.js +7 -3
  102. package/steps/main-menu-steps.js +14 -14
  103. package/steps/monitoring/queries-and-updates-steps.js +9 -0
  104. package/steps/ontop-repository-steps.js +4 -0
  105. package/steps/page-restrictions-steps.js +24 -0
  106. package/steps/repositories/attach-repository-steps.js +2 -10
  107. package/steps/repository-picker-list-steps.js +58 -0
  108. package/steps/repository-selector-steps.js +20 -0
  109. package/steps/repository-steps.js +64 -9
  110. package/steps/resource/resource-steps.js +76 -9
  111. package/steps/rest-api-documentation-steps.js +23 -0
  112. package/steps/setup/acl-management-steps.js +4 -24
  113. package/steps/setup/settings-steps.js +42 -0
  114. package/steps/toaster-steps.js +4 -0
  115. package/steps/ttyg/chat-panel-steps.js +4 -0
  116. package/steps/ttyg/ttyg-view-steps.js +1 -14
  117. package/steps/visual-graph-steps.js +8 -0
  118. package/steps/widgets/repository-errors-widget-steps.js +15 -2
  119. package/steps/yasgui/yasqe-steps.js +5 -7
  120. package/steps/yasgui/yasr-steps.js +8 -0
  121. package/stubs/browser-stubs.js +40 -0
  122. package/stubs/graph-navigator-stubs.js +28 -0
  123. package/stubs/license-stubs.js +11 -3
  124. package/stubs/monitoring/queries-and-updates-stubs.js +5 -0
  125. package/stubs/repositories/repositories-stubs.js +44 -0
  126. package/stubs/ttyg/ttyg-stubs.js +3 -2
  127. package/stubs/yasgui/query-stubs.js +5 -0
  128. package/support/repository-commands.js +15 -0
  129. package/support/sparql-commands.js +2 -0
  130. package/support/visual-graph-commands.js +19 -0
  131. package/e2e-legacy/home/solr-banner/solr-banner.spec.js +0 -137
  132. package/fixtures/graphdb-import/test-trigstar.trigs +0 -32
  133. package/fixtures/graphdb-import/test_turtlestar.ttls +0 -6
  134. package/fixtures/graphdb-import/turtlestar-data.ttls +0 -77
  135. package/steps/deprecation-banner/deprecation-banner-steps.js +0 -13
  136. package/steps/deprecation-steps.js +0 -13
@@ -0,0 +1,219 @@
1
+ import {QueryStubs} from '../../stubs/yasgui/query-stubs.js';
2
+ import {SparqlEditorSteps} from '../../steps/sparql-editor-steps.js';
3
+ import {YasqeSteps} from '../../steps/yasgui/yasqe-steps.js';
4
+ import ImportSteps from '../../steps/import/import-steps.js';
5
+ import {MainMenuSteps} from '../../steps/main-menu-steps.js';
6
+ import {ModalDialogSteps} from '../../steps/modal-dialog-steps.js';
7
+ import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js';
8
+ import {LanguageSelectorSteps} from '../../steps/language-selector-steps.js';
9
+ import {UserAndAccessSteps} from '../../steps/setup/user-and-access-steps.js';
10
+ import {LoginSteps} from '../../steps/login-steps.js';
11
+ import {HeaderSteps} from '../../steps/header-steps.js';
12
+
13
+ const LONG_RUNNING_QUERY_DELAY = 10000;
14
+
15
+ describe('SPARQL Editor Navigation', () => {
16
+ let repositoryId;
17
+ let secondRepositoryId;
18
+ beforeEach(() => {
19
+ repositoryId = 'sparql-editor-' + Date.now();
20
+ QueryStubs.stubQueryCountResponse();
21
+ cy.createRepository({id: repositoryId});
22
+ cy.presetRepository(repositoryId);
23
+ QueryStubs.spyAbortQuery();
24
+ });
25
+
26
+ afterEach(() => {
27
+ cy.deleteRepository(repositoryId);
28
+ if (secondRepositoryId) {
29
+ cy.deleteRepository(secondRepositoryId);
30
+ }
31
+ });
32
+
33
+ it('should navigate to other view if user confirmed navigation', () => {
34
+ // GIVEN: I visit a page with the ontotext-yasgui-web-component on it.
35
+ SparqlEditorSteps.visitSparqlEditorPage();
36
+ MainMenuSteps.getMainMenu().should('be.visible');
37
+
38
+ // WHEN: I try to go to another view
39
+ MainMenuSteps.clickOnMenuImport();
40
+ // THEN: I expect to navigate because there is no running query
41
+ ImportSteps.getView().should('exist');
42
+
43
+ // WHEN: I return to the view with the ontotext-yasgui-web-component.
44
+ SparqlEditorSteps.visitSparqlEditorPage();
45
+ // AND: I run a long-running query
46
+ QueryStubs.stubLongRunningQuery(repositoryId, LONG_RUNNING_QUERY_DELAY);
47
+ YasqeSteps.executeQueryWithoutWaitingForResult();
48
+ // AND: I try to leave the page
49
+ MainMenuSteps.clickOnMenuImport();
50
+ // THEN: I expect to see a confirmation dialog
51
+ ModalDialogSteps.getDialog().should('exist');
52
+ ModalDialogSteps.getDialogBody().should('contain.text', 'You have running 1 query, that will be aborted.');
53
+
54
+ // WHEN: I cancel the dialog
55
+ ModalDialogSteps.cancel();
56
+ // THEN: I expect to stay on the same view
57
+ SparqlEditorSteps.verifyUrl();
58
+ ImportSteps.getView().should('not.exist');
59
+ // AND: I expect the query not to be aborted
60
+ cy.get('@abortQuery.all').should('have.length', 0);
61
+
62
+ // WHEN: I confirm leaving the page
63
+ MainMenuSteps.clickOnMenuImport();
64
+ ModalDialogSteps.getDialog().should('exist');
65
+ ModalDialogSteps.getDialogBody().should('contain.text', 'You have running 1 query, that will be aborted.');
66
+ ModalDialogSteps.confirm();
67
+ // THEN: I expect to navigate to the other view
68
+ ImportSteps.verifyUrl();
69
+ ImportSteps.getView().should('exist');
70
+ // AND: I expect the query to be aborted
71
+ cy.get('@abortQuery.all').should('have.length', 1);
72
+ });
73
+
74
+ it('should change active repository if user confirmed', () => {
75
+ // GIVEN: There are at least two repositories and one is selected
76
+ secondRepositoryId = 'sparql-editor-' + Date.now();
77
+ cy.createRepository({id: secondRepositoryId});
78
+
79
+ // WHEN: I visit a page with the ontotext-yasgui-web-component on it.
80
+ SparqlEditorSteps.visitSparqlEditorPage();
81
+ // AND: I run a long-running query
82
+ QueryStubs.stubLongRunningQuery(repositoryId, LONG_RUNNING_QUERY_DELAY);
83
+ YasqeSteps.executeQueryWithoutWaitingForResult();
84
+ // AND: I try to change the repository
85
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
86
+ // THEN: I expect to see a confirmation dialog
87
+ ModalDialogSteps.getDialog().should('exist');
88
+ ModalDialogSteps.getDialogBody().should('contain.text', 'You have running 1 query, that will be aborted.');
89
+
90
+ // WHEN: I cancel the dialog
91
+ ModalDialogSteps.cancel();
92
+ // THEN: I expect the repository not to be changed.
93
+ RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
94
+ // AND: I expect the query not to be aborted
95
+ cy.get('@abortQuery.all').should('have.length', 0);
96
+
97
+ // WHEN: I confirm changing of repository
98
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
99
+ ModalDialogSteps.getDialog().should('exist');
100
+ ModalDialogSteps.getDialogBody().should('contain.text', 'You have running 1 query, that will be aborted.');
101
+ ModalDialogSteps.confirm();
102
+ // THEN: I expect the active repository to be changed
103
+ RepositorySelectorSteps.getSelectedRepository().should('contain', secondRepositoryId);
104
+ // AND: I expect the query to be aborted
105
+ cy.get('@abortQuery.all').should('have.length', 1);
106
+
107
+ // WHEN: I change the repository again, but this time there is no running query
108
+ RepositorySelectorSteps.selectRepository(repositoryId);
109
+ // THEN: I expect the repository to be changed without confirmation, because there are no running queries.
110
+ RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
111
+ ModalDialogSteps.getDialog().should('not.exist');
112
+ });
113
+
114
+ it('should change application language if user confirmed', () => {
115
+ // GIVEN: I visit a page with the ontotext-yasgui-web-component on it, in English. The test switches the language to French.
116
+ SparqlEditorSteps.visitSparqlEditorPage();
117
+ // Execute and wait for result give chance to application to be ready for the test, otherwise listeners are not
118
+ // attached and the test will fail
119
+ YasqeSteps.executeQuery();
120
+ LanguageSelectorSteps.getLanguageSelectorDropdownButton().should('contain', 'en');
121
+
122
+ // WHEN: I run a long-running query
123
+ QueryStubs.stubLongRunningQuery(repositoryId, LONG_RUNNING_QUERY_DELAY);
124
+ YasqeSteps.executeQueryWithoutWaitingForResult();
125
+ // AND: I try to change the application language
126
+ LanguageSelectorSteps.switchToFr();
127
+ // THEN: I expect to see a confirmation dialog
128
+ ModalDialogSteps.getDialog().should('exist');
129
+ ModalDialogSteps.getDialogBody().should('contain.text', 'You have running 1 query, that will be aborted.');
130
+
131
+ // WHEN: I cancel the dialog
132
+ ModalDialogSteps.cancel();
133
+ // THEN: I expect the application language not to be changed.
134
+ LanguageSelectorSteps.getLanguageSelectorDropdownButton().should('contain', 'en');
135
+ // AND: I expect the query not to be aborted
136
+ cy.get('@abortQuery.all').should('have.length', 0);
137
+
138
+ // WHEN: I confirm changing the language
139
+ LanguageSelectorSteps.switchToFr();
140
+ ModalDialogSteps.getDialog().should('exist');
141
+ ModalDialogSteps.getDialogBody().should('contain.text', 'You have running 1 query, that will be aborted.');
142
+ ModalDialogSteps.confirm();
143
+ // THEN: I expect the query to be aborted
144
+ cy.get('@abortQuery.all').should('have.length', 1);
145
+ // AND: I expect the application language to be changed
146
+ LanguageSelectorSteps.getLanguageSelectorDropdownButton().should('contain', 'fr');
147
+ });
148
+
149
+ it('should abort query when page is reloaded', () => {
150
+ // GIVEN: I visit a page with the ontotext-yasgui-web-component on it.
151
+ SparqlEditorSteps.visitSparqlEditorPage();
152
+ // AND: I run a long-running query
153
+ QueryStubs.stubLongRunningQuery(repositoryId, LONG_RUNNING_QUERY_DELAY);
154
+ YasqeSteps.executeQueryWithoutWaitingForResult();
155
+
156
+ // WHEN: I reload the page
157
+ SparqlEditorSteps.visitSparqlEditorPage();
158
+ // THEN: I expect the query to be aborted
159
+ cy.get('@abortQuery.all').should('have.length', 1);
160
+ });
161
+
162
+ context('Security', () => {
163
+
164
+ beforeEach(() => {
165
+ UserAndAccessSteps.visit();
166
+ UserAndAccessSteps.toggleSecurity();
167
+ LoginSteps.loginWithUser('admin', 'root');
168
+ // Wait for the login to finish, otherwise the next visit reloads the page before the session is stored.
169
+ HeaderSteps.getUserMenu().should('be.visible');
170
+ });
171
+
172
+ afterEach(() => {
173
+ cy.loginAsAdmin().then(() => {
174
+ cy.switchOffSecurity(true);
175
+ });
176
+ });
177
+
178
+ it('should sign out if user confirmed', () => {
179
+ // GIVEN: The security is on
180
+ // AND: I visit a page with the ontotext-yasgui-web-component on it.
181
+ SparqlEditorSteps.visitSparqlEditorPage();
182
+
183
+ // WHEN: I log out
184
+ LoginSteps.logout();
185
+ // THEN: I expect to navigate to the login page, because there are no long-running queries.
186
+ LoginSteps.verifyUrl();
187
+
188
+ // WHEN: I am logged in
189
+ LoginSteps.loginWithUser('admin', 'root');
190
+ // AND: I run a long-running query
191
+ QueryStubs.stubLongRunningQuery(repositoryId, LONG_RUNNING_QUERY_DELAY);
192
+ YasqeSteps.executeQueryWithoutWaitingForResult();
193
+ // AND: I try to log out
194
+ LoginSteps.logout();
195
+ // THEN: I expect to see a sign-out confirmation dialog
196
+ ModalDialogSteps.getDialog().should('exist');
197
+ ModalDialogSteps.getDialogBody()
198
+ .should('contain.text', 'You have running 1 query, that will be aborted.')
199
+ .and('contain.text', 'Are you sure that you want to sign out?');
200
+
201
+ // WHEN: I cancel the dialog
202
+ ModalDialogSteps.cancel();
203
+ // THEN: I expect to stay logged in
204
+ HeaderSteps.getUserMenu().should('be.visible');
205
+ // AND: I expect the query not to be aborted
206
+ cy.get('@abortQuery.all').should('have.length', 0);
207
+
208
+ // WHEN: I confirm signing out
209
+ LoginSteps.logout();
210
+ ModalDialogSteps.getDialog().should('exist');
211
+ ModalDialogSteps.getDialogBody().should('contain.text', 'You have running 1 query, that will be aborted.');
212
+ ModalDialogSteps.confirm();
213
+ // THEN: I expect to navigate to the login page.
214
+ LoginSteps.verifyUrl();
215
+ // AND: I expect the query to be aborted
216
+ cy.get('@abortQuery.all').should('have.length', 1);
217
+ });
218
+ });
219
+ });
@@ -93,7 +93,7 @@ describe('Yasgui tabs', () => {
93
93
  // When I execute a long-running query,
94
94
  QueryStubs.stubLongRunningQuery(repositoryId);
95
95
  SparqlEditorSteps.visitSparqlEditorPage();
96
- YasqeSteps.executeQueryWithoutWaiteResult();
96
+ YasqeSteps.executeQueryWithoutWaitingForResult();
97
97
  // and try to navigate to other page.
98
98
  MainMenuSteps.clickOnMenuImport();
99
99
 
@@ -44,13 +44,10 @@ describe('Download results', () => {
44
44
 
45
45
  // Then expect follow options to be present.
46
46
  YasrSteps.getDownloadAsOption(0).contains('JSON');
47
- YasrSteps.getDownloadAsOption(1).contains( 'JSON*');
48
- YasrSteps.getDownloadAsOption(2).contains( 'XML');
49
- YasrSteps.getDownloadAsOption(3).contains( 'XML*');
50
- YasrSteps.getDownloadAsOption(4).contains( 'CSV');
51
- YasrSteps.getDownloadAsOption(5).contains( 'TSV');
52
- YasrSteps.getDownloadAsOption(6).contains( 'TSV*');
53
- YasrSteps.getDownloadAsOption(7).contains( 'Binary RDF Results');
47
+ YasrSteps.getDownloadAsOption(1).contains( 'XML');
48
+ YasrSteps.getDownloadAsOption(2).contains( 'CSV');
49
+ YasrSteps.getDownloadAsOption(3).contains( 'TSV');
50
+ YasrSteps.getDownloadAsOption(4).contains( 'Binary RDF Results');
54
51
  });
55
52
 
56
53
  it('should download as JSON-LD after a CONSTRUCT query', () => {
@@ -5,7 +5,7 @@ import {GraphConfigStubs} from '../../../../stubs/graph-config-stubs.js';
5
5
  import {BrowserStubs} from '../../../../stubs/browser-stubs.js';
6
6
  import {VisualGraphSplitButtonSteps} from '../../../../steps/visual-graph-split-button-steps.js';
7
7
 
8
- describe('"Visualize" split button', () => {
8
+ describe('"VizGraph" split button', () => {
9
9
  let repositoryId;
10
10
 
11
11
  beforeEach(() => {
@@ -21,27 +21,27 @@ describe('"Visualize" split button', () => {
21
21
  cy.deleteRepository(repositoryId);
22
22
  });
23
23
 
24
- it('should display "Visualize" split button when user execute a CONSTRUCT query', () => {
24
+ it('should display "VizGraph" split button when user execute a CONSTRUCT query', () => {
25
25
  // WHEN: I visit a page with 'ontotext-yasgui-web-component' on it, and execute select query.
26
26
  executeSelectQuery();
27
- // THEN: I expect the 'Visualize' button to not be visible.
27
+ // THEN: I expect the 'VizGraph' button to not be visible.
28
28
  VisualGraphSplitButtonSteps.getVisualizeMainButton().should('not.be.visible');
29
29
 
30
30
  // WHEN: I execute a CONSTRUCT query.
31
31
  executeConstructQuery();
32
- // THEN: I expect the 'Visualize' button to be visible.
32
+ // THEN: I expect the 'VizGraph' button to be visible.
33
33
  VisualGraphSplitButtonSteps.getVisualizeMainButton().should('be.visible');
34
34
 
35
35
  // WHEN: I execute SELECT query again.
36
36
  executeSelectQuery();
37
- // THEN: I expect the 'Visualize' button to not be visible.
37
+ // THEN: I expect the 'VizGraph' button to not be visible.
38
38
  VisualGraphSplitButtonSteps.getVisualizeMainButton().should('not.be.visible');
39
39
  });
40
40
 
41
41
  it('should inform user that there no created graph configurations', () => {
42
42
  // GIVEN: There are no graph configurations.
43
43
  GraphConfigStubs.stubGetEmptyGraphConfigs();
44
- // AND: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'Visualize' button is visible.
44
+ // AND: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'VizGraph' button is visible.
45
45
  executeConstructQuery();
46
46
 
47
47
  // WHEN: I open the dropdown.
@@ -57,7 +57,7 @@ describe('"Visualize" split button', () => {
57
57
  });
58
58
 
59
59
  it('should open graphs-visualizations view when click on main button', () => {
60
- // GIVEN: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'Visualize' button is visible.
60
+ // GIVEN: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'VizGraph' button is visible.
61
61
  executeConstructQuery();
62
62
 
63
63
  // WHEN: I click on main button
@@ -69,7 +69,7 @@ describe('"Visualize" split button', () => {
69
69
  });
70
70
 
71
71
  it('should open graphs-visualizations view when select a graph configuration', () => {
72
- // GIVEN: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'Visualize' button is visible.
72
+ // GIVEN: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'VizGraph' button is visible.
73
73
  executeConstructQuery();
74
74
  GraphConfigStubs.stubGetGraphConfigs();
75
75
 
@@ -230,7 +230,7 @@ describe('TTYG chat list', () => {
230
230
  HomeSteps.visit();
231
231
  cy.wait('@get-chat');
232
232
  // and came back to the ttyg page
233
- TTYGViewSteps.visit(false);
233
+ TTYGViewSteps.visit();
234
234
 
235
235
  // Then I expect to last used chat be selected.
236
236
  TTYGViewSteps.getChatFromGroup(0, 2).should('have.class', 'selected');
@@ -259,6 +259,21 @@ describe('TTYG chat list', () => {
259
259
  // Then I expect the chat to be removed from the chat list
260
260
  TTYGViewSteps.getChatFromGroup(0, 2).should('not.exist');
261
261
  });
262
+
263
+ it('should show HTML in the chat name as text in the delete chat dialog', () => {
264
+ // Given a chat name contains HTML
265
+ TTYGStubs.stubChatsListGet('/ttyg/chats/get-chat-list-with-html-in-name.json');
266
+ TTYGStubs.stubChatGet();
267
+ TTYGStubs.stubAgentListGet();
268
+ TTYGViewSteps.visit();
269
+ cy.wait('@get-chat-list');
270
+ // When I select the delete action from the chat action menu
271
+ TTYGViewSteps.triggerDeleteChatActionMenu(1, 0);
272
+ // Then I expect the chat name to be displayed as text
273
+ ModalDialogSteps.getDialogBody().should('contain.text', '<img src="x" class="injected-html">Test chat 4');
274
+ ModalDialogSteps.getDialogBody().invoke('html').should('not.contain', '<img');
275
+ ModalDialogSteps.clickOnCancelButton();
276
+ });
262
277
  });
263
278
 
264
279
  /**
@@ -115,6 +115,20 @@ describe('Ttyg ChatPanel', () => {
115
115
  ChatPanelSteps.getAgentInfoMessage(1).contains('Agent changed to Databricks-biomarkers');
116
116
  });
117
117
 
118
+ it('should show HTML in the agent name as text in the agent changed info message', () => {
119
+ // Given an agent name contains HTML
120
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-with-html-in-names.json');
121
+ TTYGViewSteps.visit();
122
+ cy.wait('@get-agent-list');
123
+
124
+ // When I select a chat that has answers using different agents
125
+ TTYGViewSteps.selectChat(0, 1);
126
+
127
+ // Then I expect the agent name to be displayed as text
128
+ ChatPanelSteps.getAgentInfoMessage(0).should('contain.text', '<img src="x" class="injected-html">agent-2');
129
+ ChatPanelSteps.getAgentInfoMessage(0).invoke('html').should('not.contain', '<img');
130
+ });
131
+
118
132
  it('Should select last used agent when change the selected chat', () => {
119
133
  // Then I expect the last used agent to be selected.
120
134
  TTYGViewSteps.getAgentsMenuToggleButton().contains('agent-1');
@@ -0,0 +1,49 @@
1
+ import {RepositoriesStubs} from '../../stubs/repositories/repositories-stubs';
2
+ import {TTYGStubs} from '../../stubs/ttyg/ttyg-stubs';
3
+ import {TTYGViewSteps} from '../../steps/ttyg/ttyg-view-steps';
4
+ import {ChatPanelSteps} from '../../steps/ttyg/chat-panel-steps';
5
+ import {BrowserStubs} from '../../stubs/browser-stubs.js';
6
+
7
+ const EXPRESSION = '{{7*7}}';
8
+ const QUERY = `SELECT ?s WHERE { ?s rdfs:label "${EXPRESSION}" }`;
9
+
10
+ describe('Ttyg chat template injection', () => {
11
+
12
+ beforeEach(() => {
13
+ RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
14
+ RepositoriesStubs.stubBaseEndpoints('starwars');
15
+ cy.presetRepository('starwars');
16
+ TTYGStubs.stubChatsListGet();
17
+ TTYGStubs.stubAgentListGet();
18
+ // Given a chat whose question and answer contain an AngularJS expression
19
+ TTYGStubs.stubChatGet(0, '/ttyg/chats/get-chat-with-template-injection.json');
20
+
21
+ TTYGViewSteps.visit();
22
+ cy.wait('@get-chat-list');
23
+ cy.wait('@get-agent-list');
24
+ cy.wait('@get-chat');
25
+ cy.wait('@get-all-repositories');
26
+ });
27
+
28
+ it('should show AngularJS expressions in the chat literally', () => {
29
+ // Then I expect the expression in the question to be shown as it is, not evaluated
30
+ ChatPanelSteps.getChatDetailQuestionElement(0).should('contain', `What is ${EXPRESSION}?`);
31
+ // And the expression in the answer text and in its SPARQL code block to be shown as it is
32
+ ChatPanelSteps.getAssistantAnswer(0)
33
+ .should('contain', `The answer is ${EXPRESSION}.`)
34
+ .and('contain', QUERY)
35
+ .and('not.contain', '49');
36
+ });
37
+
38
+ it('should open the SPARQL query of an answer with its AngularJS expression unchanged', () => {
39
+ // Given the browser does not open new windows
40
+ BrowserStubs.stubWindowOpen();
41
+
42
+ // When I open the SPARQL query of the answer in the SPARQL editor
43
+ ChatPanelSteps.openInSparqlEditor(0);
44
+
45
+ // Then I expect the query to be opened with the expression unchanged
46
+ cy.get(BrowserStubs.WINDOW_OPEN_ALIAS())
47
+ .should('have.been.calledWith', `sparql?query=${encodeURIComponent(QUERY)}&execute=false`);
48
+ });
49
+ });
@@ -61,7 +61,7 @@ describe('TTYG create chat', () => {
61
61
  // and returns to the TTYG page
62
62
  TTYGStubs.stubChatsListGet("/ttyg/chats/create/get-chats-after-create.json");
63
63
  TTYGStubs.stubAgentGet();
64
- TTYGViewSteps.visit(false);
64
+ TTYGViewSteps.visit();
65
65
  cy.wait('@get-chat-list');
66
66
  // Then I expect newly created chat be selected.
67
67
  TTYGViewSteps.getChatFromGroup(0, 0).should('contain', 'New chat of Han Solo is a character');
@@ -47,4 +47,18 @@ describe('TTYG delete agent', () => {
47
47
  {name: 'Databricks-biomarkers', repositoryId: 'biomarkers', isRepositoryDeleted: false}
48
48
  ]);
49
49
  });
50
+
51
+ it('should show HTML in the agent name as text in the delete agent dialog', () => {
52
+ // Given an agent name contains HTML
53
+ TTYGStubs.stubChatsListGetNoResults();
54
+ TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-with-html-in-names.json');
55
+ TTYGViewSteps.visit();
56
+ TTYGViewSteps.expandAgentsSidebar();
57
+ // When I select the delete agent action
58
+ TTYGViewSteps.triggerDeleteAgentActionMenu(0);
59
+ // Then I expect the agent name to be displayed as text
60
+ ModalDialogSteps.getDialogBody().should('contain.text', '<img src="x" class="injected-html">agent-1');
61
+ ModalDialogSteps.getDialogBody().invoke('html').should('not.contain', '<img');
62
+ ModalDialogSteps.cancel();
63
+ });
50
64
  });
@@ -109,6 +109,14 @@ describe('TTYG edit an agent', () => {
109
109
 
110
110
  // THEN: The Save Agent button should be disabled
111
111
  TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
112
+ // AND: The panel of the FTS extraction method should be expanded, so that the reason is visible
113
+ TtygAgentSettingsModalSteps.getFtsDisabledHelp().should('be.visible');
114
+
115
+ // WHEN: I try to collapse the panel of the FTS extraction method
116
+ TtygAgentSettingsModalSteps.toggleFTSExtractionMethodPanel();
117
+ // THEN: The panel should remain expanded, because the precondition error is not resolved yet
118
+ TtygAgentSettingsModalSteps.getFtsDisabledHelp().should('be.visible');
119
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
112
120
  });
113
121
 
114
122
  it('should be able to edit Autocomplete extraction method option', () => {
@@ -39,7 +39,7 @@ describe('TTYG initial state with API key', () => {
39
39
  it('Should display the correct initial state when navigating via the navigation menu', () => {
40
40
  // Given, I visit the TTYG page via the navigation menu
41
41
  HomeSteps.visit();
42
- MainMenuSteps.clickOnTTYG();
42
+ MainMenuSteps.clickOnMenuTTYG();
43
43
  // Then,
44
44
  verifyStateWithApiKey();
45
45
  });
@@ -38,7 +38,7 @@ describe.skip('TTYG initial state with selected repository', () => {
38
38
  it('Should display the correct initial state when navigating via the navigation menu', () => {
39
39
  // Given, I visit the TTYG page via the navigation menu with a repository selected
40
40
  HomeSteps.visit();
41
- MainMenuSteps.clickOnTTYG();
41
+ MainMenuSteps.clickOnMenuTTYG();
42
42
  // Then,
43
43
  verifyStateWithSelectedRepository();
44
44
  });
@@ -14,7 +14,7 @@ describe('TTYG initial state without selected repository', () => {
14
14
  it('Should display the correct initial state when navigating via the navigation menu', () => {
15
15
  // Given, I visit the TTYG page via the navigation menu without a repository selected
16
16
  HomeSteps.visit();
17
- MainMenuSteps.clickOnTTYG();
17
+ MainMenuSteps.clickOnMenuTTYG();
18
18
  // Then,
19
19
  ErrorSteps.verifyNoConnectedRepoMessage();
20
20
  });
@@ -0,0 +1,52 @@
1
+ import {LoginSteps} from "../../../steps/login-steps";
2
+ import {HeaderSteps} from "../../../steps/header-steps";
3
+ import {MainMenuSteps} from "../../../steps/main-menu-steps";
4
+ import {VisualGraphSteps} from "../../../steps/visual-graph-steps";
5
+ import {ActiveRepositoryWidgetSteps} from "../../../steps/widgets/active-repository-widget-steps";
6
+
7
+ describe('Graph config owner actions', () => {
8
+ const password = 'Admin123!';
9
+ let repositoryId;
10
+ let username;
11
+ let graphConfigName;
12
+
13
+ beforeEach(() => {
14
+ repositoryId = 'graph-config-owner-' + Date.now();
15
+ username = 'graph-config-user-' + Date.now();
16
+ graphConfigName = 'graph-config-owner-' + Date.now();
17
+ cy.createRepository({id: repositoryId});
18
+ cy.presetRepository(repositoryId);
19
+ cy.createUser({username, password}, true);
20
+ cy.switchOnSecurity();
21
+ cy.loginAsAdmin();
22
+ cy.createGraphConfig(graphConfigName, repositoryId, true);
23
+ });
24
+
25
+ afterEach(() => {
26
+ cy.loginAsAdmin();
27
+ cy.switchOffSecurity(true);
28
+ cy.deleteGraphConfig(graphConfigName);
29
+ cy.deleteUser(username);
30
+ cy.deleteRepository(repositoryId);
31
+ });
32
+
33
+ it('should show edit and delete for own graph configs after switching users', () => {
34
+ // Given I am logged in as a basic user
35
+ LoginSteps.visitLoginPage();
36
+ LoginSteps.loginWithUser(username, password);
37
+ // Wait for the home page to load for the basic user. Cypress is fast and would log out before the page has
38
+ // loaded, so the page would never have the basic user and the test would not reproduce the problem.
39
+ ActiveRepositoryWidgetSteps.getActiveRepository().should('contain.text', repositoryId);
40
+ // And I log out
41
+ HeaderSteps.logout();
42
+
43
+ // When I log in as admin, without reloading the page
44
+ LoginSteps.loginWithUser('admin', 'root');
45
+ // And I open the Visual Graph page from the main menu
46
+ MainMenuSteps.clickOnVisualGraph();
47
+
48
+ // Then I expect to see the edit and delete buttons of the graph config I own
49
+ VisualGraphSteps.getEditConfigButton(graphConfigName).should('be.visible');
50
+ VisualGraphSteps.getDeleteConfigButton(graphConfigName).should('be.visible');
51
+ });
52
+ });
@@ -2,6 +2,7 @@ import {RepositorySelectorSteps} from '../../steps/repository-selector-steps.js'
2
2
  import {LoginSteps} from '../../steps/login-steps.js';
3
3
  import {UserAndAccessSteps} from '../../steps/setup/user-and-access-steps.js';
4
4
  import HomeSteps from '../../steps/home-steps.js';
5
+ import {GraphNavigatorSteps} from '../../steps/graph-navigator-steps.js';
5
6
 
6
7
  describe('URL with Repository ID parameter', () => {
7
8
  let repositoryId;
@@ -39,6 +40,22 @@ describe('URL with Repository ID parameter', () => {
39
40
  cy.url().should('include', 'repositoryId=' + repositoryId);
40
41
  RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
41
42
  });
43
+
44
+ it('should open a page of the new Workbench with repositoryId in url after login', () => {
45
+ // Given security is on
46
+ cy.switchOnSecurity();
47
+ // When I open a page of the new Workbench, which loads its code only when it is opened
48
+ GraphNavigatorSteps.visit();
49
+ // Then the login page should be shown
50
+ LoginSteps.getLoginPage().should('be.visible');
51
+ // When I log in with user admin
52
+ LoginSteps.loginWithUser('admin', 'root');
53
+ // Then the page should open with only the repositoryId parameter in the URL
54
+ GraphNavigatorSteps.verifyUrl();
55
+ GraphNavigatorSteps.verifyOnlyRepositoryParam(repositoryId);
56
+ // And the repository should be selected in the selector
57
+ RepositorySelectorSteps.getSelectedRepository().should('contain', repositoryId);
58
+ });
42
59
  });
43
60
 
44
61
  function enableSecurity(repositoryId) {
@@ -133,6 +133,10 @@ describe('Cookie policy', () => {
133
133
  cy.reload();
134
134
  // Then I expect the banner to be hidden
135
135
  CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
136
+ // Wait for the page to be fully loaded.
137
+ // Cypress executes actions very quickly, and without this wait the logout subscribers may not be registered yet.
138
+ // As a result, the logout event is not handled correctly and the logout operation may fail.
139
+ SettingsSteps.getCookiePolicyButton().should('be.visible');
136
140
  // When I logout
137
141
  LoginSteps.logout();
138
142
  // Then I should see the login page
@@ -0,0 +1,57 @@
1
+ import {LicenseStubs} from '../../../stubs/license-stubs';
2
+ import {LoginSteps} from '../../../steps/login-steps';
3
+ import {HeaderSteps} from '../../../steps/header-steps';
4
+
5
+ Cypress.env('set_default_user_data', false);
6
+
7
+ describe('License loading', () => {
8
+ beforeEach(() => {
9
+ cy.switchOnSecurity();
10
+ cy.loginAsAdmin();
11
+ LicenseStubs.spyGetLicense();
12
+ });
13
+
14
+ context('when free access is off', () => {
15
+ it('should load the license only for a logged in user', () => {
16
+ // Given I am on the login page and I am not logged in
17
+ LoginSteps.visitInProdMode();
18
+ LoginSteps.getLoginPage().should('be.visible');
19
+ // Then the license is not requested
20
+ cy.get('@get-license.all').should('have.length', 0);
21
+
22
+ // When I log in
23
+ LoginSteps.loginWithUser('admin', 'root');
24
+ // Then the license is requested
25
+ cy.wait('@get-license');
26
+
27
+ // When I reload the page
28
+ cy.reload();
29
+ // Then the license is requested again
30
+ cy.wait('@get-license');
31
+ });
32
+ });
33
+
34
+ context('when free access is on', () => {
35
+ beforeEach(() => {
36
+ cy.switchOnFreeAccess(true);
37
+ });
38
+
39
+ it('should load the license for the free access user and after each login state change', () => {
40
+ // When I open the login page without logging in
41
+ LoginSteps.visitInProdMode();
42
+ // Then the license is requested
43
+ cy.wait('@get-license');
44
+
45
+ // When I log in
46
+ HeaderSteps.login();
47
+ LoginSteps.loginWithUser('admin', 'root');
48
+ // Then the license is requested again
49
+ cy.wait('@get-license');
50
+
51
+ // When I log out
52
+ HeaderSteps.logout();
53
+ // Then the license is requested again for the free access user
54
+ cy.wait('@get-license');
55
+ });
56
+ });
57
+ });