graphdb-workbench-tests 2.3.1 → 2.4.0-TR1

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 (88) hide show
  1. package/fixtures/graphdb-import/resource-test-data.ttl +99 -0
  2. package/fixtures/graphql-editor/default-query-response.json +517 -0
  3. package/fixtures/locale-en.json +18 -5
  4. package/fixtures/namespaces/ontotext-generated-namespace.json +22 -0
  5. package/fixtures/queries/empty-query-response.json +11 -0
  6. package/integration/explore/graphs.overview.spec.js +4 -2
  7. package/integration/explore/similariti-index-create.spec.js +315 -0
  8. package/integration/explore/similarity-index.spec.js +88 -0
  9. package/integration/explore/similarity.spec.js +156 -47
  10. package/integration/explore/visual-graph/graphs-config.spec.js +452 -0
  11. package/integration/explore/{visual.graph.spec.js → visual-graph/visual.graph.spec.js} +145 -348
  12. package/integration/home/language-change.spec.js +3 -3
  13. package/integration/import/import.user.data.spec.js +4 -4
  14. package/integration/resource/resource.spec.js +354 -0
  15. package/integration/setup/jdbc-create.spec.js +316 -0
  16. package/integration/setup/jdbc.spec.js +99 -178
  17. package/integration/setup/my-settings.spec.js +9 -41
  18. package/integration/setup/sparql-template-create.js +141 -0
  19. package/integration/setup/sparql-templates.spec.js +82 -146
  20. package/integration/sparql-editor/actions/execute-query.spec.js +44 -0
  21. package/integration/sparql-editor/actions/expand-results-over-sameas.spec.js +136 -0
  22. package/integration/sparql-editor/actions/include-inferred-statements.spec.js +100 -0
  23. package/integration/sparql-editor/actions/save-query.spec.js +70 -0
  24. package/integration/sparql-editor/actions/show-saved-queries.spec.js +61 -0
  25. package/integration/sparql-editor/internationalization.spec.js +41 -0
  26. package/integration/sparql-editor/saved-query/abort-query.spec.js +60 -0
  27. package/integration/sparql-editor/saved-query/delete-query.spec.js +56 -0
  28. package/integration/sparql-editor/saved-query/edit-query.spec.js +68 -0
  29. package/integration/sparql-editor/saved-query/share-query.spec.js +78 -0
  30. package/integration/sparql-editor/sparql-editor.spec.js +20 -0
  31. package/integration/sparql-editor/yasgui-tabs.spec.js +107 -0
  32. package/integration/sparql-editor/yasr/download-as.spec.js +62 -0
  33. package/integration/sparql-editor/yasr/pagination.spec.js +234 -0
  34. package/integration/sparql-editor/yasr/table-plugin.spec.js +191 -0
  35. package/integration/sparql-editor/yasr/toolbar/visual-button.spec.js +56 -0
  36. package/integration-flaky/setup/sparql-template-create.js +139 -0
  37. package/integration-flaky/sparql-editor/actions/execute-update-query.spec.js +89 -0
  38. package/integration-flaky/sparql-editor/actions/share-query.spec.js +84 -0
  39. package/integration-flaky/sparql-editor/lucene-connector.spec.js +62 -0
  40. package/package.json +3 -2
  41. package/steps/application-steps.js +23 -0
  42. package/steps/error-steps.js +9 -0
  43. package/steps/explore/graphs-overview-steps.js +24 -0
  44. package/steps/explore/similarity-index-create-steps.js +113 -0
  45. package/steps/explore/similarity-indexes-steps.js +18 -0
  46. package/steps/import-steps.js +8 -1
  47. package/steps/language-selector-steps.js +22 -0
  48. package/steps/loader-steps.js +10 -0
  49. package/steps/lucene-connector-steps.js +43 -0
  50. package/steps/main-menu-steps.js +39 -0
  51. package/steps/modal-dialog-steps.js +113 -0
  52. package/steps/repository-selector-steps.js +26 -0
  53. package/steps/resource/resource-edit-steps.js +111 -0
  54. package/steps/resource/resource-steps.js +145 -0
  55. package/steps/setup/jdbc-create-steps.js +97 -0
  56. package/steps/setup/jdbc-steps.js +42 -0
  57. package/steps/setup/sparql-create-update-steps.js +55 -0
  58. package/steps/setup/sparql-templates-steps.js +34 -0
  59. package/steps/sparql-editor-steps.js +20 -0
  60. package/steps/visual-graph-steps.js +340 -3
  61. package/steps/yasgui/confirmation-dialog-steps.js +13 -0
  62. package/steps/yasgui/pagination-steps.js +47 -0
  63. package/steps/yasgui/plugin/error-plugin-steps.js +10 -0
  64. package/steps/yasgui/save-query-dialog.js +61 -0
  65. package/steps/yasgui/saved-queries-dialog.js +29 -0
  66. package/steps/yasgui/saved-query.js +25 -0
  67. package/steps/yasgui/share-saved-query-dialog.js +25 -0
  68. package/steps/yasgui/table-plugin-steps.js +29 -0
  69. package/steps/yasgui/yasgui-steps.js +191 -0
  70. package/steps/yasgui/yasqe-steps.js +187 -0
  71. package/steps/yasgui/yasr-steps.js +105 -0
  72. package/stubs/namespace-stubs.js +10 -0
  73. package/stubs/security-stubs.js +69 -0
  74. package/stubs/yasgui/connectors-stubs.js +12 -0
  75. package/stubs/yasgui/query-stubs.js +258 -0
  76. package/support/index.js +2 -0
  77. package/support/repository-commands.js +6 -1
  78. package/support/sparql-commands.js +1 -1
  79. package/support/visual-graph-commands.js +25 -0
  80. package/integration/sparql/main.menu.spec.js +0 -196
  81. package/integration/sparql/sparql-error-handling.spec.js +0 -74
  82. package/integration/sparql/sparql-language-change.spec.js +0 -58
  83. package/integration/sparql/sparql-result-formating.spec.js +0 -84
  84. package/integration/sparql/sparql.menu.spec.js +0 -1244
  85. package/integration-flaky/setup/sparql-templates.spec.js +0 -125
  86. package/integration-flaky/sparql/sparql-language-change.spec.js +0 -45
  87. package/integration-flaky/sparql/sparql.menu.spec.js +0 -75
  88. package/steps/sparql-steps.js +0 -227
