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,3 +1,6 @@
1
+ import {SparqlEditorSteps} from "../../steps/sparql-editor-steps";
2
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
3
+
1
4
  describe('My Settings', () => {
2
5
 
3
6
  let repositoryId;
@@ -109,44 +112,17 @@ describe('My Settings', () => {
109
112
  .then(() => {
110
113
  verifyUserSettingsUpdated();
111
114
  //Go to SPARQL editor and verify changes are persisted for the admin user
112
- cy.visit('/sparql');
113
- cy.window();
114
- cy.url().should('contain', `${Cypress.config('baseUrl')}/sparql`);
115
-
116
- waitUntilYASQUEBtnsAreVisible();
115
+ SparqlEditorSteps.visitSparqlEditorPage();
117
116
 
118
117
  //verify disabled default inference, sameAs and total results count
119
- cy.get('#inference')
120
- .should('be.visible')
121
- .find('.icon-2-5x.icon-inferred-off')
122
- .should('be.visible');
123
-
124
- cy.get('#sameAs')
125
- .should('be.visible')
126
- .find('.icon-2-5x.icon-sameas-off')
127
- .should('be.visible');
118
+ YasqeSteps.getIncludeInferredStatementsButton().should('have.class', 'icon-inferred-off');
119
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-off');
128
120
 
129
121
  //clear default query and paste a new one that will generate more than 1000 results
130
- cy.get('#queryEditor .CodeMirror').find('textarea')
131
- .type(Cypress.env('modifierKey') + 'a{backspace}', {force: true})
132
- .then(() => {
133
- cy.get('#queryEditor .CodeMirror').find('textarea')
134
- .invoke('val', testResultCountQuery).trigger('change', {force: true})
135
- .then(() => cy.verifyQueryAreaContains(testResultCountQuery));
136
- });
122
+ YasqeSteps.clearEditor();
123
+ YasqeSteps.pasteQuery(testResultCountQuery);
137
124
 
138
- cy.get('#wb-sparql-runQuery')
139
- .should('be.visible')
140
- .and('not.be.disabled').click()
141
- .then(() => {
142
- // Retry until success message is shown
143
- cy.waitUntil(() =>
144
- cy.get('#yasr-inner')
145
- .should('be.visible')
146
- .find('.results-info .text-xs-right')
147
- .find('.results-description')
148
- .then(result => result && result.text().indexOf('Showing results from 1 to 1,000 of at least 1,001') > -1));
149
- });
125
+ YasqeSteps.executeQuery();
150
126
 
151
127
  //return to My Settings to revert the changes
152
128
  visitSettingsView();
@@ -269,14 +245,6 @@ describe('My Settings', () => {
269
245
  return cy.get('#wb-user-submit').scrollIntoView().should('be.visible');
270
246
  }
271
247
 
272
- function waitUntilYASQUEBtnsAreVisible() {
273
- cy.waitUntil(() =>
274
- cy.get('#queryEditor #yasqe_buttons')
275
- .find('#buttons')
276
- .then(buttons =>
277
- buttons && buttons.length > 0));
278
- }
279
-
280
248
  function verifyUserSettingsUpdated() {
281
249
  cy.waitUntil(() =>
282
250
  cy.get('#toast-container')
@@ -0,0 +1,141 @@
1
+ import {SparqlCreateUpdateSteps} from "../../steps/setup/sparql-create-update-steps";
2
+ import {YasqeSteps} from "../../steps/yasgui/yasqe-steps";
3
+ import ImportSteps from "../../steps/import-steps";
4
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
5
+ import {MainMenuSteps} from "../../steps/main-menu-steps";
6
+ import {RepositorySelectorSteps} from "../../steps/repository-selector-steps";
7
+ import {SparqlTemplatesSteps} from "../../steps/setup/sparql-templates-steps";
8
+
9
+ describe('SPARQL create template', () => {
10
+
11
+ let repositoryId;
12
+ let secondRepositoryId;
13
+
14
+ beforeEach(() => {
15
+ repositoryId = 'sparql-templates-repo' + Date.now();
16
+ cy.createRepository({id: repositoryId});
17
+ cy.presetRepository(repositoryId);
18
+ secondRepositoryId = 'sparql-templates-second-repo' + Date.now();
19
+ cy.createRepository({id: secondRepositoryId});
20
+ SparqlCreateUpdateSteps.visit();
21
+ });
22
+
23
+ afterEach(() => {
24
+ cy.deleteRepository(repositoryId);
25
+ cy.deleteRepository(secondRepositoryId);
26
+ });
27
+
28
+ it('should has error message described that template id is required', () => {
29
+ // When I visit 'Sparql create template' view,
30
+ // and click on "Save" button without to fill template id.
31
+ SparqlCreateUpdateSteps.clickOnSaveButton();
32
+
33
+ // Then I expect to see error message.
34
+ SparqlCreateUpdateSteps.getRequiredErrorElement().contains('SPARQL template IRI is required');
35
+ });
36
+
37
+ it('should has error message described that template id is invalid', () => {
38
+ // When I visit 'Sparql create template' view,
39
+ // and fill an invalid template id,
40
+ const invalidTemplateName = 'invalid-template-id';
41
+ SparqlCreateUpdateSteps.typeTemplateId(invalidTemplateName);
42
+ // and click on "Save" button without to fill template id.
43
+ SparqlCreateUpdateSteps.clickOnSaveButton();
44
+
45
+ // Then I expect to see error message.
46
+ SparqlCreateUpdateSteps.getInvalidErrorElement().contains(`'${invalidTemplateName}' is not a valid IRI`);
47
+ });
48
+
49
+ it('should has error message described that query mode is invalid', () => {
50
+ // When I visit 'Sparql create template' view,
51
+ // and fill valid template id.
52
+ SparqlCreateUpdateSteps.typeTemplateId('http://test');
53
+
54
+ // When I fill non update query (select for example).
55
+ YasqeSteps.clearEditor();
56
+ YasqeSteps.writeInEditor('select * where {?s ?p ?o}');
57
+ // and click on "Save" button.
58
+ SparqlCreateUpdateSteps.clickOnSaveButton();
59
+
60
+ // Then I expect to see error message.
61
+ SparqlCreateUpdateSteps.getInvalidQueryModeElement().contains('The template query must be an UPDATE query');
62
+ });
63
+
64
+ it('should navigate to other view if there are no changes', () => {
65
+ // When I visit 'Sparql create template' view,
66
+ // and navigate to other view.
67
+ ImportSteps.visitUserImport(repositoryId);
68
+
69
+ // Then I expect to be navigated without confirmation.
70
+ ImportSteps.verifyUserImportUrl();
71
+ });
72
+
73
+ it('should confirm me before navigate when template id is changed', () => {
74
+ // When I visit 'Sparql create template' view,
75
+ // and set template id.
76
+ SparqlCreateUpdateSteps.typeTemplateId('http://test');
77
+
78
+ // When I try to navigate to other view
79
+ MainMenuSteps.clickOnMenu('Import');
80
+
81
+ // Then I expect to see confirm dialog inform me that there are unsaved changes.
82
+ ModalDialogSteps.getDialogHeader().contains('Confirm');
83
+ ModalDialogSteps.getDialogBody().contains('You have unsaved changes. Are you sure that you want to exit?');
84
+
85
+ // When I click on close button
86
+ ModalDialogSteps.clickOnCloseButton();
87
+
88
+ // Then I expect to stay on current page
89
+ SparqlCreateUpdateSteps.verifyUrl();
90
+
91
+ // When I click on cancel button.
92
+ MainMenuSteps.clickOnMenu('Import');
93
+ ModalDialogSteps.clickOnCancelButton();
94
+
95
+ // Then I expect to stay on current page
96
+ SparqlCreateUpdateSteps.verifyUrl();
97
+
98
+ // When I click on confirm button.
99
+ MainMenuSteps.clickOnMenu('Import');
100
+ ModalDialogSteps.clickOnConfirmButton();
101
+
102
+ // Then I expect to be navigated to other view.
103
+ ImportSteps.verifyUserImportUrl();
104
+ });
105
+
106
+ it('should not change the view if I am creating a new sparql template and change the repository', () => {
107
+ // When I visit 'Sparql create template' view,
108
+ // make some changes.
109
+ SparqlCreateUpdateSteps.typeTemplateId('http://test');
110
+
111
+ // When I change the repository.
112
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
113
+
114
+ // Then I expect the view not changed
115
+ SparqlCreateUpdateSteps.verifyUrl();
116
+ });
117
+
118
+ it('should ask for confirmation when try to save sparql template with already existing template id', () => {
119
+ // When I visit 'Sparql create template' view,
120
+ // create a SPARQL template
121
+ const templateName = 'http://' + Date.now();
122
+ SparqlCreateUpdateSteps.typeTemplateId(templateName);
123
+ SparqlCreateUpdateSteps.clickOnSaveButton();
124
+ SparqlTemplatesSteps.verifyUrl();
125
+
126
+ // When try to create a template with same template IRI
127
+ SparqlCreateUpdateSteps.visit();
128
+ SparqlCreateUpdateSteps.typeTemplateId(templateName);
129
+ SparqlCreateUpdateSteps.clickOnSaveButton();
130
+
131
+ // Then I expect to see confirm dialog.
132
+ ModalDialogSteps.getDialogHeader().contains('Confirm save');
133
+ ModalDialogSteps.getDialogBody().contains('Do you want to override the template query?');
134
+
135
+ // When I click on cancel button.
136
+ ModalDialogSteps.clickOnCancelButton();
137
+
138
+ // Then I expect template to not be saved and stay on sparql template create view.
139
+ SparqlCreateUpdateSteps.verifyUrl();
140
+ });
141
+ });
@@ -1,160 +1,96 @@
1
+ import {SparqlTemplatesSteps} from "../../steps/setup/sparql-templates-steps";
2
+ import {SparqlCreateUpdateSteps} from "../../steps/setup/sparql-create-update-steps";
3
+ import {ModalDialogSteps} from "../../steps/modal-dialog-steps";
4
+ import {ToasterSteps} from "../../steps/toaster-steps";
5
+
1
6
  describe('SPARQL Templates', () => {
2
7
 
3
8
  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
9
 
36
10
  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'));
11
+ repositoryId = 'sparql-templates-repo' + Date.now();
12
+ cy.createRepository({id: repositoryId});
13
+ cy.presetRepository(repositoryId);
14
+ SparqlTemplatesSteps.visit();
44
15
  });
45
16
 
46
- after(() => {
17
+ afterEach(() => {
47
18
  cy.deleteRepository(repositoryId);
48
19
  });
49
20
 
50
- it('Initial state', () => {
51
- cy.url().should('include', '/sparql-templates');
52
- //Verify templates table is empty
53
- getTemplatesTable().should('be.visible')
54
- .and('contain','No templates are defined');
55
- //Verify create template button is visible
56
- getCreateSparqlTemplateButton().should('be.visible');
57
- });
21
+ it('should not create a SPARQL template if cancel button is clicked', () => {
22
+ // When I visit 'Sparql templates' view,
23
+ // and click on create template button.
24
+ SparqlTemplatesSteps.clickOnCreateSparqlTemplateButton();
25
+
26
+ // Then, I expect to be navigated to "Sparql create template" view.
27
+ SparqlCreateUpdateSteps.verifyUrl();
28
+
29
+ // When I click on button cancel.
30
+ SparqlCreateUpdateSteps.clickOnCancelButton();
58
31
 
59
- it('Should create/edit/delete a SPARQL template', () => {
60
- //Click create template button
61
- getCreateSparqlTemplateButton().click();
62
- cy.waitUntilQueryIsVisible();
63
- //Test Template IRI field validation
64
- getSaveButton().click();
65
- //Verify error toast
66
- getToastError()
67
- .should('be.visible')
68
- .and('contain','SPARQL template IRI is required');
69
- //Type a valid Template IRI value in the filed
70
- getTemplateNameField().type(TEMPLATE_NAME);
71
- //Verify default query
72
- verifyQueryAreaEquals(DEFAULT_QUERY);
73
- //Paste new template query and verify content
74
- cy.pasteQuery(SPARQL_TEMPLATE);
75
- verifyQueryAreaEquals(SPARQL_TEMPLATE);
76
- getSaveButton()
77
- .scrollIntoView()
78
- .click()
79
- .then(() => {
80
- cy.waitUntil(() =>
81
- cy.get('.edit-query-btn')
82
- .then(editBtn => editBtn));
83
- });
84
- //Verify new template is stored in the templates table
85
- getTemplatesTable().should('be.visible')
86
- .and('contain',TEMPLATE_NAME);
87
- //Edit template
88
- getEditTemplateButton(TEMPLATE_NAME);
89
- cy.waitUntilQueryIsVisible();
90
- verifyQueryAreaEquals(SPARQL_TEMPLATE);
91
- //Cancel as no changes have been made
92
- getCancelButton().click();
93
- //Delete template and verify templates table is empty
94
- getDeleteTemplateButton(TEMPLATE_NAME);
95
- getConfirmDeleteTemplateButton().click();
96
- cy.url().should('include', '/sparql-templates');
97
- getTemplatesTable().should('be.visible')
98
- .and('contain','No templates are defined');
32
+ // Then, I expect to be navigated to "Sparql templates" view,
33
+ SparqlTemplatesSteps.verifyUrl();
34
+ // and expect that no query has been created.
35
+ SparqlTemplatesSteps.getSparqlTemplates().should('have.length', 0);
36
+ SparqlTemplatesSteps.getNoTemplateDefinedElement().should('contain.text', 'No templates are defined');
99
37
  });
100
38
 
101
- function getTemplatesTable() {
102
- return cy.get('.sparql-templates-list');
103
- }
104
-
105
- function getCreateSparqlTemplateButton() {
106
- return cy.get('.clearfix .create-sql-table-configuration');
107
- }
108
-
109
- function getTemplateNameField() {
110
- return cy.get('.sparql-template-name');
111
- }
112
-
113
- function verifyQueryAreaEquals(query) {
114
- // Using the CodeMirror instance because getting the value from the DOM is very cumbersome
115
- getQueryArea().should(codeMirrorEl => {
116
- const cm = codeMirrorEl[0].CodeMirror;
117
- expect(cm.getValue().trim()).to.equal(query.trim());
118
- });
119
- }
120
-
121
- function getQueryArea() {
122
- return cy.get('#queryEditor .CodeMirror');
123
- }
124
-
125
- function getSaveButton() {
126
- return cy.get('.save-query-btn');
127
- }
128
-
129
- function getCancelButton() {
130
- return cy.get('.cancel-query-btn');
131
- }
132
-
133
- function getToastError() {
134
- return cy.get('#toast-container');
135
- }
136
-
137
- function getEditTemplateButton(templateName) {
138
- return cy.get('#configurations-table tr')
139
- .contains(templateName)
140
- .parent()
141
- .parent()
142
- .within(() => {
143
- cy.get('.icon-edit').click();
144
- })
145
- }
146
-
147
- function getDeleteTemplateButton(templateName) {
148
- return cy.get('#configurations-table tr')
149
- .contains(templateName)
150
- .parent()
151
- .parent()
152
- .within(() => {
153
- cy.get('.icon-trash').click();
154
- })
155
- }
156
-
157
- function getConfirmDeleteTemplateButton() {
158
- return cy.get('.confirm-btn');
159
- }
39
+ it('should create a query and delete it', () => {
40
+ // When I visit 'Sparql templates' view,
41
+ // and click on create template button.
42
+ SparqlTemplatesSteps.clickOnCreateSparqlTemplateButton();
43
+
44
+ // Then, I expect to be navigated to "Sparql create template" view.
45
+ SparqlCreateUpdateSteps.verifyUrl();
46
+
47
+ const templateId = `http://test-${Date.now()}`;
48
+ // When I fill template id,
49
+ SparqlCreateUpdateSteps.typeTemplateId(templateId);
50
+
51
+ // and click on save button.
52
+ SparqlCreateUpdateSteps.clickOnSaveButton();
53
+
54
+ // Then, I expect to be navigated to "Sparql templates" view,
55
+ SparqlTemplatesSteps.verifyUrl();
56
+ // and expect a query has been created.
57
+ SparqlTemplatesSteps.getSparqlTemplates().should('have.length', 1);
58
+ SparqlTemplatesSteps.getNoTemplateDefinedElement().should('not.exist');
59
+ SparqlTemplatesSteps.getSparqlTemplate(templateId).should('exist');
60
+
61
+ // When I try to delete the query.
62
+ SparqlTemplatesSteps.deleteTemplate(templateId);
63
+
64
+ // Then I expect to see Warning dialog,
65
+ ModalDialogSteps.getDialogHeader().contains('Warning');
66
+ ModalDialogSteps.getDialogBody().contains(`Are you sure you want to delete the SPARQL template '${templateId}'?`);
67
+
68
+ // When click on close button
69
+ ModalDialogSteps.clickOnCloseButton();
70
+
71
+ //Then I expect query to be not deleted.
72
+ SparqlTemplatesSteps.getSparqlTemplate(templateId).should('exist');
73
+
74
+ // When confirm dialog is open,
75
+ SparqlTemplatesSteps.deleteTemplate(templateId);
76
+ // and click on cancel button.
77
+ ModalDialogSteps.clickOnCancelButton();
78
+
79
+ //Then I expect query to be not deleted.
80
+ SparqlTemplatesSteps.getSparqlTemplate(templateId).should('exist');
81
+
82
+ // When confirm dialog is open,
83
+ SparqlTemplatesSteps.deleteTemplate(templateId);
84
+ // and click on confirm button.
85
+ ModalDialogSteps.clickOnConfirmButton();
86
+
87
+ // Then, I expect to be navigated to "Sparql templates" view,
88
+ SparqlTemplatesSteps.verifyUrl();
89
+ // and expect that no query has been created.
90
+ SparqlTemplatesSteps.getSparqlTemplates().should('have.length', 0);
91
+ SparqlTemplatesSteps.getNoTemplateDefinedElement().should('contain.text', 'No templates are defined');
92
+
93
+ ToasterSteps.verifyTitle('Deleted successfully SPARQL template');
94
+ ToasterSteps.verifySuccess(templateId);
95
+ });
160
96
  });
@@ -0,0 +1,44 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
4
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
5
+
6
+ describe('Execute query', () => {
7
+
8
+ let repositoryId;
9
+
10
+ beforeEach(() => {
11
+ repositoryId = 'sparql-editor-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ QueryStubs.stubDefaultQueryResponse(repositoryId);
16
+
17
+ SparqlEditorSteps.visitSparqlEditorPage();
18
+ YasguiSteps.getYasgui().should('be.visible');
19
+ });
20
+
21
+ afterEach(() => {
22
+ cy.deleteRepository(repositoryId);
23
+ });
24
+
25
+ it('Should be able to execute query from each editor tab', () => {
26
+ cy.intercept('POST', `/repositories/${repositoryId}`).as('query');
27
+ YasqeSteps.executeQuery();
28
+ cy.wait('@query').then((interception) => {
29
+ const headers = interception.request.headers;
30
+ expect(headers).to.have.property('x-graphdb-local-consistency');
31
+ expect(headers).to.have.property('x-graphdb-repository-location');
32
+ expect(headers).to.have.property('x-graphdb-track-alias');
33
+ });
34
+ YasguiSteps.openANewTab();
35
+ YasguiSteps.getTabs().should('have.length', 2);
36
+ YasqeSteps.executeQuery();
37
+ cy.wait('@query').then((interception) => {
38
+ const headers = interception.request.headers;
39
+ expect(headers).to.have.property('x-graphdb-local-consistency');
40
+ expect(headers).to.have.property('x-graphdb-repository-location');
41
+ expect(headers).to.have.property('x-graphdb-track-alias');
42
+ });
43
+ });
44
+ });
@@ -0,0 +1,136 @@
1
+ import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
2
+ import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
3
+ import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";
4
+ import {QueryStubDescription, QueryStubs} from "../../../stubs/yasgui/query-stubs";
5
+
6
+ describe('Expand results over owl:sameAs', () => {
7
+
8
+ let repositoryId;
9
+
10
+ beforeEach(() => {
11
+ repositoryId = 'sparql-editor-' + Date.now();
12
+ QueryStubs.stubQueryCountResponse();
13
+ cy.createRepository({id: repositoryId});
14
+ cy.presetRepository(repositoryId);
15
+ });
16
+
17
+ afterEach(() => {
18
+ cy.deleteRepository(repositoryId);
19
+ });
20
+
21
+ it('Should be able to toggle expand results parameter', () => {
22
+ QueryStubs.stubInferAndSameAsDefaults(true, true);
23
+ SparqlEditorSteps.visitSparqlEditorPage();
24
+ YasguiSteps.getYasgui().should('be.visible');
25
+ const queryDescription = new QueryStubDescription()
26
+ .setRepositoryId(repositoryId)
27
+ .setTotalElements(1);
28
+ QueryStubs.stubQueryResults(queryDescription);
29
+ // When I open the editor
30
+ // Then I expect that expand results should be enabled by default
31
+ YasqeSteps.getExpandResultsOverSameAsButtonTooltip().should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: ON');
32
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-on');
33
+ YasqeSteps.executeQuery();
34
+ cy.wait('@query-1_0_1001_1').its('request.body').should('contain', 'sameAs=true');
35
+ // When I disable the expand results action
36
+ YasqeSteps.expandResultsOverSameAs();
37
+ // Then I expect that the button state should be changed
38
+ YasqeSteps.getExpandResultsOverSameAsButtonTooltip().should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: OFF');
39
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-off');
40
+ // And sameAs=false parameter should be sent with the request
41
+ YasqeSteps.executeQuery();
42
+ cy.wait('@query-1_0_1001_1').its('request.body').should('contain', 'sameAs=false');
43
+ YasqeSteps.expandResultsOverSameAs();
44
+ // When I disable the include inferred action
45
+ YasqeSteps.includeInferredStatements();
46
+ // Then I expect that sameAs should be disabled too
47
+ YasqeSteps.getExpandResultsOverSameAsButtonTooltip().should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
48
+ YasqeSteps.getExpandResultsOverSameAsButton().should('have.class', 'icon-same-as-off');
49
+ YasqeSteps.executeQuery();
50
+ cy.wait('@query-1_0_1001_1').its('request.body').should('contain', 'infer=false&sameAs=false');
51
+ });
52
+
53
+ it('should be enabled when infer is true and sameAs is true in user settings', () => {
54
+ QueryStubs.stubInferAndSameAsDefaults(true, true);
55
+
56
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
57
+ SparqlEditorSteps.visitSparqlEditorPage();
58
+ YasguiSteps.getYasgui().should('be.visible');
59
+
60
+ // Then I expect that "sameAs" element to be enabled by default
61
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-on');
62
+ // and the tooltip of element describes that "sameAs" element is enabled.
63
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: ON');
64
+
65
+ // When I open a new Tab.
66
+ YasguiSteps.openANewTab();
67
+
68
+ // Then I expect that "sameAs" element to be enabled in the new tab.
69
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-on');
70
+ // and the tooltip of element describes that "sameAs" element is enabled.
71
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: ON');
72
+ });
73
+
74
+ it('should not be enabled when infer is true and sameAs is false in user settings', () => {
75
+ QueryStubs.stubInferAndSameAsDefaults(true, false);
76
+
77
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
78
+ SparqlEditorSteps.visitSparqlEditorPage();
79
+ YasguiSteps.getYasgui().should('be.visible');
80
+
81
+ // Then I expect that "sameAs" element to be disabled by default
82
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
83
+ // and the tooltip of element describes that "sameAs" element is disabled.
84
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: OFF');
85
+
86
+ // When I open a new Tab.
87
+ YasguiSteps.openANewTab();
88
+
89
+ // Then I expect that "sameAs" element to be disabled in the new tab.
90
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
91
+ // and the tooltip of element describes that "sameAs" element is disabled.
92
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Expand results over owl:sameAs: OFF');
93
+ });
94
+
95
+ it('should not be enabled when infer is false and sameAs is true in user settings', () => {
96
+ QueryStubs.stubInferAndSameAsDefaults(false, true);
97
+
98
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
99
+ SparqlEditorSteps.visitSparqlEditorPage();
100
+ YasguiSteps.getYasgui().should('be.visible');
101
+
102
+ // Then I expect that "sameAs" element to be disabled by default
103
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
104
+ // and the tooltip of element describes that "infer" is required.
105
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
106
+
107
+ // When I open a new Tab.
108
+ YasguiSteps.openANewTab();
109
+
110
+ // Then I expect that "sameAs" element to be disabled in the new tab,
111
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
112
+ // and the tooltip of element describes that "infer" is required.
113
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
114
+ });
115
+
116
+ it('should not be enabled when infer is false and sameAs is false in user settings', () => {
117
+ QueryStubs.stubInferAndSameAsDefaults(false, false);
118
+
119
+ // When I visit a page with "ontotext-yasgui-web-component" in it.
120
+ SparqlEditorSteps.visitSparqlEditorPage();
121
+ YasguiSteps.getYasgui().should('be.visible');
122
+
123
+ // Then I expect that "sameAs" element to be disabled by default,
124
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
125
+ // and the tooltip of element describes that "infer" is required.
126
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
127
+
128
+ // When I open a new Tab.
129
+ YasguiSteps.openANewTab();
130
+
131
+ // Then I expect that "sameAs" element to be disabled in the new tab,
132
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-same-as-off');
133
+ // and the tooltip of element describes that "infer" is required.
134
+ YasqeSteps.getActionButtonTooltip(4).should('have.attr', 'data-tooltip', 'Requires \'Include Inferred\'!');
135
+ });
136
+ });