graphdb-workbench-tests 2.5.1 → 2.6.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 (114) 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/guides/guides.json +764 -0
  4. package/fixtures/guides/movies.ttl +629 -0
  5. package/fixtures/guides/starwars.ttl +4384 -0
  6. package/fixtures/locale-en.json +44 -10
  7. package/fixtures/namespaces/ontotext-generated-namespace.json +22 -0
  8. package/fixtures/queries/empty-query-response.json +11 -0
  9. package/integration/cluster/cluster-management.spec.js +1 -2
  10. package/integration/explore/graphs.overview.spec.js +4 -2
  11. package/integration/explore/similariti-index-create.spec.js +333 -0
  12. package/integration/explore/similarity-index.spec.js +88 -0
  13. package/integration/explore/similarity.spec.js +180 -56
  14. package/integration/explore/visual-graph/graphs-config.spec.js +453 -0
  15. package/integration/explore/{visual.graph.spec.js → visual-graph/visual.graph.spec.js} +146 -347
  16. package/integration/guides/movies-interactive-guide.spec.js +73 -0
  17. package/integration/guides/star-wars-interactive-guide.js +60 -0
  18. package/integration/home/language-change.spec.js +3 -3
  19. package/integration/import/import.user.data.spec.js +2 -0
  20. package/integration/resource/resource.spec.js +357 -0
  21. package/integration/setup/aclmanagement/create-rule.spec.js +88 -11
  22. package/integration/setup/aclmanagement/delete-rule.spec.js +6 -4
  23. package/integration/setup/aclmanagement/edit-rule.spec.js +13 -8
  24. package/integration/setup/aclmanagement/render-rules.spec.js +4 -2
  25. package/integration/setup/aclmanagement/reorder-rules.spec.js +5 -3
  26. package/integration/setup/aclmanagement/revert-rules.spec.js +4 -3
  27. package/integration/setup/aclmanagement/scopes.spec.js +220 -0
  28. package/integration/setup/aclmanagement/update-rules.spec.js +17 -9
  29. package/integration/setup/jdbc-create.spec.js +330 -0
  30. package/integration/setup/jdbc.spec.js +78 -154
  31. package/integration/setup/my-settings.spec.js +9 -41
  32. package/integration/setup/sparql-template-create.js +150 -0
  33. package/integration/setup/sparql-templates.spec.js +82 -146
  34. package/integration/sparql-editor/actions/execute-query.spec.js +44 -0
  35. package/integration/sparql-editor/actions/expand-results-over-sameas.spec.js +136 -0
  36. package/integration/sparql-editor/actions/include-inferred-statements.spec.js +100 -0
  37. package/integration/sparql-editor/actions/inferred-sameas.spec.js +47 -0
  38. package/integration/sparql-editor/actions/save-query.spec.js +70 -0
  39. package/integration/sparql-editor/actions/show-saved-queries.spec.js +61 -0
  40. package/integration/sparql-editor/internationalization.spec.js +41 -0
  41. package/integration/sparql-editor/saved-query/abort-query.spec.js +51 -0
  42. package/integration/sparql-editor/saved-query/delete-query.spec.js +56 -0
  43. package/integration/sparql-editor/saved-query/edit-query.spec.js +68 -0
  44. package/integration/sparql-editor/saved-query/share-query.spec.js +78 -0
  45. package/integration/sparql-editor/sparql-editor.spec.js +55 -0
  46. package/integration/sparql-editor/yasgui-tabs.spec.js +107 -0
  47. package/integration/sparql-editor/yasr/download-as.spec.js +54 -0
  48. package/integration/sparql-editor/yasr/pagination.spec.js +234 -0
  49. package/integration/sparql-editor/yasr/table-plugin.spec.js +39 -0
  50. package/integration/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +57 -0
  51. package/integration-flaky/explore/visual.graph.spec.js +3 -2
  52. package/integration-flaky/setup/sparql-template-create.js +139 -0
  53. package/integration-flaky/sparql-editor/actions/execute-update-query.spec.js +89 -0
  54. package/integration-flaky/sparql-editor/actions/share-query.spec.js +84 -0
  55. package/integration-flaky/sparql-editor/lucene-connector.spec.js +62 -0
  56. package/integration-flaky/sparql-editor/plugins/error-plugin.spec.js +83 -0
  57. package/integration-flaky/sparql-editor/yasr/table-plugin.spec.js +81 -0
  58. package/package.json +3 -1
  59. package/steps/application-steps.js +5 -0
  60. package/steps/autocomplete-steps.js +10 -0
  61. package/steps/error-steps.js +9 -0
  62. package/steps/explore/graphs-overview-steps.js +24 -0
  63. package/steps/explore/similarity-index-create-steps.js +113 -0
  64. package/steps/explore/similarity-indexes-steps.js +18 -0
  65. package/steps/guides/guide-dialog-steps.js +38 -0
  66. package/steps/guides/guide-steps.js +278 -0
  67. package/steps/guides/movies-guide-steps.js +241 -0
  68. package/steps/guides/star-wars-guide-steps.js +188 -0
  69. package/steps/import-steps.js +16 -0
  70. package/steps/language-selector-steps.js +22 -0
  71. package/steps/loader-steps.js +10 -0
  72. package/steps/lucene-connector-steps.js +43 -0
  73. package/steps/main-menu-steps.js +67 -0
  74. package/steps/repository-selector-steps.js +26 -0
  75. package/steps/repository-steps.js +4 -0
  76. package/steps/resource/resource-edit-steps.js +111 -0
  77. package/steps/resource/resource-steps.js +149 -0
  78. package/steps/setup/acl-management-steps.js +193 -35
  79. package/steps/setup/jdbc-create-steps.js +97 -0
  80. package/steps/setup/jdbc-steps.js +42 -0
  81. package/steps/setup/sparql-create-update-steps.js +55 -0
  82. package/steps/setup/sparql-templates-steps.js +38 -0
  83. package/steps/sparql-editor-steps.js +20 -0
  84. package/steps/sparql-steps.js +0 -6
  85. package/steps/visual-graph-steps.js +365 -6
  86. package/steps/yasgui/confirmation-dialog-steps.js +13 -0
  87. package/steps/yasgui/pagination-steps.js +47 -0
  88. package/steps/yasgui/plugin/error-plugin-steps.js +30 -0
  89. package/steps/yasgui/save-query-dialog.js +61 -0
  90. package/steps/yasgui/saved-queries-dialog.js +29 -0
  91. package/steps/yasgui/saved-query.js +25 -0
  92. package/steps/yasgui/share-saved-query-dialog.js +25 -0
  93. package/steps/yasgui/table-plugin-steps.js +29 -0
  94. package/steps/yasgui/yasgui-loader.js +10 -0
  95. package/steps/yasgui/yasgui-steps.js +191 -0
  96. package/steps/yasgui/yasqe-steps.js +187 -0
  97. package/steps/yasgui/yasr-steps.js +108 -0
  98. package/stubs/namespace-stubs.js +10 -0
  99. package/stubs/repositories-stub.js +58 -0
  100. package/stubs/security-stubs.js +69 -0
  101. package/stubs/yasgui/connectors-stubs.js +12 -0
  102. package/stubs/yasgui/query-stubs.js +253 -0
  103. package/support/index.js +3 -0
  104. package/support/repository-commands.js +5 -5
  105. package/support/sparql-commands.js +1 -1
  106. package/support/visual-graph-commands.js +25 -0
  107. package/integration/sparql/main.menu.spec.js +0 -232
  108. package/integration/sparql/sparql-error-handling.spec.js +0 -74
  109. package/integration/sparql/sparql-language-change.spec.js +0 -58
  110. package/integration/sparql/sparql-result-formating.spec.js +0 -84
  111. package/integration/sparql/sparql.menu.spec.js +0 -1253
  112. package/integration-flaky/setup/sparql-templates.spec.js +0 -125
  113. package/integration-flaky/sparql/sparql-language-change.spec.js +0 -45
  114. package/integration-flaky/sparql/sparql.menu.spec.js +0 -75