@@ -1,125 +0,0 @@
1
- describe('SPARQL Templates', () => {
2
-
3
- let repositoryId;
4
- const TEMPLATE_NAME = "http://example.com/salary_template";
5
- const SPARQL_TEMPLATE = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
6
- "PREFIX factory: <http://factory/>\n" +
7
- "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" +
8
- "PREFIX spif: <http://spinrdf.org/spif#>\n" +
9
- "INSERT {\n" +
10
- "?id <http://factory/updatedOn> \"2021-10-01T07:55:38.238Z\"^^xsd:dateTime .\n" +
11
- "?split spif:split (\"blaaa/blaa\" \"/\")\n" +
12
- "} WHERE {\n" +
13
- "?id rdf:type <http://factory/Factory> .\n" +
14
- "?worker <http://factory/worksIn> ?id .\n" +
15
- "?worker <http://factory/hasSalary> ?oldSalary .\n" +
16
- "FILTER regex(STR(?id), \"fac\", \"i\")\n" +
17
- "?split spif:split (\"blaaa/blaa\" \"/\")\n" +
18
- "bind(now() as ?now)\n" +
19
- "}";
20
- const DEFAULT_QUERY = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
21
- "PREFIX ex: <http://example.com#>\n" +
22
- "DELETE {\n" +
23
- " ?subject ex:myPredicate ?oldValue .\n" +
24
- "} INSERT {\n" +
25
- " ?subject ex:myPredicate ?newValue .\n" +
26
- "} WHERE {\n" +
27
- " ?id rdf:type ex:MyType .\n" +
28
- " ?subject ex:isRelatedTo ?id .\n" +
29
- "}\n";
30
-
31
- before(() => {
32
- repositoryId = 'sparql-templates-repo' + Date.now();
33
- cy.createRepository({id: repositoryId});
34
- });
35
-
36
- beforeEach(() => {
37
- cy.visit('/sparql-templates', {
38
- onBeforeLoad: (win) => {
39
- win.localStorage.setItem('com.ontotext.graphdb.repository', repositoryId);
40
- }
41
- });
42
- cy.window()
43
- .then(() => getTemplatesTable().scrollIntoView().should('be.visible'));
44
- });
45
-
46
- after(() => {
47
- cy.deleteRepository(repositoryId);
48
- });
49
-
50
- it('Should create/edit/delete a SPARQL template', () => {
51
- // The test is flaky because it depends on an asynchronous DB insert which can not be easily observed from the UI
52
- //Click create template button
53
- getCreateSparqlTemplateButton().click();
54
- cy.waitUntilQueryIsVisible();
55
- //Type a valid Template IRI value in the filed
56
- getTemplateNameField().type(TEMPLATE_NAME);
57
- //Paste new template query and verify content
58
- cy.pasteQuery(SPARQL_TEMPLATE);
59
- verifyQueryAreaEquals(SPARQL_TEMPLATE);
60
- getSaveButton()
61
- .scrollIntoView()
62
- .click()
63
- .then(() => {
64
- cy.waitUntil(() =>
65
- cy.get('.edit-query-btn')
66
- .then((editBtn) => editBtn));
67
- });
68
- //Verify new template is stored in the templates table
69
- getTemplatesTable().should('be.visible').and('contain', TEMPLATE_NAME);
70
- //Edit template
71
- getEditTemplateButton(TEMPLATE_NAME);
72
- cy.waitUntilQueryIsVisible();
73
- verifyQueryAreaEquals(SPARQL_TEMPLATE);
74
- //Change query to the default template again
75
- cy.pasteQuery(DEFAULT_QUERY);
76
- verifyQueryAreaEquals(DEFAULT_QUERY);
77
- getSaveButton()
78
- .click()
79
- .then(() => {
80
- cy.waitUntil(() => cy.get('.edit-query-btn').should('be.visible'));
81
- });
82
- //Verify change to default template is persisted
83
- getEditTemplateButton(TEMPLATE_NAME);
84
- cy.waitUntilQueryIsVisible();
85
- verifyQueryAreaEquals(DEFAULT_QUERY);
86
- });
87
-
88
- function getTemplatesTable() {
89
- return cy.get('.sparql-templates-list');
90
- }
91
-
92
- function getCreateSparqlTemplateButton() {
93
- return cy.get('.clearfix .create-sql-table-configuration');
94
- }
95
-
96
- function getTemplateNameField() {
97
- return cy.get('.sparql-template-name');
98
- }
99
-
100
- function verifyQueryAreaEquals(query) {
101
- // Using the CodeMirror instance because getting the value from the DOM is very cumbersome
102
- getQueryArea().should((codeMirrorEl) => {
103
- const cm = codeMirrorEl[0].CodeMirror;
104
- expect(cm.getValue().trim()).to.equal(query.trim());
105
- });
106
- }
107
-
108
- function getQueryArea() {
109
- return cy.get('#queryEditor .CodeMirror');
110
- }
111
-
112
- function getSaveButton() {
113
- return cy.get('.save-query-btn');
114
- }
115
-
116
- function getEditTemplateButton(templateName) {
117
- return cy.get('#configurations-table tr')
118
- .contains(templateName)
119
- .parent()
120
- .parent()
121
- .within(() => {
122
- cy.get('.icon-edit').click();
123
- });
124
- }
125
- });
@@ -1,45 +0,0 @@
1
- import SparqlSteps from '../../steps/sparql-steps';
2
-
3
- describe('YASQE and YASR language change validation', () => {
4
- let repositoryId;
5
-
6
- beforeEach(() => {
7
- repositoryId = 'sparql-' + Date.now();
8
- SparqlSteps.createRepoAndVisit(repositoryId);
9
- });
10
-
11
- afterEach(() => {
12
- // Change the language back to English
13
- SparqlSteps.changeLanguage('en');
14
-
15
- cy.deleteRepository(repositoryId);
16
- });
17
-
18
- context('Default language should be active and language change should affect labels', () => {
19
- it('should change labels in SPARQL results view', function () {
20
- SparqlSteps.selectSavedQuery('Add statements');
21
- SparqlSteps.executeQuery();
22
- SparqlSteps.selectSavedQuery('SPARQL Select template');
23
- SparqlSteps.executeQuery();
24
-
25
- // Go to Results only view
26
- SparqlSteps.getResultsOnlyBtn().click();
27
-
28
- // Check some labels are in default language
29
- SparqlSteps.getTabWithTableText().should('contain', 'Table');
30
- SparqlSteps.getTabWithRawResponseText().should('contain', 'Raw Response');
31
- SparqlSteps.getTabWithPivotTableText().should('contain', 'Pivot Table');
32
- SparqlSteps.getTabWithGoogleChartText().should('contain', 'Google Chart');
33
- SparqlSteps.getResultsDescription().should('contain', 'Showing results from');
34
-
35
- SparqlSteps.changeLanguage('fr');
36
-
37
- // The text in the labels should change
38
- SparqlSteps.getTabWithTableText().should('contain', 'Tableau');
39
- SparqlSteps.getTabWithRawResponseText().should('contain', 'Réponse brute');
40
- SparqlSteps.getTabWithPivotTableText().should('contain', 'Table de pivotement');
41
- SparqlSteps.getTabWithGoogleChartText().should('contain', 'Graphique Google');
42
- SparqlSteps.getResultsDescription().should('contain', 'Liste de résultats de');
43
- });
44
- });
45
- })
@@ -1,75 +0,0 @@
1
- import SparqlSteps from '../../steps/sparql-steps';
2
-
3
- describe('SPARQL screen validation', () => {
4
- let repositoryId;
5
-
6
- const DEFAULT_QUERY = 'select * where { \n' +
7
- '\t?s ?p ?o .\n' +
8
- '} limit 100';
9
-
10
- afterEach(() => {
11
- cy.deleteRepository(repositoryId);
12
- });
13
-
14
- context('SPARQL queries & filtering', () => {
15
- beforeEach(() => {
16
- repositoryId = 'sparql-' + Date.now();
17
- SparqlSteps.createRepoAndVisit(repositoryId)
18
- });
19
-
20
- it('Test execute query with and without "Including inferred" selected', () => {
21
- let insertQuery = 'INSERT DATA { <urn:a> <http://a/b> <urn:b> . <urn:b> <http://a/b> <urn:c> . }';
22
-
23
- cy.pasteQuery(insertQuery);
24
- SparqlSteps.executeQuery();
25
-
26
- getUpdateMessage().should('be.visible');
27
- getResultsWrapper().should('not.be.visible');
28
-
29
- // Should be enabled by default
30
- getInferenceButton()
31
- .find('.icon-inferred-on')
32
- .should('be.visible');
33
-
34
- cy.pasteQuery(DEFAULT_QUERY);
35
- SparqlSteps.executeQuery();
36
-
37
- // Confirm that all statements are available (70 from ruleset, 2 explicit and 2 inferred)
38
- getResultsWrapper().should('be.visible');
39
-
40
- verifyResultsPageLength(74);
41
-
42
- // Uncheck ‘Include inferred’
43
- cy.waitUntil(() =>
44
- getInferenceButton().find('.icon-inferred-on')
45
- .then(infBtn => infBtn && cy.wrap(infBtn).click()))
46
- .then(() =>
47
- cy.get('.icon-inferred-off').should('be.visible'));
48
-
49
- // Confirm that only inferred statements (only 2) are available
50
- SparqlSteps.executeQuery();
51
- verifyResultsPageLength(2);
52
- });
53
- });
54
-
55
- function getTableResultRows() {
56
- return getResultsWrapper().find('.resultsTable tbody tr');
57
- }
58
-
59
- function verifyResultsPageLength(resultLength) {
60
- getTableResultRows()
61
- .should('have.length', resultLength);
62
- }
63
-
64
- function getUpdateMessage() {
65
- return cy.get('#yasr-inner .alert-info.update-info');
66
- }
67
-
68
- function getResultsWrapper() {
69
- return cy.get('#yasr-inner .yasr_results');
70
- }
71
-
72
- function getInferenceButton() {
73
- return cy.get('#inference').scrollIntoView();
74
- }
75
- });
@@ -1,227 +0,0 @@
1
- class SparqlSteps {
2
-
3
- static changeLanguage(language) {
4
- // Change the language
5
- cy.get('#languageGroupDrop').should('be.visible').click();
6
- cy.get('#lang-select-' + language).click();
7
- }
8
-
9
- static createRepoAndVisit(repositoryId, repoOptions = {}) {
10
- this.createRepository(repositoryId, repoOptions);
11
- this.visitSparql(true, repositoryId);
12
- }
13
-
14
- static createRepository(repositoryId, repoOptions = {}) {
15
- repoOptions.id = repositoryId;
16
- cy.createRepository(repoOptions);
17
- cy.initializeRepository(repositoryId);
18
- }
19
-
20
- static waitUntilSparqlPageIsLoaded() {
21
- cy.window();
22
- // Workbench loading screen should not be visible
23
- cy.get('.ot-splash').should('not.be.visible');
24
-
25
- // Run query button should be clickable
26
- this.getRunQueryButton().should('be.visible').and('not.be.disabled');
27
-
28
- this.waitUntilQueryIsVisible();
29
-
30
- // Run query button should be clickable
31
- this.getRunQueryButton().should('be.visible').and('not.be.disabled');
32
-
33
- // Editor should have a visible tab
34
- this.getTabs().find('.nav-link').should('be.visible');
35
-
36
- // No active loader
37
- this.getLoader().should('not.exist');
38
- }
39
-
40
- static visit() {
41
- cy.visit('/sparql');
42
- }
43
-
44
- static visitSparql(resetLocalStorage, repositoryId) {
45
- cy.visit('/sparql', {
46
- onBeforeLoad: (win) => {
47
- if (resetLocalStorage) {
48
- // Needed because the workbench app is very persistent with its local storage (it's hooked on before unload event)
49
- // TODO: Add a test that tests this !
50
- if (win.localStorage) {
51
- win.localStorage.clear();
52
- }
53
- if (win.sessionStorage) {
54
- win.sessionStorage.clear();
55
- }
56
- }
57
- win.localStorage.setItem('com.ontotext.graphdb.repository', repositoryId);
58
- }
59
- });
60
- this.waitUntilSparqlPageIsLoaded();
61
- }
62
-
63
- static getLoader() {
64
- return cy.get('.ot-loader-new-content');
65
- }
66
-
67
- static executeQuery() {
68
- this.getRunQueryButton().click();
69
- this.getLoader().should('not.exist');
70
- }
71
-
72
- static getRunQueryButton() {
73
- return cy.get('#wb-sparql-runQuery');
74
- }
75
-
76
- static getNoQueryRunInfo() {
77
- return cy.get('#yasr-inner .no-query-run');
78
- }
79
-
80
- static getQueryArea() {
81
- return cy.get('#queryEditor .CodeMirror');
82
- }
83
-
84
- static waitUntilQueryIsVisible() {
85
- return cy.waitUntil(() =>
86
- this.getQueryArea()
87
- .then((codeMirrorEl) =>
88
- codeMirrorEl && codeMirrorEl[0].CodeMirror.getValue().trim().length > 0));
89
- }
90
-
91
- static getTabs() {
92
- return cy.get('#sparql-content .nav-tabs .sparql-tab');
93
- }
94
-
95
- static getSavedQueriesPopupBtn() {
96
- return cy.get('#wb-sparql-toggleSampleQueries');
97
- }
98
-
99
- static openSavedQueriesPopup() {
100
- this.getSavedQueriesPopupBtn().click();
101
- }
102
-
103
- static getPopover() {
104
- return cy.get('.popover')
105
- .should('not.have.class', 'ng-animate')
106
- .and('not.have.class', 'in-add')
107
- .and('not.have.class', 'in-add-active');
108
- }
109
-
110
- static getSavedQueryFromPopup(savedQueryName) {
111
- return cy.get('#wb-sparql-queryInSampleQueries')
112
- .contains(savedQueryName)
113
- .closest('.saved-query');
114
- }
115
-
116
- static selectSavedQuery(savedQueryName) {
117
- this.openSavedQueriesPopup();
118
- this.getPopover().should('be.visible');
119
- this.getSavedQueryFromPopup(savedQueryName)
120
- .find('a')
121
- // the popup is opened and the link with the text is visible but cypress think it's 0x0px width/height
122
- .click({force: true});
123
- }
124
-
125
- static getSparqlQueryUpdateLabel() {
126
- return cy.get('#sparql-query-update-title-label');
127
- }
128
-
129
- static getDownloadBtn() {
130
- return cy.get('#saveAsBtn');
131
- }
132
-
133
- static getEditorAndResultsBtn() {
134
- return cy.get('.editor-and-results-btn');
135
- }
136
-
137
- static getResultsOnlyBtn() {
138
- return cy.get('.results-only-btn');
139
- }
140
-
141
- static getTabWithTableText() {
142
- return cy.get('.select_table');
143
- }
144
-
145
- static getTabWithRawResponseText() {
146
- return cy.get('.select_rawResponse');
147
- }
148
-
149
- static getTabWithPivotTableText() {
150
- return cy.get('.select_pivot');
151
- }
152
-
153
- static getTabWithGoogleChartText() {
154
- return cy.get('.select_gchart');
155
- }
156
-
157
- static getResultsDescription() {
158
- return cy.get('.results-description');
159
- }
160
-
161
- static typeQuery(query, clear = true, parseSpecialCharSequences = false) {
162
- if (clear) {
163
- SparqlSteps.clearQuery();
164
- }
165
- // Using force because the textarea is not visible
166
- SparqlSteps.getQueryTextArea().type(query, {force: true, parseSpecialCharSequences});
167
- }
168
-
169
- static clearQuery() {
170
- // Using force because the textarea is not visible
171
- SparqlSteps.getQueryTextArea().type(Cypress.env('modifierKey') + 'a{backspace}', {force: true});
172
- }
173
-
174
- static getQueryTextArea() {
175
- return SparqlSteps.getQueryArea().find('textarea');
176
- }
177
-
178
- static getResultsWrapper() {
179
- return cy.get('#yasr-inner .yasr_results');
180
- }
181
-
182
- static getResultInfo() {
183
- return cy.get('.results-info');
184
- }
185
-
186
- static getTableResultRows() {
187
- return SparqlSteps.getResultsWrapper().find('.resultsTable tbody tr');
188
- }
189
-
190
- static getResultCell(rowIndex, columnIndex) {
191
- return SparqlSteps.getTableResultRows().eq(rowIndex).find('td').eq(columnIndex);
192
- }
193
-
194
- static getResultCellLink(rowIndex, columnIndex) {
195
- return SparqlSteps.getResultCell(rowIndex, columnIndex).find('a').eq(0);
196
- }
197
-
198
- static getResultUriCell(rowIndex, columnIndex) {
199
- return SparqlSteps.getResultCell(rowIndex, columnIndex).find('.uri-cell');
200
- }
201
-
202
- static getResultLiteralCell(rowIndex, columnIndex) {
203
- return SparqlSteps.getResultCell(rowIndex, columnIndex).find('.literal-cell');
204
- }
205
-
206
- static getResultNoUriCell(rowIndex, columnIndex) {
207
- return SparqlSteps.getResultCell(rowIndex, columnIndex).find('.nonUri');
208
- }
209
-
210
- static getShowFullExceptionMessage() {
211
- return cy.get('.show-full-message-link');
212
- }
213
-
214
- static clickOnShowFullExceptionMessage() {
215
- SparqlSteps.getShowFullExceptionMessage().click();
216
- }
217
-
218
- static getShowLessExceptionMessage() {
219
- return cy.get('.show-less-message-link');
220
- }
221
-
222
- static clickOnShowLessExceptionMessage() {
223
- SparqlSteps.getShowLessExceptionMessage().click();
224
- }
225
- }
226
-
227
- export default SparqlSteps;