@@ -0,0 +1,150 @@
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
+ // When I change the repository.
111
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
112
+ // Then I expect the view not changed
113
+ SparqlCreateUpdateSteps.verifyUrl();
114
+ // And I expect to see a confirmation dialog.
115
+ ModalDialogSteps.getDialog().should('be.visible');
116
+ });
117
+
118
+ it('Should redirect to templates catalog view when repository is changed', () => {
119
+ // When I visit 'Sparql create template' view
120
+ // When I change the repository.
121
+ RepositorySelectorSteps.selectRepository(secondRepositoryId);
122
+ // Then I expect to be redirected to templates catalog view.
123
+ SparqlTemplatesSteps.verifyUrl();
124
+ SparqlTemplatesSteps.getSparqlTemplatesListContainer().should('be.visible');
125
+ });
126
+
127
+ it('should ask for confirmation when try to save sparql template with already existing template id', () => {
128
+ // When I visit 'Sparql create template' view,
129
+ // create a SPARQL template
130
+ const templateName = 'http://' + Date.now();
131
+ SparqlCreateUpdateSteps.typeTemplateId(templateName);
132
+ SparqlCreateUpdateSteps.clickOnSaveButton();
133
+ SparqlTemplatesSteps.verifyUrl();
134
+
135
+ // When try to create a template with same template IRI
136
+ SparqlCreateUpdateSteps.visit();
137
+ SparqlCreateUpdateSteps.typeTemplateId(templateName);
138
+ SparqlCreateUpdateSteps.clickOnSaveButton();
139
+
140
+ // Then I expect to see confirm dialog.
141
+ ModalDialogSteps.getDialogHeader().contains('Confirm save');
142
+ ModalDialogSteps.getDialogBody().contains('Do you want to override the template query?');
143
+
144
+ // When I click on cancel button.
145
+ ModalDialogSteps.clickOnCancelButton();
146
+
147
+ // Then I expect template to not be saved and stay on sparql template create view.
148
+ SparqlCreateUpdateSteps.verifyUrl();
149
+ });
150
+ });
@@ -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('ls.repository-id', 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
+ });